Class LabeledStatementEntityEdit

java.lang.Object
org.openrefine.wikidata.updates.LabeledStatementEntityEdit
All Implemented Interfaces:
EntityEdit, StatementEntityEdit
Direct Known Subclasses:
MediaInfoEdit, TermedStatementEntityEdit

public abstract class LabeledStatementEntityEdit extends Object implements StatementEntityEdit
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.wikidata.wdtk.datamodel.interfaces.EntityIdValue
     
    protected final Map<String,org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
     
    protected final Map<String,org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
     
    protected final List<StatementEdit>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    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.
     
    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 Type
    Method
    Description
    org.wikidata.wdtk.datamodel.interfaces.EntityIdValue
    The id of the entity being edited
    Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
     
    Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue>
     
    Edits made to statements
    Groups added statements in StatementGroupsEdit objects.
    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 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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.openrefine.wikidata.updates.EntityEdit

    isEmpty, isNew, isNull, merge, toEntityUpdate, toNewEntity

    Methods inherited from interface org.openrefine.wikidata.updates.StatementEntityEdit

    getAddedStatements, getDeletedStatements
  • Field Details

    • id

      protected final org.wikidata.wdtk.datamodel.interfaces.EntityIdValue id
    • statements

      protected final List<StatementEdit> statements
    • labels

      protected final Map<String,org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> labels
    • labelsIfNew

      protected final Map<String,org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> 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 language
      labelsIfNew - 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 update
      addedStatements - the statements to add
      deletedStatements - the statements to delete
      labels - the labels to add on the entity, overriding any existing one in that language
      labelsIfNew - 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: EntityEdit
      The id of the entity being edited
      Specified by:
      getEntityId in interface EntityEdit
      Returns:
      the subject of the entity
    • getLabels

      public Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> getLabels()
      Returns:
      the list of updated labels, overriding existing ones
    • getLabelsIfNew

      public Set<org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue> getLabelsIfNew()
      Returns:
      the list of updated labels, only added if new
    • getStatementEdits

      public List<StatementEdit> getStatementEdits()
      Description copied from interface: StatementEntityEdit
      Edits made to statements
      Specified by:
      getStatementEdits in interface StatementEntityEdit
      Returns:
      the list of statement updates
    • getStatementGroupEdits

      public List<StatementGroupEdit> getStatementGroupEdits()
      Description copied from interface: StatementEntityEdit
      Groups added statements in StatementGroupsEdit objects.
      Specified by:
      getStatementGroupEdits in interface StatementEntityEdit
    • 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 override
      currentTermsIfNew - current map of terms to provide if not already there
      newTerms - new terms to override
      newTermsIfNew - 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: