Interface StatementDocument

All Superinterfaces:
EntityDocument
All Known Subinterfaces:
FormDocument, ItemDocument, LabeledStatementDocument, LexemeDocument, MediaInfoDocument, PropertyDocument, SenseDocument, TermedStatementDocument
All Known Implementing Classes:
FormDocumentImpl, ItemDocumentImpl, LexemeDocumentImpl, MediaInfoDocumentImpl, PropertyDocumentImpl, SenseDocumentImpl, TermedStatementDocumentImpl

public interface StatementDocument extends EntityDocument
Interface for EntityDocuments that can have statements.
Author:
Markus Kroetzsch
  • Method Details

    • getStatementGroups

      List<StatementGroup> getStatementGroups()
      Return the list of all StatementGroups stored for this item. The order of StatementGroups is significant.
      Returns:
      list of StatementGroups
    • getAllStatements

      default Iterator<Statement> getAllStatements()
      Returns an iterator that provides access to all statements, without considering the statement groups. The order of statements is preserved.
      Returns:
      iterator over all statements
    • findStatementGroup

      default StatementGroup findStatementGroup(PropertyIdValue propertyIdValue)
      Returns the StatementGroup for the given property, or null if there are no statements for this property. This is a convenience method for accessing the data that can be obtained via getStatementGroups().
      Parameters:
      propertyIdValue - the property to search for
      Returns:
      StatementGroup or null
    • findStatementGroup

      default StatementGroup findStatementGroup(String propertyId)
      Returns the StatementGroup for the given property, or null if there are no statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      StatementGroup or null
    • hasStatement

      default boolean hasStatement(PropertyIdValue propertyIdValue)
      Returns true if there is a statement for the given property. This is a convenience method for accessing the data that can be obtained via getStatementGroups().
      Parameters:
      propertyIdValue - the property to search for
      Returns:
      true if a statement for this property exists
    • hasStatement

      default boolean hasStatement(String propertyId)
      Returns true if there is a statement for the given property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      true if a statement for this property exists
    • hasStatementValue

      default boolean hasStatementValue(PropertyIdValue propertyIdValue, Value value)
      Returns true if there is a statement for the given property and value. This is a convenience method for accessing the data that can be obtained via getStatementGroups().
      Parameters:
      propertyIdValue - the property to search for
      value - the value to search
      Returns:
      true if a statement for this property and value exists
    • hasStatementValue

      default boolean hasStatementValue(String propertyId, Value value)
      Returns true if there is a statement for the given property and value. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      value - the value to search
      Returns:
      true if a statement for this property and value exists
    • hasStatementValue

      default boolean hasStatementValue(PropertyIdValue propertyIdValue, Set<? extends Value> values)
      Returns true if there is a statement for the given property and one of the given values. This is a convenience method for accessing the data that can be obtained via getStatementGroups().
      Parameters:
      propertyIdValue - the property to search for
      values - the set of values to search
      Returns:
      true if a statement for this property and value exists
    • hasStatementValue

      default boolean hasStatementValue(String propertyId, Set<? extends Value> values)
      Returns true if there is a statement for the given property and one of the given values. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      values - the set of values to search
      Returns:
      true if a statement for this property and value exists
    • findStatement

      default Statement findStatement(PropertyIdValue propertyIdValue)
      Returns the unique Statement for the given property, or null if there are zero or many statements for this property. This is a convenience method for accessing the data that can be obtained via getStatementGroups().
      Parameters:
      propertyIdValue - the property to search for
      Returns:
      Statement or null
    • findStatement

      default Statement findStatement(String propertyId)
      Returns the unique Statement for the given property, or null if there are zero or many statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      Statement or null
    • findStatementValue

      default Value findStatementValue(PropertyIdValue propertyIdValue)
      Returns the unique Value for the given property, or null if there are zero or many values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      Value or null
    • findStatementValue

      default Value findStatementValue(String propertyId)
      Returns the unique Value for the given property, or null if there are zero or many values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      Value or null
    • findStatementStringValue

      default StringValue findStatementStringValue(PropertyIdValue propertyIdValue)
      Returns the unique StringValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      StringValue or null
    • findStatementStringValue

      default StringValue findStatementStringValue(String propertyId)
      Returns the unique StringValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      StringValue or null
    • findStatementQuantityValue

      default QuantityValue findStatementQuantityValue(PropertyIdValue propertyIdValue)
      Returns the unique QuantityValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      QuantityValue or null
    • findStatementQuantityValue

      default QuantityValue findStatementQuantityValue(String propertyId)
      Returns the unique QuantityValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      QuantityValue or null
    • findStatementGlobeCoordinatesValue

      default GlobeCoordinatesValue findStatementGlobeCoordinatesValue(PropertyIdValue propertyIdValue)
      Returns the unique GlobeCoordinatesValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      GlobeCoordinatesValue or null
    • findStatementGlobeCoordinatesValue

      default GlobeCoordinatesValue findStatementGlobeCoordinatesValue(String propertyId)
      Returns the unique GlobeCoordinatesValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      GlobeCoordinatesValue or null
    • findStatementTimeValue

      default TimeValue findStatementTimeValue(PropertyIdValue propertyIdValue)
      Returns the unique TimeValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      TimeValue or null
    • findStatementTimeValue

      default TimeValue findStatementTimeValue(String propertyId)
      Returns the unique TimeValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      TimeValue or null
    • findStatementMonolingualTextValue

      default MonolingualTextValue findStatementMonolingualTextValue(PropertyIdValue propertyIdValue)
      Returns the unique MonolingualTextValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      MonolingualTextValue or null
    • findStatementMonolingualTextValue

      default MonolingualTextValue findStatementMonolingualTextValue(String propertyId)
      Returns the unique MonolingualTextValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      MonolingualTextValue or null
    • findStatementItemIdValue

      default ItemIdValue findStatementItemIdValue(PropertyIdValue propertyIdValue)
      Returns the unique ItemIdValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      ItemIdValue or null
    • findStatementItemIdValue

      default ItemIdValue findStatementItemIdValue(String propertyId)
      Returns the unique ItemIdValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      ItemIdValue or null
    • findStatementPropertyIdValue

      default PropertyIdValue findStatementPropertyIdValue(PropertyIdValue propertyIdValue)
      Returns the unique PropertyIdValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      PropertyIdValue or null
    • findStatementPropertyIdValue

      default PropertyIdValue findStatementPropertyIdValue(String propertyId)
      Returns the unique PropertyIdValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      PropertyIdValue or null
    • findStatementEntityIdValue

      default EntityIdValue findStatementEntityIdValue(PropertyIdValue propertyIdValue)
      Returns the unique EntityIdValue for the given property, or null if there are zero or many such values given in statements for this property.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyIdValue - the property to search for
      Returns:
      EntityIdValue or null
    • findStatementEntityIdValue

      default EntityIdValue findStatementEntityIdValue(String propertyId)
      Returns the unique EntityIdValue for the given property, or null if there are zero or many such values given in statements for this property. Only the string id of the property is compared, not the site id. This is useful in situations where all data is known to come from a single site.

      This is a convenience method for accessing the data that can be obtained via getStatementGroups().

      Parameters:
      propertyId - the property to search for
      Returns:
      EntityIdValue or null
    • withRevisionId

      StatementDocument withRevisionId(long newRevisionId)
      Returns a copy of this document with an updated revision id.
      Specified by:
      withRevisionId in interface EntityDocument
    • withStatement

      StatementDocument withStatement(Statement statement)
      Returns a new version of this document which includes the statement provided. If the identifier of this statement matches that of any other statement for the same property, then the existing statement will be replaced by the new one. Otherwise, the new statement will be added at the end of the list of statements in this group.
      Parameters:
      statement - the statement to add or update in the document
    • withoutStatementIds

      StatementDocument withoutStatementIds(Set<String> statementIds)
      Returns a new version of this document where all statements matching any of the statement ids provided have been removed. These statements can use different properties.
      Parameters:
      statementIds - the identifiers of the statements to remove