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, descriptions
entityId, 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, withAliases
getJsonId, getRevisionId
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findDescription, getAliases, getDescriptions
findLabel, getLabels
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
getRevisionId
protected 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()
PropertyDocument
getEntityId
in interface EntityDocument
getEntityId
in interface PropertyDocument
public DatatypeIdValue getDatatype()
PropertyDocument
getDatatype
in interface PropertyDocument
DatatypeIdValue
public PropertyDocument withEntityId(PropertyIdValue newEntityId)
PropertyDocument
withEntityId
in interface PropertyDocument
newEntityId
- new ID of the documentpublic PropertyDocument withRevisionId(long newRevisionId)
TermedDocument
withRevisionId
in interface EntityDocument
withRevisionId
in interface LabeledDocument
withRevisionId
in interface LabeledStatementDocument
withRevisionId
in interface PropertyDocument
withRevisionId
in interface StatementDocument
withRevisionId
in interface TermedDocument
withRevisionId
in interface TermedStatementDocument
public PropertyDocument withLabel(MonolingualTextValue newLabel)
TermedDocument
withLabel
in interface LabeledDocument
withLabel
in interface LabeledStatementDocument
withLabel
in interface PropertyDocument
withLabel
in interface TermedDocument
withLabel
in interface TermedStatementDocument
public PropertyDocument withDescription(MonolingualTextValue newDescription)
TermedDocument
withDescription
in interface PropertyDocument
withDescription
in interface TermedDocument
withDescription
in interface TermedStatementDocument
public PropertyDocument withAliases(String language, List<MonolingualTextValue> aliases)
TermedDocument
withAliases
in interface PropertyDocument
withAliases
in interface TermedDocument
withAliases
in interface TermedStatementDocument
language
- 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)
StatementDocument
withStatement
in interface LabeledStatementDocument
withStatement
in interface PropertyDocument
withStatement
in interface StatementDocument
withStatement
in interface TermedStatementDocument
statement
- the statement to add or update in the documentpublic PropertyDocument withoutStatementIds(Set<String> statementIds)
StatementDocument
withoutStatementIds
in interface LabeledStatementDocument
withoutStatementIds
in interface PropertyDocument
withoutStatementIds
in interface StatementDocument
withoutStatementIds
in interface TermedStatementDocument
statementIds
- the identifiers of the statements to removepublic Map<String,MonolingualTextValue> getLabels()
LabeledDocument
getLabels
in interface LabeledDocument
protected static Map<String,MonolingualTextValue> constructTermMap(List<MonolingualTextValue> terms)
protected static Map<String,MonolingualTextValue> withTerm(Map<String,MonolingualTextValue> values, MonolingualTextValue value)
public List<StatementGroup> getStatementGroups()
StatementDocument
getStatementGroups
in interface StatementDocument
public StatementGroup findStatementGroup(String propertyIdValue)
findStatementGroup
in interface StatementDocument
propertyIdValue
- 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()
StatementDocument
getAllStatements
in interface StatementDocument
protected static Map<String,List<Statement>> addStatementToGroups(Statement statement, Map<String,List<Statement>> claims)
statement
- claims
- 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