Class SnakOnlyStatementMerger

  • All Implemented Interfaces:
    StatementMerger

    public class SnakOnlyStatementMerger
    extends Object
    implements StatementMerger
    Merging strategy which only looks at the main value of statements (in addition to their property, but that is expected). This is what QuickStatements does.
    Author:
    Antonin Delpeuch
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object obj)  
      static List<org.wikidata.wdtk.datamodel.interfaces.Snak> flatten​(List<org.wikidata.wdtk.datamodel.interfaces.SnakGroup> snakGroups)  
      ValueMatcher getValueMatcher()  
      int hashCode()  
      boolean match​(org.wikidata.wdtk.datamodel.interfaces.Snak existingSnak, org.wikidata.wdtk.datamodel.interfaces.Snak addedSnak)
      Matches two snaks using the underlying value matcher.
      boolean match​(org.wikidata.wdtk.datamodel.interfaces.Statement existing, org.wikidata.wdtk.datamodel.interfaces.Statement added)
      Determines if the existing statement matches the statement to add (or remove)
      org.wikidata.wdtk.datamodel.interfaces.Statement merge​(org.wikidata.wdtk.datamodel.interfaces.Statement existing, org.wikidata.wdtk.datamodel.interfaces.Statement added)
      Return the result of merging the statement to add with the existing statement.
      List<org.wikidata.wdtk.datamodel.interfaces.Reference> mergeReferences​(List<org.wikidata.wdtk.datamodel.interfaces.Reference> existing, List<org.wikidata.wdtk.datamodel.interfaces.Reference> added)  
      String toString()  
    • Constructor Detail

      • SnakOnlyStatementMerger

        public SnakOnlyStatementMerger​(ValueMatcher valueMatcher)
    • Method Detail

      • match

        public boolean match​(org.wikidata.wdtk.datamodel.interfaces.Statement existing,
                             org.wikidata.wdtk.datamodel.interfaces.Statement added)
        Description copied from interface: StatementMerger
        Determines if the existing statement matches the statement to add (or remove)
        Specified by:
        match in interface StatementMerger
        Parameters:
        existing - the statement currently on the entity
        added - the statement to add or remove
        Returns:
      • merge

        public org.wikidata.wdtk.datamodel.interfaces.Statement merge​(org.wikidata.wdtk.datamodel.interfaces.Statement existing,
                                                                      org.wikidata.wdtk.datamodel.interfaces.Statement added)
        Description copied from interface: StatementMerger
        Return the result of merging the statement to add with the existing statement. This method can assume that the two statements are matching (i.e. the method above has returned true on them).
        Specified by:
        merge in interface StatementMerger
        Parameters:
        existing - the statement currently on the entity
        added - the statement to add or remove
        Returns:
        the merged statement obtained out of the two
      • match

        public boolean match​(org.wikidata.wdtk.datamodel.interfaces.Snak existingSnak,
                             org.wikidata.wdtk.datamodel.interfaces.Snak addedSnak)
        Matches two snaks using the underlying value matcher. The snaks must have the same property id to match.
        Parameters:
        existingSnak -
        addedSnak -
        Returns:
      • mergeReferences

        public List<org.wikidata.wdtk.datamodel.interfaces.Reference> mergeReferences​(List<org.wikidata.wdtk.datamodel.interfaces.Reference> existing,
                                                                                      List<org.wikidata.wdtk.datamodel.interfaces.Reference> added)
      • flatten

        public static List<org.wikidata.wdtk.datamodel.interfaces.Snak> flatten​(List<org.wikidata.wdtk.datamodel.interfaces.SnakGroup> snakGroups)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object