Class StatementBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder<StatementBuilder,Statement>
org.wikidata.wdtk.datamodel.helpers.StatementBuilder
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStatementBuilder(EntityIdValue subject, PropertyIdValue property) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the object that has been built.static StatementBuilderforSubjectAndProperty(EntityIdValue subject, PropertyIdValue property) Starts the construction of aStatementwith the given subject.protected SnakReturns the mainSnakobject for the constructed statement.Returns a list ofSnakGroupobjects for the currently stored qualifiers.getQualifierList(PropertyIdValue propertyIdValue) Returns the list ofSnakobjects for a given qualifier property.protected StatementBuildergetThis()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 qualifierSnakto the constructed statement.withQualifierNoValue(PropertyIdValue propertyIdValue) Adds aNoValueSnakqualifier with the given property to the constructed statement.withQualifiers(List<SnakGroup> qualifiers) Adds all qualifiers from the given list ofSnakGroupto the constructed statement.withQualifiers(SnakGroup qualifiers) Adds all qualifiers from the givenSnakGroupto the constructed statement.withQualifierSomeValue(PropertyIdValue propertyIdValue) Adds aSomeValueSnakqualifier 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 aStatementwith 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:AbstractDataObjectBuilderReturns the object that has been built.- Specified by:
buildin 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 aSomeValueSnakqualifier with the given property to the constructed statement.- Parameters:
propertyIdValue- the property of the qualifier- Returns:
- builder object to continue construction
-
withQualifierNoValue
Adds aNoValueSnakqualifier with the given property to the constructed statement.Note that it might not be meaningful to use
NoValueSnakin 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 ofNoValueSnakqualifiers for every statement!- Parameters:
propertyIdValue- the property of the qualifier- Returns:
- builder object to continue construction
-
withQualifier
Adds a qualifierSnakto the constructed statement.- Parameters:
qualifier- the qualifier to add- Returns:
- builder object to continue construction
-
withQualifiers
Adds all qualifiers from the givenSnakGroupto 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 ofSnakGroupto 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:AbstractDataObjectBuilderReturns the current object with the correct builder type.- Specified by:
getThisin classAbstractDataObjectBuilder<StatementBuilder,Statement> - Returns:
- this
-
getQualifierGroups
Returns a list ofSnakGroupobjects for the currently stored qualifiers.- Returns:
-
getQualifierList
Returns the list ofSnakobjects for a given qualifier property.- Parameters:
propertyIdValue-- Returns:
-
getMainSnak
Returns the mainSnakobject for the constructed statement.- Returns:
-