public class StatementBuilder extends AbstractDataObjectBuilder<StatementBuilder,Statement>
Modifier | Constructor and Description |
---|---|
protected |
StatementBuilder(EntityIdValue subject,
PropertyIdValue property)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Statement |
build()
Returns the object that has been built.
|
static StatementBuilder |
forSubjectAndProperty(EntityIdValue subject,
PropertyIdValue property)
Starts the construction of a
Statement with the given subject. |
protected Snak |
getMainSnak()
Returns the main
Snak object for the constructed statement. |
protected List<SnakGroup> |
getQualifierGroups()
Returns a list of
SnakGroup objects for the currently stored
qualifiers. |
protected ArrayList<Snak> |
getQualifierList(PropertyIdValue propertyIdValue)
Returns the list of
Snak objects for a given qualifier property. |
protected StatementBuilder |
getThis()
Returns the current object with the correct builder type.
|
StatementBuilder |
withId(String statementId)
Sets the id for the constructed statement.
|
StatementBuilder |
withNoValue()
Sets the main snak of the statement to be a {
NoValueSnak . |
StatementBuilder |
withQualifier(Snak qualifier)
Adds a qualifier
Snak to the constructed statement. |
StatementBuilder |
withQualifierNoValue(PropertyIdValue propertyIdValue)
Adds a
NoValueSnak qualifier with the given property to the
constructed statement. |
StatementBuilder |
withQualifiers(List<SnakGroup> qualifiers)
Adds all qualifiers from the given list of
SnakGroup to the
constructed statement. |
StatementBuilder |
withQualifiers(SnakGroup qualifiers)
Adds all qualifiers from the given
SnakGroup to the constructed
statement. |
StatementBuilder |
withQualifierSomeValue(PropertyIdValue propertyIdValue)
Adds a
SomeValueSnak qualifier with the given property to the
constructed statement. |
StatementBuilder |
withQualifierValue(PropertyIdValue propertyIdValue,
Value value)
Adds a qualifier with the given property and value to the constructed
statement.
|
StatementBuilder |
withRank(StatementRank rank)
Sets the rank for the constructed statement.
|
StatementBuilder |
withReference(Reference reference)
Adds a reference to the constructed statement.
|
StatementBuilder |
withReferences(List<? extends Reference> references)
Adds a list of references to the constructed statement.
|
StatementBuilder |
withSomeValue()
Sets the main snak of the statement to be a {
SomeValueSnak . |
StatementBuilder |
withValue(Value value)
Sets the main value for the constructed statement.
|
prepareBuild
protected StatementBuilder(EntityIdValue subject, PropertyIdValue property)
subject
- id of the entity that the constructed statement refers toproperty
- the id of the main property of the constructed statementpublic static StatementBuilder forSubjectAndProperty(EntityIdValue subject, PropertyIdValue property)
Statement
with the given subject.subject
- id of the entity that the constructed statement refers toproperty
- the id of the main property of the constructed statementpublic Statement build()
AbstractDataObjectBuilder
build
in class AbstractDataObjectBuilder<StatementBuilder,Statement>
public StatementBuilder withRank(StatementRank rank)
rank
- the rank of the statementpublic StatementBuilder withId(String statementId)
statementId
- the id of the statementpublic StatementBuilder withValue(Value value)
value
- the main value of the statementpublic StatementBuilder withSomeValue()
SomeValueSnak
.public StatementBuilder withNoValue()
NoValueSnak
.public StatementBuilder withQualifierValue(PropertyIdValue propertyIdValue, Value value)
propertyIdValue
- the property of the qualifiervalue
- the value of the qualifierpublic StatementBuilder withQualifierSomeValue(PropertyIdValue propertyIdValue)
SomeValueSnak
qualifier with the given property to the
constructed statement.propertyIdValue
- the property of the qualifierpublic StatementBuilder withQualifierNoValue(PropertyIdValue propertyIdValue)
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!
propertyIdValue
- the property of the qualifierpublic StatementBuilder withQualifier(Snak qualifier)
Snak
to the constructed statement.qualifier
- the qualifier to addpublic StatementBuilder withQualifiers(SnakGroup qualifiers)
SnakGroup
to the constructed
statement.qualifiers
- the group of qualifiers to addpublic StatementBuilder withQualifiers(List<SnakGroup> qualifiers)
SnakGroup
to the
constructed statement. This is handy to copy all qualifiers from a given
statement.qualifiers
- the list of groups of qualifiers to addpublic StatementBuilder withReference(Reference reference)
reference
- the reference to be addedpublic StatementBuilder withReferences(List<? extends Reference> references)
references
- the references to be addedprotected StatementBuilder getThis()
AbstractDataObjectBuilder
getThis
in class AbstractDataObjectBuilder<StatementBuilder,Statement>
protected List<SnakGroup> getQualifierGroups()
SnakGroup
objects for the currently stored
qualifiers.protected ArrayList<Snak> getQualifierList(PropertyIdValue propertyIdValue)
Snak
objects for a given qualifier property.propertyIdValue
- Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage