Class TermedStatementDocumentImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
org.wikidata.wdtk.datamodel.implementation.TermedStatementDocumentImpl
- All Implemented Interfaces:
EntityDocument,LabeledDocument,LabeledStatementDocument,StatementDocument,TermedDocument,TermedStatementDocument
- Direct Known Subclasses:
ItemDocumentImpl,PropertyDocumentImpl
public abstract class TermedStatementDocumentImpl
extends EntityDocumentImpl
implements TermedStatementDocument
Abstract Jackson implementation of
TermedDocument and StatementDocument.
You should not rely on it directly but build instances with the Datamodel helper and
use EntityDocumentImpl for deserialization.- Author:
- Fredo Erxleben, Antonin Delpeuch, Thomas Pellissier Tanon
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String,List<MonolingualTextValue>> This is what is called claim in the JSON model.protected final Map<String,MonolingualTextValue> protected final Map<String,MonolingualTextValue> Fields inherited from class org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
entityId, revisionId, siteIri -
Constructor Summary
ConstructorsModifierConstructorDescriptionTermedStatementDocumentImpl(EntityIdValue id, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> claims, long revisionId) Constructor.protectedTermedStatementDocumentImpl(EntityIdValue subject, Map<String, MonolingualTextValue> labels, Map<String, MonolingualTextValue> descriptions, Map<String, List<MonolingualTextValue>> aliases, Map<String, List<Statement>> claims, long revisionId) Protected constructor provided to ease the creation of copies. -
Method Summary
Modifier and TypeMethodDescriptionAdds a Statement to a given collection of statement groups.protected static Map<String,MonolingualTextValue> constructTermMap(List<MonolingualTextValue> terms) findStatementGroup(String propertyIdValue) Find a statement group by its property id, without checking for equality with the site IRI.Return a Map from Wikibase language codes to lists of alias labels for a given language.Returns an iterator that provides access to all statements, without considering the statement groups.Return a Map from Wikibase language codes to descriptions.Returns the "claims".Return a Map from Wikibase language codes to labels.Return the list of all StatementGroups stored for this item.Removes statement ids from a collection of statement groups.protected static Map<String,List<MonolingualTextValue>> withAliases(Map<String, List<MonolingualTextValue>> values, String language, List<MonolingualTextValue> aliases) protected static Map<String,MonolingualTextValue> withTerm(Map<String, MonolingualTextValue> values, MonolingualTextValue value) Methods inherited from class org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
getJsonId, getRevisionIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.EntityDocument
getEntityId, getRevisionIdMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.LabeledDocument
findLabel, getLabelsMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.LabeledStatementDocument
withLabel, withRevisionIdMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.StatementDocument
findStatement, findStatement, findStatementEntityIdValue, findStatementEntityIdValue, findStatementGlobeCoordinatesValue, findStatementGlobeCoordinatesValue, findStatementGroup, findStatementGroup, findStatementItemIdValue, findStatementItemIdValue, findStatementMonolingualTextValue, findStatementMonolingualTextValue, findStatementPropertyIdValue, findStatementPropertyIdValue, findStatementQuantityValue, findStatementQuantityValue, findStatementStringValue, findStatementStringValue, findStatementTimeValue, findStatementTimeValue, findStatementValue, findStatementValue, getAllStatements, getStatementGroups, hasStatement, hasStatement, hasStatementValue, hasStatementValue, hasStatementValue, hasStatementValue, withRevisionIdMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.TermedDocument
findDescriptionMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.TermedStatementDocument
withAliases, withDescription, withLabel, withoutStatementIds, withRevisionId, withStatement
-
Field Details
-
descriptions
-
aliases
-
labels
-
claims
This is what is called claim in the JSON model. It corresponds to the statement group in the WDTK model.
-
-
Constructor Details
-
TermedStatementDocumentImpl
public TermedStatementDocumentImpl(EntityIdValue id, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> claims, long revisionId) Constructor.- Parameters:
id- the identifier of the subject of this documentlabels- the labels for this entity, at most one per languagedescriptions- the descriptions for this entity, at most one per languagealiases- the aliases for this language. Their relative order in a given language will be preserved.claims- the statement groups contained in this documentrevisionId- the id of the last revision of this document
-
TermedStatementDocumentImpl
protected TermedStatementDocumentImpl(EntityIdValue subject, Map<String, MonolingualTextValue> labels, Map<String, MonolingualTextValue> descriptions, Map<String, List<MonolingualTextValue>> aliases, Map<String, List<Statement>> claims, long revisionId) Protected constructor provided to ease the creation of copies. No check is made and each field is reused without copying.- Parameters:
labels- a map from language codes to monolingual values with the same language codesdescriptions- a map from language codes to monolingual values with the same language codesaliases- a map from language codes to lists of monolingual values with the same language codesclaims-revisionId-
-
-
Method Details
-
getAliases
Description copied from interface:TermedDocumentReturn a Map from Wikibase language codes to lists of alias labels for a given language.- Specified by:
getAliasesin interfaceTermedDocument- Returns:
- the aliases for this language
-
getDescriptions
Description copied from interface:TermedDocumentReturn a Map from Wikibase language codes to descriptions.- Specified by:
getDescriptionsin interfaceTermedDocument- Returns:
- the map of descriptions
-
getSiteIri
- Overrides:
getSiteIriin classEntityDocumentImpl
-
withAliases
protected static Map<String,List<MonolingualTextValue>> withAliases(Map<String, List<MonolingualTextValue>> values, String language, List<MonolingualTextValue> aliases) -
getLabels
Description copied from interface:LabeledDocumentReturn a Map from Wikibase language codes to labels.- Specified by:
getLabelsin interfaceLabeledDocument- Returns:
- the map of labels
-
constructTermMap
protected static Map<String,MonolingualTextValue> constructTermMap(List<MonolingualTextValue> terms) -
withTerm
protected static Map<String,MonolingualTextValue> withTerm(Map<String, MonolingualTextValue> values, MonolingualTextValue value) -
getStatementGroups
Description copied from interface:StatementDocumentReturn the list of all StatementGroups stored for this item. The order of StatementGroups is significant.- Specified by:
getStatementGroupsin interfaceStatementDocument- Returns:
- list of StatementGroups
-
findStatementGroup
Find a statement group by its property id, without checking for equality with the site IRI. More efficient implementation than the default one.- Specified by:
findStatementGroupin interfaceStatementDocument- Parameters:
propertyIdValue- the property to search for- Returns:
StatementGroupor null
-
getJsonClaims
Returns the "claims". Only used by Jackson.JSON "claims" correspond to statement groups in the WDTK model. You should use
StatementDocument.getStatementGroups()to obtain this data.- Returns:
- map of statement groups
-
getAllStatements
Description copied from interface:StatementDocumentReturns an iterator that provides access to all statements, without considering the statement groups. The order of statements is preserved.- Specified by:
getAllStatementsin interfaceStatementDocument- Returns:
- iterator over all statements
-
addStatementToGroups
protected static Map<String,List<Statement>> addStatementToGroups(Statement statement, Map<String, List<Statement>> claims) Adds a Statement to a given collection of statement groups. If the statement id is not null and matches that of an existing statement, this statement will be replaced.- Parameters:
statement-claims-- Returns:
-
removeStatements
protected static Map<String,List<Statement>> removeStatements(Set<String> statementIds, Map<String, List<Statement>> claims) Removes statement ids from a collection of statement groups.- Parameters:
statementIds-claims-- Returns:
-