public class MediaInfoDocumentImpl extends EntityDocumentImpl implements MediaInfoDocument
MediaInfoDocument
.
We serialize back statements in JSON with the "claims" key for compatibility with the other entity types and the wbeditentity API mdodule
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 |
entityId, revisionId, siteIri
Modifier | Constructor and Description |
---|---|
|
MediaInfoDocumentImpl(MediaInfoIdValue id,
List<MonolingualTextValue> labels,
List<StatementGroup> statements,
long revisionId)
Constructor.
|
protected |
MediaInfoDocumentImpl(MediaInfoIdValue subject,
Map<String,MonolingualTextValue> labels,
Map<String,List<Statement>> claims,
long revisionId)
Protected constructor, meant to be used to create modified copies
of instances.
|
|
MediaInfoDocumentImpl(String jsonId,
Map<String,MonolingualTextValue> labels,
Map<String,List<StatementImpl.PreStatement>> claims,
Map<String,List<StatementImpl.PreStatement>> statements,
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.
|
MediaInfoIdValue |
getEntityId()
Returns the ID of the entity 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.
|
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() |
MediaInfoDocument |
withEntityId(MediaInfoIdValue newEntityId)
Returns a new version of this document with updated ID.
|
MediaInfoDocument |
withLabel(MonolingualTextValue newLabel)
Returns a new version of this document with a new label
(which overrides any existing label for this language).
|
MediaInfoDocument |
withoutStatementIds(Set<String> statementIds)
Returns a new version of this document where all statements matching
any of the statement ids provided have been removed.
|
MediaInfoDocument |
withRevisionId(long newRevisionId)
Returns a copy of this document with an updated revision id.
|
MediaInfoDocument |
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) |
getJsonId, getRevisionId, getSiteIri
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
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 MediaInfoDocumentImpl(MediaInfoIdValue id, List<MonolingualTextValue> labels, List<StatementGroup> statements, long revisionId)
id
- the id of the media that data is aboutlabels
- the list of captions of this media, with at most one label for
each language codestatements
- the list of statement groups of this media info; all of them must
have the given itemIdValue as their subjectrevisionId
- the revision ID or 0 if not known; see
EntityDocument.getRevisionId()
public MediaInfoDocumentImpl(String jsonId, Map<String,MonolingualTextValue> labels, Map<String,List<StatementImpl.PreStatement>> claims, Map<String,List<StatementImpl.PreStatement>> statements, long revisionId, String siteIri)
protected MediaInfoDocumentImpl(MediaInfoIdValue subject, Map<String,MonolingualTextValue> labels, Map<String,List<Statement>> claims, long revisionId)
public MediaInfoIdValue getEntityId()
MediaInfoDocument
getEntityId
in interface EntityDocument
getEntityId
in interface MediaInfoDocument
public MediaInfoDocument withEntityId(MediaInfoIdValue newEntityId)
MediaInfoDocument
withEntityId
in interface MediaInfoDocument
newEntityId
- new ID of the documentpublic MediaInfoDocument withRevisionId(long newRevisionId)
LabeledDocument
withRevisionId
in interface EntityDocument
withRevisionId
in interface LabeledDocument
withRevisionId
in interface LabeledStatementDocument
withRevisionId
in interface MediaInfoDocument
withRevisionId
in interface StatementDocument
public MediaInfoDocument withLabel(MonolingualTextValue newLabel)
LabeledDocument
withLabel
in interface LabeledDocument
withLabel
in interface LabeledStatementDocument
withLabel
in interface MediaInfoDocument
public MediaInfoDocument withStatement(Statement statement)
StatementDocument
withStatement
in interface LabeledStatementDocument
withStatement
in interface MediaInfoDocument
withStatement
in interface StatementDocument
statement
- the statement to add or update in the documentpublic MediaInfoDocument withoutStatementIds(Set<String> statementIds)
StatementDocument
withoutStatementIds
in interface LabeledStatementDocument
withoutStatementIds
in interface MediaInfoDocument
withoutStatementIds
in interface StatementDocument
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