Interface EntityEdit

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Set<Long> getContributingRowIds()
      The set of row ids which contributed to generate this entity edit.
      org.wikidata.wdtk.datamodel.interfaces.EntityIdValue getEntityId()
      The id of the entity being edited
      static Map<org.wikidata.wdtk.datamodel.interfaces.EntityIdValue,​EntityEdit> groupBySubject​(List<EntityEdit> entityDocuments)
      Group a list of EntityUpdates by subject: this is useful to make one single edit per entity.
      boolean isEmpty()  
      default boolean isNew()
      Is this update about a new entity?
      default boolean isNull()  
      EntityEdit merge​(EntityEdit otherEdit)
      Merges all the changes in other with this instance.
      default boolean requiresFetchingExistingState()  
      org.wikidata.wdtk.datamodel.interfaces.EntityUpdate toEntityUpdate​(org.wikidata.wdtk.datamodel.interfaces.EntityDocument entityDocument)
      In case the subject id is not new, returns the corresponding update given the current state of the entity.
      org.wikidata.wdtk.datamodel.interfaces.EntityDocument toNewEntity()
      In case the subject id is new, returns the corresponding new item document to be created.
    • Method Detail

      • getEntityId

        org.wikidata.wdtk.datamodel.interfaces.EntityIdValue getEntityId()
        The id of the entity being edited
      • getContributingRowIds

        Set<Long> getContributingRowIds()
        The set of row ids which contributed to generate this entity edit.
      • toEntityUpdate

        org.wikidata.wdtk.datamodel.interfaces.EntityUpdate toEntityUpdate​(org.wikidata.wdtk.datamodel.interfaces.EntityDocument entityDocument)
        In case the subject id is not new, returns the corresponding update given the current state of the entity. Throws a validation exception otherwise.
        Parameters:
        entityDocument - The current state of the entity. If requiresFetchingExistingState() returns false, then this parameter may be null, as it should not be required to compute the EntityUpdate.
      • merge

        EntityEdit merge​(EntityEdit otherEdit)
        Merges all the changes in other with this instance. Both updates should have the same subject. Changes coming from `other` have priority over changes from this instance. This instance is not modified, the merged update is returned instead.
        Parameters:
        otherEdit - the other change that should be merged
      • toNewEntity

        org.wikidata.wdtk.datamodel.interfaces.EntityDocument toNewEntity()
        In case the subject id is new, returns the corresponding new item document to be created. Throws a validation exception otherwise.
      • groupBySubject

        static Map<org.wikidata.wdtk.datamodel.interfaces.EntityIdValue,​EntityEdit> groupBySubject​(List<EntityEdit> entityDocuments)
        Group a list of EntityUpdates by subject: this is useful to make one single edit per entity.
        Parameters:
        entityDocuments -
        Returns:
        a map from entity ids to merged EntityUpdate for that id
      • isNew

        default boolean isNew()
        Is this update about a new entity?
      • isEmpty

        boolean isEmpty()
        Returns:
        true when this change leaves the content of the document untouched. In the case of a new entity, this could still mean making an edit to create the blank entity.
      • isNull

        default boolean isNull()
        Returns:
        true when this change is empty and its subject is not new
      • requiresFetchingExistingState

        default boolean requiresFetchingExistingState()
        Returns:
        true when performing this edit requires fetching the current contents of the entity before making the edit. By default, this is true when making non-empty edits on existing entities. But implementations may override this, to spare the request to fetch the current entity, if that information is not necessary to compute the update.