Package org.openrefine.wikidata.updates
Class LabeledStatementEntityEdit
java.lang.Object
org.openrefine.wikidata.updates.LabeledStatementEntityEdit
- All Implemented Interfaces:
EntityEdit,StatementEntityEdit
- Direct Known Subclasses:
MediaInfoEdit,TermedStatementEntityEdit
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.wikidata.wdtk.datamodel.interfaces.EntityIdValueprotected final List<StatementEdit> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLabeledStatementEntityEdit(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) Protected constructor to avoid re-constructing term maps when merging two entity updates.LabeledStatementEntityEdit(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) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.wikidata.wdtk.datamodel.interfaces.EntityIdValueThe id of the entity being editedSet<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>Edits made to statementsGroups added statements inStatementGroupsEditobjects.protected List<org.wikidata.wdtk.datamodel.interfaces.StatementGroup>Generates the statement groups which should appear on this entity if it is created as new.protected static voidmergeSingleTermMaps(Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> currentTerms, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> currentTermsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> newTerms, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> newTermsIfNew) Helper function to merge dictionaries of terms to override or provide.protected org.wikidata.wdtk.datamodel.interfaces.StatementUpdatetoStatementUpdate(org.wikidata.wdtk.datamodel.interfaces.StatementDocument currentDocument) Generates the statement update given the current statement groups on the entity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrefine.wikidata.updates.EntityEdit
isEmpty, isNew, isNull, merge, toEntityUpdate, toNewEntityMethods inherited from interface org.openrefine.wikidata.updates.StatementEntityEdit
getAddedStatements, getDeletedStatements
-
Field Details
-
id
protected final org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id -
statements
-
labels
-
labelsIfNew
-
-
Constructor Details
-
LabeledStatementEntityEdit
public LabeledStatementEntityEdit(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) 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 exists
-
LabeledStatementEntityEdit
protected LabeledStatementEntityEdit(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) 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 updateaddedStatements- the statements to adddeletedStatements- the statements to 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 exists
-
-
Method Details
-
getEntityId
public org.wikidata.wdtk.datamodel.interfaces.EntityIdValue getEntityId()Description copied from interface:EntityEditThe id of the entity being edited- Specified by:
getEntityIdin interfaceEntityEdit- Returns:
- the subject of the entity
-
getLabels
- Returns:
- the list of updated labels, overriding existing ones
-
getLabelsIfNew
- Returns:
- the list of updated labels, only added if new
-
getStatementEdits
Description copied from interface:StatementEntityEditEdits made to statements- Specified by:
getStatementEditsin interfaceStatementEntityEdit- Returns:
- the list of statement updates
-
getStatementGroupEdits
Description copied from interface:StatementEntityEditGroups added statements inStatementGroupsEditobjects.- Specified by:
getStatementGroupEditsin interfaceStatementEntityEdit
-
getStatementGroupsForNewEntity
protected List<org.wikidata.wdtk.datamodel.interfaces.StatementGroup> getStatementGroupsForNewEntity()Generates the statement groups which should appear on this entity if it is created as new. -
mergeSingleTermMaps
protected static void mergeSingleTermMaps(Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> currentTerms, Map<String, org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> currentTermsIfNew, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> newTerms, Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> newTermsIfNew) Helper function to merge dictionaries of terms to override or provide.- Parameters:
currentTerms- current map of terms to overridecurrentTermsIfNew- current map of terms to provide if not already therenewTerms- new terms to overridenewTermsIfNew- new terms to provide if not already there
-
toStatementUpdate
protected org.wikidata.wdtk.datamodel.interfaces.StatementUpdate toStatementUpdate(org.wikidata.wdtk.datamodel.interfaces.StatementDocument currentDocument) Generates the statement update given the current statement groups on the entity.- Parameters:
currentDocument-- Returns:
-