public class PropertyDocumentImpl extends TermedStatementDocumentImpl implements PropertyDocument
PropertyDocument.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,List<Statement>> |
claims
This is what is called claim in the JSON model.
|
protected Map<String,MonolingualTextValue> |
labels |
aliases, descriptionsentityId, revisionId, siteIri| Constructor and Description |
|---|
PropertyDocumentImpl(PropertyIdValue id,
List<MonolingualTextValue> labels,
List<MonolingualTextValue> descriptions,
List<MonolingualTextValue> aliases,
List<StatementGroup> statements,
DatatypeIdValue datatype,
long revisionId)
Constructor for instances that are built manually, rather than from JSON.
|
PropertyDocumentImpl(String jsonId,
Map<String,MonolingualTextValue> labels,
Map<String,MonolingualTextValue> descriptions,
Map<String,List<MonolingualTextValue>> aliases,
Map<String,List<StatementImpl.PreStatement>> claims,
String datatype,
long revisionId,
String siteIri)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static Map<String,List<Statement>> |
addStatementToGroups(Statement statement,
Map<String,List<Statement>> claims)
Adds a Statement to a given collection of statement groups.
|
protected static Map<String,MonolingualTextValue> |
constructTermMap(List<MonolingualTextValue> terms) |
boolean |
equals(Object obj) |
StatementGroup |
findStatementGroup(String propertyIdValue)
Find a statement group by its property id, without checking for
equality with the site IRI.
|
Iterator<Statement> |
getAllStatements()
Returns an iterator that provides access to all statements, without
considering the statement groups.
|
DatatypeIdValue |
getDatatype()
Get the datatype id of the datatype defined for this property.
|
PropertyIdValue |
getEntityId()
Return the ID of the item that the data refers to.
|
Map<String,List<Statement>> |
getJsonClaims()
Returns the "claims".
|
String |
getJsonDatatype()
Returns the JSON string version of the property's datatype.
|
Map<String,MonolingualTextValue> |
getLabels()
Return a Map from Wikibase language codes to labels.
|
List<StatementGroup> |
getStatementGroups()
Return the list of all StatementGroups stored for this item.
|
int |
hashCode() |
protected static Map<String,List<Statement>> |
removeStatements(Set<String> statementIds,
Map<String,List<Statement>> claims)
Removes statement ids from a collection of statement groups.
|
String |
toString() |
PropertyDocument |
withAliases(String language,
List<MonolingualTextValue> aliases)
Returns a new version of this document with a new list of aliases
for the given language code.
|
PropertyDocument |
withDescription(MonolingualTextValue newDescription)
Returns a new version of this document with a new description
(which overrides any existing description).
|
PropertyDocument |
withEntityId(PropertyIdValue newEntityId)
Returns a new version of this document with updated ID.
|
PropertyDocument |
withLabel(MonolingualTextValue newLabel)
Returns a new version of this document with a new label
(which overrides any existing label for this language).
|
PropertyDocument |
withoutStatementIds(Set<String> statementIds)
Returns a new version of this document where all statements matching
any of the statement ids provided have been removed.
|
PropertyDocument |
withRevisionId(long newRevisionId)
Returns a copy of this document with an updated revision id.
|
PropertyDocument |
withStatement(Statement statement)
Returns a new version of this document which includes the
statement provided.
|
protected static Map<String,MonolingualTextValue> |
withTerm(Map<String,MonolingualTextValue> values,
MonolingualTextValue value) |
getAliases, getDescriptions, getSiteIri, withAliasesgetJsonId, getRevisionIdclone, finalize, getClass, notify, notifyAll, wait, wait, waitfindDescription, getAliases, getDescriptionsfindLabel, getLabelsfindStatement, 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, hasStatementValuegetRevisionIdprotected final Map<String,MonolingualTextValue> labels
public PropertyDocumentImpl(PropertyIdValue id, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statements, DatatypeIdValue datatype, long revisionId)
id - the id of the property that data is aboutlabels - the list of labels of this property, with at most one label
for each language codedescriptions - the list of descriptions of this property, with at most one
description for each language codealiases - the list of aliases of this propertystatements - the list of statement groups of this item; all of them must
have the given itemIdValue as their subjectdatatype - the datatype of that propertyrevisionId - the revision ID or 0 if not known; see
EntityDocument.getRevisionId()public PropertyDocumentImpl(String jsonId, Map<String,MonolingualTextValue> labels, Map<String,MonolingualTextValue> descriptions, Map<String,List<MonolingualTextValue>> aliases, Map<String,List<StatementImpl.PreStatement>> claims, String datatype, long revisionId, String siteIri)
public String getJsonDatatype()
getDatatype() is already used for another function of the
interface.public PropertyIdValue getEntityId()
PropertyDocumentgetEntityId in interface EntityDocumentgetEntityId in interface PropertyDocumentpublic DatatypeIdValue getDatatype()
PropertyDocumentgetDatatype in interface PropertyDocumentDatatypeIdValuepublic PropertyDocument withEntityId(PropertyIdValue newEntityId)
PropertyDocumentwithEntityId in interface PropertyDocumentnewEntityId - new ID of the documentpublic PropertyDocument withRevisionId(long newRevisionId)
TermedDocumentwithRevisionId in interface EntityDocumentwithRevisionId in interface LabeledDocumentwithRevisionId in interface LabeledStatementDocumentwithRevisionId in interface PropertyDocumentwithRevisionId in interface StatementDocumentwithRevisionId in interface TermedDocumentwithRevisionId in interface TermedStatementDocumentpublic PropertyDocument withLabel(MonolingualTextValue newLabel)
TermedDocumentwithLabel in interface LabeledDocumentwithLabel in interface LabeledStatementDocumentwithLabel in interface PropertyDocumentwithLabel in interface TermedDocumentwithLabel in interface TermedStatementDocumentpublic PropertyDocument withDescription(MonolingualTextValue newDescription)
TermedDocumentwithDescription in interface PropertyDocumentwithDescription in interface TermedDocumentwithDescription in interface TermedStatementDocumentpublic PropertyDocument withAliases(String language, List<MonolingualTextValue> aliases)
TermedDocumentwithAliases in interface PropertyDocumentwithAliases in interface TermedDocumentwithAliases in interface TermedStatementDocumentlanguage - the language code for which the aliases should be setaliases - the aliases to set for this language. The language codes they
contain should all match the supplied language.public PropertyDocument withStatement(Statement statement)
StatementDocumentwithStatement in interface LabeledStatementDocumentwithStatement in interface PropertyDocumentwithStatement in interface StatementDocumentwithStatement in interface TermedStatementDocumentstatement - the statement to add or update in the documentpublic PropertyDocument withoutStatementIds(Set<String> statementIds)
StatementDocumentwithoutStatementIds in interface LabeledStatementDocumentwithoutStatementIds in interface PropertyDocumentwithoutStatementIds in interface StatementDocumentwithoutStatementIds in interface TermedStatementDocumentstatementIds - the identifiers of the statements to removepublic Map<String,MonolingualTextValue> getLabels()
LabeledDocumentgetLabels in interface LabeledDocumentprotected static Map<String,MonolingualTextValue> constructTermMap(List<MonolingualTextValue> terms)
protected static Map<String,MonolingualTextValue> withTerm(Map<String,MonolingualTextValue> values, MonolingualTextValue value)
public List<StatementGroup> getStatementGroups()
StatementDocumentgetStatementGroups in interface StatementDocumentpublic StatementGroup findStatementGroup(String propertyIdValue)
findStatementGroup in interface StatementDocumentpropertyIdValue - the property to search forStatementGroup or nullpublic Map<String,List<Statement>> getJsonClaims()
JSON "claims" correspond to statement groups in the WDTK model. You
should use StatementDocumentImpl.getStatementGroups() to obtain
this data.
public Iterator<Statement> getAllStatements()
StatementDocumentgetAllStatements in interface StatementDocumentprotected static Map<String,List<Statement>> addStatementToGroups(Statement statement, Map<String,List<Statement>> claims)
statement - claims - Copyright © 2014–2022 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage