Class ReferenceImpl

java.lang.Object
org.wikidata.wdtk.datamodel.implementation.ReferenceImpl
All Implemented Interfaces:
Reference

public class ReferenceImpl extends Object implements Reference
Jackson implementation of Reference.
Author:
Fredo Erxleben, Markus Kroetzsch, Antonin Delpeuch
  • Constructor Details

    • ReferenceImpl

      public ReferenceImpl(List<SnakGroup> groups)
      Constructor.

      The order of the snaks groups provided will be respected. the properties used by the snak groups should be distinct.

      Parameters:
      groups - the snaks group which form the reference
    • ReferenceImpl

      protected ReferenceImpl(Map<String,List<SnakImpl>> snaks, List<String> propertyOrder, String hash)
      Constructor for deserialization from JSON.
  • Method Details

    • getSnakGroups

      public List<SnakGroup> getSnakGroups()
      Description copied from interface: Reference
      Get the list of snak groups associated with this reference. Objects of this class are immutable, and the list should therefore not be modifiable.
      Specified by:
      getSnakGroups in interface Reference
      Returns:
      list of SnakGroups
    • getSnaks

      public Map<String,List<Snak>> getSnaks()
      Returns the map of snaks as found in JSON. Only for use by Jackson during serialization.
      Returns:
      the map of snaks
    • getHash

      public String getHash()
      Description copied from interface: Reference
      Wikibase calculates a hash for each reference based on the content of the reference. This hash appears in the RDF serialization of the reference. Since the calculation is hard to reproduce, this is only available if the reference was read from a dump that contains the hash.
      Specified by:
      getHash in interface Reference
      Returns:
      the hash of the reference, if available, otherwise null.
    • getPropertyOrder

      public List<String> getPropertyOrder()
      Returns the list of property ids used to order snaks as found in JSON. Only for use by Jackson during serialization.
      Returns:
      the list of property ids
    • getAllSnaks

      public Iterator<Snak> getAllSnaks()
      Description copied from interface: Reference
      Returns an interator over all snaks, without considering snak groups. The relative order of snaks is preserved.
      Specified by:
      getAllSnaks in interface Reference
      Returns:
      iterator of snaks
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object