Class StatementBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder<StatementBuilder,Statement>
org.wikidata.wdtk.datamodel.helpers.StatementBuilder
-
Constructor Summary
ModifierConstructorDescriptionprotected
StatementBuilder
(EntityIdValue subject, PropertyIdValue property) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns the object that has been built.static StatementBuilder
forSubjectAndProperty
(EntityIdValue subject, PropertyIdValue property) Starts the construction of aStatement
with the given subject.protected Snak
Returns the mainSnak
object for the constructed statement.Returns a list ofSnakGroup
objects for the currently stored qualifiers.getQualifierList
(PropertyIdValue propertyIdValue) Returns the list ofSnak
objects for a given qualifier property.protected StatementBuilder
getThis()
Returns the current object with the correct builder type.Sets the id for the constructed statement.Sets the main snak of the statement to be a {NoValueSnak
.withQualifier
(Snak qualifier) Adds a qualifierSnak
to the constructed statement.withQualifierNoValue
(PropertyIdValue propertyIdValue) Adds aNoValueSnak
qualifier with the given property to the constructed statement.withQualifiers
(List<SnakGroup> qualifiers) Adds all qualifiers from the given list ofSnakGroup
to the constructed statement.withQualifiers
(SnakGroup qualifiers) Adds all qualifiers from the givenSnakGroup
to the constructed statement.withQualifierSomeValue
(PropertyIdValue propertyIdValue) Adds aSomeValueSnak
qualifier with the given property to the constructed statement.withQualifierValue
(PropertyIdValue propertyIdValue, Value value) Adds a qualifier with the given property and value to the constructed statement.withRank
(StatementRank rank) Sets the rank for the constructed statement.withReference
(Reference reference) Adds a reference to the constructed statement.withReferences
(List<? extends Reference> references) Adds a list of references to the constructed statement.Sets the main snak of the statement to be a {SomeValueSnak
.Sets the main value for the constructed statement.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder
prepareBuild
-
Constructor Details
-
StatementBuilder
Constructor.- Parameters:
subject
- id of the entity that the constructed statement refers toproperty
- 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 aStatement
with the given subject.- Parameters:
subject
- id of the entity that the constructed statement refers toproperty
- the id of the main property of the constructed statement- Returns:
- builder object to continue construction
-
build
Description copied from class:AbstractDataObjectBuilder
Returns the object that has been built.- Specified by:
build
in classAbstractDataObjectBuilder<StatementBuilder,
Statement> - Returns:
- constructed object
-
withRank
Sets the rank for the constructed statement.- Parameters:
rank
- the rank of the statement- Returns:
- builder object to continue construction
-
withId
Sets the id for the constructed statement.- Parameters:
statementId
- the id of the statement- Returns:
- builder object to continue construction
-
withValue
Sets the main value for the constructed statement.- Parameters:
value
- the main value of the statement- Returns:
- builder object to continue construction
-
withSomeValue
Sets the main snak of the statement to be a {SomeValueSnak
.- Returns:
- builder object to continue construction
-
withNoValue
Sets the main snak of the statement to be a {NoValueSnak
.- Returns:
- builder object to continue construction
-
withQualifierValue
Adds a qualifier with the given property and value to the constructed statement.- Parameters:
propertyIdValue
- the property of the qualifiervalue
- the value of the qualifier- Returns:
- builder object to continue construction
-
withQualifierSomeValue
Adds aSomeValueSnak
qualifier with the given property to the constructed statement.- Parameters:
propertyIdValue
- the property of the qualifier- Returns:
- builder object to continue construction
-
withQualifierNoValue
Adds aNoValueSnak
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 ofNoValueSnak
qualifiers for every statement!- Parameters:
propertyIdValue
- the property of the qualifier- Returns:
- builder object to continue construction
-
withQualifier
Adds a qualifierSnak
to the constructed statement.- Parameters:
qualifier
- the qualifier to add- Returns:
- builder object to continue construction
-
withQualifiers
Adds all qualifiers from the givenSnakGroup
to the constructed statement.- Parameters:
qualifiers
- the group of qualifiers to add- Returns:
- builder object to continue construction
-
withQualifiers
Adds all qualifiers from the given list ofSnakGroup
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
Adds a reference to the constructed statement.- Parameters:
reference
- the reference to be added- Returns:
- builder object to continue construction
-
withReferences
Adds a list of references to the constructed statement.- Parameters:
references
- the references to be added- Returns:
- builder object to continue construction
-
getThis
Description copied from class:AbstractDataObjectBuilder
Returns the current object with the correct builder type.- Specified by:
getThis
in classAbstractDataObjectBuilder<StatementBuilder,
Statement> - Returns:
- this
-
getQualifierGroups
Returns a list ofSnakGroup
objects for the currently stored qualifiers.- Returns:
-
getQualifierList
Returns the list ofSnak
objects for a given qualifier property.- Parameters:
propertyIdValue
-- Returns:
-
getMainSnak
Returns the mainSnak
object for the constructed statement.- Returns:
-