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, descriptions
entityId, 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, 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 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()
ItemDocument
getEntityId
in interface EntityDocument
getEntityId
in interface ItemDocument
public Map<String,SiteLink> getSiteLinks()
ItemDocument
SiteLink
objects.getSiteLinks
in interface ItemDocument
public ItemDocument withEntityId(ItemIdValue itemId)
ItemDocument
withEntityId
in interface ItemDocument
itemId
- new ID of the documentpublic ItemDocument withRevisionId(long newRevisionId)
TermedDocument
withRevisionId
in interface EntityDocument
withRevisionId
in interface ItemDocument
withRevisionId
in interface LabeledDocument
withRevisionId
in interface LabeledStatementDocument
withRevisionId
in interface StatementDocument
withRevisionId
in interface TermedDocument
withRevisionId
in interface TermedStatementDocument
public ItemDocument withLabel(MonolingualTextValue newLabel)
TermedDocument
withLabel
in interface ItemDocument
withLabel
in interface LabeledDocument
withLabel
in interface LabeledStatementDocument
withLabel
in interface TermedDocument
withLabel
in interface TermedStatementDocument
public ItemDocument withDescription(MonolingualTextValue newDescription)
TermedDocument
withDescription
in interface ItemDocument
withDescription
in interface TermedDocument
withDescription
in interface TermedStatementDocument
public ItemDocument withAliases(String language, List<MonolingualTextValue> aliases)
TermedDocument
withAliases
in interface ItemDocument
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 ItemDocument withStatement(Statement statement)
StatementDocument
withStatement
in interface ItemDocument
withStatement
in interface LabeledStatementDocument
withStatement
in interface StatementDocument
withStatement
in interface TermedStatementDocument
statement
- the statement to add or update in the documentpublic ItemDocument withoutStatementIds(Set<String> statementIds)
StatementDocument
withoutStatementIds
in interface ItemDocument
withoutStatementIds
in interface LabeledStatementDocument
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