public class ItemDocumentImpl extends TermedStatementDocumentImpl implements ItemDocument
ItemDocument.| 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| Modifier | Constructor and Description |
|---|---|
|
ItemDocumentImpl(ItemIdValue id,
List<MonolingualTextValue> labels,
List<MonolingualTextValue> descriptions,
List<MonolingualTextValue> aliases,
List<StatementGroup> statements,
List<SiteLink> siteLinks,
long revisionId)
Constructor.
|
protected |
ItemDocumentImpl(ItemIdValue subject,
Map<String,MonolingualTextValue> labels,
Map<String,MonolingualTextValue> descriptions,
Map<String,List<MonolingualTextValue>> aliases,
Map<String,List<Statement>> claims,
Map<String,SiteLink> siteLinks,
long revisionId)
Protected constructor, meant to be used to create modified copies
of instances.
|
|
ItemDocumentImpl(String jsonId,
Map<String,MonolingualTextValue> labels,
Map<String,MonolingualTextValue> descriptions,
Map<String,List<MonolingualTextValue>> aliases,
Map<String,List<StatementImpl.PreStatement>> claims,
Map<String,SiteLink> sitelinks,
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.
|
ItemIdValue |
getEntityId()
Return the ID of the item that the data refers to.
|
Map<String,List<Statement>> |
getJsonClaims()
Returns the "claims".
|
Map<String,MonolingualTextValue> |
getLabels()
Return a Map from Wikibase language codes to labels.
|
Map<String,SiteLink> |
getSiteLinks()
Get a Map of site keys to
SiteLink objects. |
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() |
ItemDocument |
withAliases(String language,
List<MonolingualTextValue> aliases)
Returns a new version of this document with a new list of aliases
for the given language code.
|
ItemDocument |
withDescription(MonolingualTextValue newDescription)
Returns a new version of this document with a new description
(which overrides any existing description).
|
ItemDocument |
withEntityId(ItemIdValue itemId)
Returns a new version of this document with updated ID.
|
ItemDocument |
withLabel(MonolingualTextValue newLabel)
Returns a new version of this document with a new label
(which overrides any existing label for this language).
|
ItemDocument |
withoutStatementIds(Set<String> statementIds)
Returns a new version of this document where all statements matching
any of the statement ids provided have been removed.
|
ItemDocument |
withRevisionId(long newRevisionId)
Returns a copy of this document with an updated revision id.
|
ItemDocument |
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 ItemDocumentImpl(ItemIdValue id, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statements, List<SiteLink> siteLinks, long revisionId)
id - the id of the item that data is aboutlabels - the list of labels of this item, with at most one label for
each language codedescriptions - the list of descriptions of this item, with at most one
description for each language codealiases - the list of aliases of this itemstatements - the list of statement groups of this item; all of them must
have the given itemIdValue as their subjectsiteLinks - the sitelinks of this itemrevisionId - the revision ID or 0 if not known; see
EntityDocument.getRevisionId()public ItemDocumentImpl(String jsonId, Map<String,MonolingualTextValue> labels, Map<String,MonolingualTextValue> descriptions, Map<String,List<MonolingualTextValue>> aliases, Map<String,List<StatementImpl.PreStatement>> claims, Map<String,SiteLink> sitelinks, long revisionId, String siteIri)
protected ItemDocumentImpl(ItemIdValue subject, Map<String,MonolingualTextValue> labels, Map<String,MonolingualTextValue> descriptions, Map<String,List<MonolingualTextValue>> aliases, Map<String,List<Statement>> claims, Map<String,SiteLink> siteLinks, long revisionId)
public ItemIdValue getEntityId()
ItemDocumentgetEntityId in interface EntityDocumentgetEntityId in interface ItemDocumentpublic Map<String,SiteLink> getSiteLinks()
ItemDocumentSiteLink objects.getSiteLinks in interface ItemDocumentpublic ItemDocument withEntityId(ItemIdValue itemId)
ItemDocumentwithEntityId in interface ItemDocumentitemId - new ID of the documentpublic ItemDocument withRevisionId(long newRevisionId)
TermedDocumentwithRevisionId in interface EntityDocumentwithRevisionId in interface ItemDocumentwithRevisionId in interface LabeledDocumentwithRevisionId in interface LabeledStatementDocumentwithRevisionId in interface StatementDocumentwithRevisionId in interface TermedDocumentwithRevisionId in interface TermedStatementDocumentpublic ItemDocument withLabel(MonolingualTextValue newLabel)
TermedDocumentwithLabel in interface ItemDocumentwithLabel in interface LabeledDocumentwithLabel in interface LabeledStatementDocumentwithLabel in interface TermedDocumentwithLabel in interface TermedStatementDocumentpublic ItemDocument withDescription(MonolingualTextValue newDescription)
TermedDocumentwithDescription in interface ItemDocumentwithDescription in interface TermedDocumentwithDescription in interface TermedStatementDocumentpublic ItemDocument withAliases(String language, List<MonolingualTextValue> aliases)
TermedDocumentwithAliases in interface ItemDocumentwithAliases 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 ItemDocument withStatement(Statement statement)
StatementDocumentwithStatement in interface ItemDocumentwithStatement in interface LabeledStatementDocumentwithStatement in interface StatementDocumentwithStatement in interface TermedStatementDocumentstatement - the statement to add or update in the documentpublic ItemDocument withoutStatementIds(Set<String> statementIds)
StatementDocumentwithoutStatementIds in interface ItemDocumentwithoutStatementIds in interface LabeledStatementDocumentwithoutStatementIds 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