Class LabeledStatementEntityEdit

    • Field Detail

      • id

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

        protected final Set<Long> contributingRowIds
      • 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 Detail

      • 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,
                                          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 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,
                                             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 update
        statements - the statements to edit
        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 Detail

      • 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
      • getContributingRowIds

        public Set<Long> getContributingRowIds()
        Description copied from interface: EntityEdit
        The set of row ids which contributed to generate this entity edit.
        Specified by:
        getContributingRowIds in interface EntityEdit
      • 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
      • 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. TODO those statements are not currently deduplicated among themselves
      • 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: