Class StatementBuilder


public class StatementBuilder extends AbstractDataObjectBuilder<StatementBuilder,Statement>
  • Constructor Details

    • StatementBuilder

      protected StatementBuilder(EntityIdValue subject, PropertyIdValue property)
      Constructor.
      Parameters:
      subject - id of the entity that the constructed statement refers to
      property - the id of the main property of the constructed statement
  • Method Details

    • forSubjectAndProperty

      public static StatementBuilder forSubjectAndProperty(EntityIdValue subject, PropertyIdValue property)
      Starts the construction of a Statement with the given subject.
      Parameters:
      subject - id of the entity that the constructed statement refers to
      property - the id of the main property of the constructed statement
      Returns:
      builder object to continue construction
    • build

      public Statement build()
      Description copied from class: AbstractDataObjectBuilder
      Returns the object that has been built.
      Specified by:
      build in class AbstractDataObjectBuilder<StatementBuilder,Statement>
      Returns:
      constructed object
    • withRank

      public StatementBuilder withRank(StatementRank rank)
      Sets the rank for the constructed statement.
      Parameters:
      rank - the rank of the statement
      Returns:
      builder object to continue construction
    • withId

      public StatementBuilder withId(String statementId)
      Sets the id for the constructed statement.
      Parameters:
      statementId - the id of the statement
      Returns:
      builder object to continue construction
    • withValue

      public StatementBuilder withValue(Value value)
      Sets the main value for the constructed statement.
      Parameters:
      value - the main value of the statement
      Returns:
      builder object to continue construction
    • withSomeValue

      public StatementBuilder withSomeValue()
      Sets the main snak of the statement to be a {SomeValueSnak.
      Returns:
      builder object to continue construction
    • withNoValue

      public StatementBuilder withNoValue()
      Sets the main snak of the statement to be a {NoValueSnak.
      Returns:
      builder object to continue construction
    • withQualifierValue

      public StatementBuilder withQualifierValue(PropertyIdValue propertyIdValue, Value value)
      Adds a qualifier with the given property and value to the constructed statement.
      Parameters:
      propertyIdValue - the property of the qualifier
      value - the value of the qualifier
      Returns:
      builder object to continue construction
    • withQualifierSomeValue

      public StatementBuilder withQualifierSomeValue(PropertyIdValue propertyIdValue)
      Adds a SomeValueSnak qualifier with the given property to the constructed statement.
      Parameters:
      propertyIdValue - the property of the qualifier
      Returns:
      builder object to continue construction
    • withQualifierNoValue

      public StatementBuilder withQualifierNoValue(PropertyIdValue propertyIdValue)
      Adds a NoValueSnak qualifier with the given property to the constructed statement.

      Note that it might not be meaningful to use NoValueSnak in a qualifier. It is usually implicitly assumed that all qualifiers that are not given have no value for a particular statement. Otherwise one would need large numbers of NoValueSnak qualifiers for every statement!

      Parameters:
      propertyIdValue - the property of the qualifier
      Returns:
      builder object to continue construction
    • withQualifier

      public StatementBuilder withQualifier(Snak qualifier)
      Adds a qualifier Snak to the constructed statement.
      Parameters:
      qualifier - the qualifier to add
      Returns:
      builder object to continue construction
    • withQualifiers

      public StatementBuilder withQualifiers(SnakGroup qualifiers)
      Adds all qualifiers from the given SnakGroup to the constructed statement.
      Parameters:
      qualifiers - the group of qualifiers to add
      Returns:
      builder object to continue construction
    • withQualifiers

      public StatementBuilder withQualifiers(List<SnakGroup> qualifiers)
      Adds all qualifiers from the given list of SnakGroup to the constructed statement. This is handy to copy all qualifiers from a given statement.
      Parameters:
      qualifiers - the list of groups of qualifiers to add
      Returns:
      builder object to continue construction
    • withReference

      public StatementBuilder withReference(Reference reference)
      Adds a reference to the constructed statement.
      Parameters:
      reference - the reference to be added
      Returns:
      builder object to continue construction
    • withReferences

      public StatementBuilder withReferences(List<? extends Reference> references)
      Adds a list of references to the constructed statement.
      Parameters:
      references - the references to be added
      Returns:
      builder object to continue construction
    • getThis

      protected StatementBuilder getThis()
      Description copied from class: AbstractDataObjectBuilder
      Returns the current object with the correct builder type.
      Specified by:
      getThis in class AbstractDataObjectBuilder<StatementBuilder,Statement>
      Returns:
      this
    • getQualifierGroups

      protected List<SnakGroup> getQualifierGroups()
      Returns a list of SnakGroup objects for the currently stored qualifiers.
      Returns:
    • getQualifierList

      protected ArrayList<Snak> getQualifierList(PropertyIdValue propertyIdValue)
      Returns the list of Snak objects for a given qualifier property.
      Parameters:
      propertyIdValue -
      Returns:
    • getMainSnak

      protected Snak getMainSnak()
      Returns the main Snak object for the constructed statement.
      Returns: