Class EntityIdValueImpl

java.lang.Object
org.wikidata.wdtk.datamodel.implementation.ValueImpl
org.wikidata.wdtk.datamodel.implementation.EntityIdValueImpl
All Implemented Interfaces:
EntityIdValue, IriIdentifiedValue, Value
Direct Known Subclasses:
ItemIdValueImpl, LexemeIdValueImpl, MediaInfoIdValueImpl, PropertyIdValueImpl

public abstract class EntityIdValueImpl extends ValueImpl implements EntityIdValue
Abstract base implementation of EntityIdValue for Jackson.
Author:
Markus Kroetzsch, Fredo Erxleben, Thomas Pellissier Tanon, Antonin Delpeuch
  • Field Details

    • JSON_ENTITY_TYPE_ITEM

      public static final String JSON_ENTITY_TYPE_ITEM
      The string used in JSON to denote the type of entity id values that are items.
      See Also:
    • JSON_ENTITY_TYPE_PROPERTY

      public static final String JSON_ENTITY_TYPE_PROPERTY
      The string used in JSON to denote the type of entity id values that are properties.
      See Also:
    • JSON_ENTITY_TYPE_LEXEME

      public static final String JSON_ENTITY_TYPE_LEXEME
      The string used in JSON to denote the type of entity id values that are lexemes.
      See Also:
    • JSON_ENTITY_TYPE_FORM

      public static final String JSON_ENTITY_TYPE_FORM
      The string used in JSON to denote the type of entity id values that are lexemes forms.
      See Also:
    • JSON_ENTITY_TYPE_SENSE

      public static final String JSON_ENTITY_TYPE_SENSE
      The string used in JSON to denote the type of entity id values that are lexemes senses.
      See Also:
    • JSON_ENTITY_TYPE_MEDIA_INFO

      public static final String JSON_ENTITY_TYPE_MEDIA_INFO
      The string used in JSON to denote the type of entity id values that are media info.
      See Also:
  • Constructor Details

    • EntityIdValueImpl

      protected EntityIdValueImpl(String id, String siteIri)
      Constructor.
      Parameters:
      id - the identifier of the entity, such as "Q42"
      siteIri - the siteIRI that this value refers to
    • EntityIdValueImpl

      protected EntityIdValueImpl(org.wikidata.wdtk.datamodel.implementation.EntityIdValueImpl.JacksonInnerEntityId value, String siteIri)
      Constructor used for deserialization with Jackson.
  • Method Details

    • fromId

      public static EntityIdValue fromId(String id, String siteIri)
      Parses an item id
      Parameters:
      id - the identifier of the entity, such as "Q42"
      siteIri - the siteIRI that this value refers to
      Throws:
      IllegalArgumentException - if the id is invalid
    • guessEntityTypeFromId

      public static String guessEntityTypeFromId(String id)
      Returns the entity type of the id like "item" or "property"
      Parameters:
      id - the identifier of the entity, such as "Q42"
      Throws:
      IllegalArgumentException - if the id is invalid
    • getValue

      public org.wikidata.wdtk.datamodel.implementation.EntityIdValueImpl.JacksonInnerEntityId getValue()
      Returns the inner value helper object. Only for use by Jackson during serialization.
      Returns:
      the inner entity id value
    • getIri

      public String getIri()
      Description copied from interface: IriIdentifiedValue
      Get the IRI of this entity.
      Specified by:
      getIri in interface IriIdentifiedValue
      Returns:
      String with the IRI
    • getId

      public String getId()
      Description copied from interface: EntityIdValue
      Returns the id of this entity.
      Specified by:
      getId in interface EntityIdValue
      Returns:
      String id of this entity
    • getSiteIri

      public String getSiteIri()
      Description copied from interface: EntityIdValue
      Returns an IRI that identifies the site that this entity comes from,, e.g., "http://www.wikidata.org/entity/" for Wikidata.
      Specified by:
      getSiteIri in interface EntityIdValue
      Returns:
      the site IRI string
    • assertHasJsonEntityType

      protected void assertHasJsonEntityType(String expectedType)