Package org.openrefine.wikibase.updates
Class TermedStatementEntityEdit
- java.lang.Object
-
- org.openrefine.wikibase.updates.LabeledStatementEntityEdit
-
- org.openrefine.wikibase.updates.TermedStatementEntityEdit
-
- All Implemented Interfaces:
EntityEdit
,StatementEntityEdit
- Direct Known Subclasses:
ItemEdit
public abstract class TermedStatementEntityEdit extends LabeledStatementEntityEdit
A class to plan an update of an entity, after evaluating the statements but before fetching the current content of the entity (this is why it does not extend StatementsUpdate).- Author:
- Antonin Delpeuch
-
-
Field Summary
-
Fields inherited from class org.openrefine.wikibase.updates.LabeledStatementEntityEdit
contributingRowIds, id, labels, labelsIfNew, statements
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TermedStatementEntityEdit(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, Set<Long> contributingRowIds)
Protected constructor to avoid re-constructing term maps when merging two entity updates.TermedStatementEntityEdit(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, Set<Long> contributingRowIds)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,List<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>>
constructTermListMap(Collection<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> mltvs)
Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
getAliases()
Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
getDescriptions()
Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
getDescriptionsIfNew()
boolean
isEmpty()
-
Methods inherited from class org.openrefine.wikibase.updates.LabeledStatementEntityEdit
getContributingRowIds, getEntityId, getLabels, getLabelsIfNew, getStatementEdits, getStatementGroupEdits, getStatementGroupsForNewEntity, mergeSingleTermMaps, toStatementUpdate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openrefine.wikibase.updates.EntityEdit
isNew, isNull, merge, requiresFetchingExistingState, toEntityUpdate, toNewEntity
-
Methods inherited from interface org.openrefine.wikibase.updates.StatementEntityEdit
getAddedStatements, getDeletedStatements
-
-
-
-
Constructor Detail
-
TermedStatementEntityEdit
public TermedStatementEntityEdit(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, Set<Long> contributingRowIds)
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.contributingRowIds
- the set of row ids which generated this edit
-
TermedStatementEntityEdit
protected TermedStatementEntityEdit(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, Set<Long> contributingRowIds)
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 Detail
-
isEmpty
public boolean isEmpty()
- Returns:
- true when this change leaves the content of the document untouched
-
getDescriptions
public Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> getDescriptions()
- Returns:
- the list of updated descriptions, overriding existing ones
-
getDescriptionsIfNew
public Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> getDescriptionsIfNew()
- Returns:
- the list of updated descriptions, only added if new
-
getAliases
public Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> getAliases()
- Returns:
- the list of updated aliases
-
constructTermListMap
protected Map<String,List<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>> constructTermListMap(Collection<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> mltvs)
-
-