Package org.openrefine.wikidata.updates
Interface EntityEdit
- All Known Subinterfaces:
StatementEntityEdit
- All Known Implementing Classes:
ItemEdit,LabeledStatementEntityEdit,MediaInfoEdit,TermedStatementEntityEdit
public interface EntityEdit
A class to plan an update of an entity, after evaluating the schema but
before fetching the current content of the entity (this is why it does not
extend
EntityUpdate).- Author:
- Antonin Delpeuch
-
Method Summary
Modifier and TypeMethodDescriptionorg.wikidata.wdtk.datamodel.interfaces.EntityIdValueThe id of the entity being editedstatic Map<org.wikidata.wdtk.datamodel.interfaces.EntityIdValue,EntityEdit> groupBySubject(List<EntityEdit> entityDocuments) Group a list ofEntityUpdates by subject: this is useful to make one single edit per entity.booleanisEmpty()default booleanisNew()Is this update about a new entity?default booleanisNull()merge(EntityEdit otherEdit) Merges all the changes in other with this instance.org.wikidata.wdtk.datamodel.interfaces.EntityUpdatetoEntityUpdate(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.EntityDocumentIn case the subject id is new, returns the corresponding new item document to be created.
-
Method Details
-
getEntityId
org.wikidata.wdtk.datamodel.interfaces.EntityIdValue getEntityId()The id of the entity being edited -
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. -
merge
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:
other- 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 ofEntityUpdates by subject: this is useful to make one single edit per entity.- Parameters:
entityDocuments-- Returns:
- a map from entity ids to merged
EntityUpdatefor 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
-