Class EntityDocumentImpl

java.lang.Object
org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
All Implemented Interfaces:
EntityDocument
Direct Known Subclasses:
FormDocumentImpl, LexemeDocumentImpl, MediaInfoDocumentImpl, SenseDocumentImpl, TermedStatementDocumentImpl

public abstract class EntityDocumentImpl extends Object implements EntityDocument
Abstract Jackson implementation of EntityDocument. Like all Jackson objects, it is not technically immutable, but it is strongly recommended to treat it as such in all contexts: the setters are for Jackson; never call them in your code.
Author:
Thomas Pellissier Tanon
  • Field Details

    • entityId

      protected final String entityId
      The id of the entity that the document refers to. This is not mapped to JSON directly by Jackson but split into two fields, "type" and "id". The type field is ignored during deserialization since the type is clear for a concrete document. For serialization, the type is hard-coded.

      The site IRI, which would also be required to create a complete EntityIdValue, is not encoded in JSON. It needs to be injected from the outside (if not, we default to Wikidata).

    • siteIri

      protected final String siteIri
      The site IRI that this document refers to, or null if not specified. In the latter case, we assume Wikidata as the default.
      See Also:
    • revisionId

      protected final long revisionId
      The revision id of this document.
      See Also:
  • Method Details

    • getJsonId

      public String getJsonId()
      Returns the string id of the entity that this document refers to. Only for use by Jackson during serialization.
      Returns:
      string id
    • getSiteIri

      public String getSiteIri()
    • getRevisionId

      public long getRevisionId()
      Description copied from interface: EntityDocument
      Returns the revision ID of this document, or 0 if no id is known. The revision ID is a number stored by MediaWiki to indicate the version of a document. It is based on a global counter that is incremented on each edit. Not all sources of entity document data may provide the revision ID, as it is not strictly part of the data, but part of the document metadata.
      Specified by:
      getRevisionId in interface EntityDocument
      Returns:
      revision id