Package org.openrefine.wikidata.updates
Class ItemEdit
java.lang.Object
org.openrefine.wikidata.updates.LabeledStatementEntityEdit
org.openrefine.wikidata.updates.TermedStatementEntityEdit
org.openrefine.wikidata.updates.ItemEdit
- All Implemented Interfaces:
EntityEdit,StatementEntityEdit
Represents a candidate edit on an existing item or the creation of a new one.
This is the representation before any comparison with existing data.
- Author:
- Antonin Delpeuch
-
Field Summary
Fields inherited from class org.openrefine.wikidata.updates.LabeledStatementEntityEdit
id, labels, labelsIfNew, statements -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedItemEdit(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id, List<StatementEdit> statements, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labels, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labelsIfNew, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptions, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptionsIfNew, Map<String, List<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>> aliases) Protected constructor to avoid re-constructing term maps when merging two entity updates.ItemEdit(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id, List<StatementEdit> statements, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labels, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labelsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptions, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptionsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> aliases) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()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.ItemDocumentIn case the subject id is new, returns the corresponding new item document to be created.toString()Methods inherited from class org.openrefine.wikidata.updates.TermedStatementEntityEdit
constructTermListMap, getAliases, getDescriptions, getDescriptionsIfNew, isEmptyMethods inherited from class org.openrefine.wikidata.updates.LabeledStatementEntityEdit
getEntityId, getLabels, getLabelsIfNew, getStatementEdits, getStatementGroupEdits, getStatementGroupsForNewEntity, mergeSingleTermMaps, toStatementUpdateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openrefine.wikidata.updates.EntityEdit
isNew, isNullMethods inherited from interface org.openrefine.wikidata.updates.StatementEntityEdit
getAddedStatements, getDeletedStatements
-
Constructor Details
-
ItemEdit
public ItemEdit(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id, List<StatementEdit> statements, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labels, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labelsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptions, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptionsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> aliases) Constructor.- Parameters:
id- the subject of the document. It can be a reconciled entity value for new entities.statements- the statements to change on the entity.labels- the labels to add on the entity, overriding any existing one in that languagelabelsIfNew- the labels to add on the entity, only if no label for that language existsdescriptions- the descriptions to add on the item, overriding any existing one in that languagedescriptionsIfNew- the descriptions to add on the item, only if no description for that language existsaliases- the aliases to add on the item. In theory their order should matter but in practice people rarely rely on the order of aliases so this is just kept as a set for simplicity.
-
ItemEdit
protected ItemEdit(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id, List<StatementEdit> statements, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labels, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labelsIfNew, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptions, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> descriptionsIfNew, Map<String, List<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>> aliases) Protected constructor to avoid re-constructing term maps when merging two entity updates. No validation is done on the arguments, they all have to be non-null.- Parameters:
id- the subject of the updatestatements- the statements to add or deletelabels- the labels to add on the entity, overriding any existing one in that languagelabelsIfNew- the labels to add on the entity, only if no label for that language existsdescriptions- the descriptions to add on the item, overriding any existing one in that languagedescriptionsIfNew- the descriptions to add on the item, only if no description for that language existsaliases- the aliases to add
-
-
Method Details
-
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
-
toEntityUpdate
public 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. -
toNewEntity
public org.wikidata.wdtk.datamodel.interfaces.ItemDocument toNewEntity()In case the subject id is new, returns the corresponding new item document to be created. -
equals
-
hashCode
public int hashCode() -
toString
-