Modifier and Type | Class and Description |
---|---|
static class |
StatementImpl.PreStatement
Helper class for deserializing statements from JSON.
|
Constructor and Description |
---|
StatementImpl(String statementId,
Snak mainsnak,
EntityIdValue subjectId)
TODO review the utility of this constructor.
|
StatementImpl(String statementId,
StatementRank rank,
Snak mainSnak,
List<SnakGroup> qualifiers,
List<Reference> references,
EntityIdValue subjectId)
Constructor.
|
StatementImpl(String statementId,
StatementRank rank,
Snak mainSnak,
Map<String,List<Snak>> qualifiers,
List<String> qualifiersOrder,
List<Reference> references,
EntityIdValue subjectId) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Iterator<Snak> |
getAllQualifiers()
Returns an iterator over all qualifiers, without considering qualifier
groups.
|
Claim |
getClaim()
Get the Claim object that this statement refers to.
|
Snak |
getMainSnak()
Main Snak of the statement.
|
List<SnakGroup> |
getQualifiers()
Groups of auxiliary Snaks, also known as qualifiers, that provide
additional context information for this claim.
|
StatementRank |
getRank() |
List<Reference> |
getReferences()
Get a list of references for this Statement.
|
String |
getStatementId()
Return the id used to identify this statement.
|
EntityIdValue |
getSubject()
The subject that the claim refers to, e.g., the id of "Berlin".
|
Value |
getValue()
Convenience method to get the value of the statement's claim's main snak,
or null if there is none.
|
int |
hashCode() |
String |
toString() |
Statement |
withStatementId(String id)
Returns the same statement, but with a different identifier.
|
public StatementImpl(String statementId, StatementRank rank, Snak mainSnak, List<SnakGroup> qualifiers, List<Reference> references, EntityIdValue subjectId)
The statementId is used mainly for communication with a Wikibase site, in order to refer to statements of that site. When creating new statements that are not on any site, the empty string can be used.
statementId
- the string id of the Statement: can be empty if the statement has not obtained it yetrank
- the rank of the StatementmainSnak
- the main snak for the Claim of the Statementqualifiers
- the snak groups for the qualifiersreferences
- the references for the StatementsubjectId
- the subject of this Statementpublic StatementImpl(String statementId, StatementRank rank, Snak mainSnak, Map<String,List<Snak>> qualifiers, List<String> qualifiersOrder, List<Reference> references, EntityIdValue subjectId)
public StatementImpl(String statementId, Snak mainsnak, EntityIdValue subjectId)
public Claim getClaim()
Statement
public EntityIdValue getSubject()
Statement
getSubject
in interface Statement
public Snak getMainSnak()
Statement
ValueSnak
"Population: 3000000".getMainSnak
in interface Statement
public List<SnakGroup> getQualifiers()
Statement
getQualifiers
in interface Statement
public Iterator<Snak> getAllQualifiers()
Statement
getAllQualifiers
in interface Statement
public StatementRank getRank()
getRank
in interface Statement
StatementRank
public List<Reference> getReferences()
Statement
getReferences
in interface Statement
public String getStatementId()
Statement
Statement ids are used by Wikibase to allow certain interactions though the API, especially the atomic modification of Statements (modifications of statements can be viewed as deletions followed by insertions, but doing this in several steps though the API is not practical). In the current Wikibase implementation, the id is a string that begins with the (sometimes lowercased) local ID of the subject of the statement, followed by a dollar sign and a randomly generated UUID. Thus statements of different subjects can never have the same id, and it is extremely unlikely that two statements of the one subject ever have the same id. However, it is possible that two statements with the same content differ in their id, since the id is not based on the content.
Wikidata Toolkit generally requires ids to be specified but you can use the empty string to indicate that a statement has no id. This will also be respected when serializing data as JSON, i.e., rather than setting the statement id to an empty string in JSON, the key will simply be omitted. This is useful for creating new statements through the API.
Callers should not make any assumptions about the stability of statement ids over time, or about the internal format of the ids.
getStatementId
in interface Statement
public Value getValue()
Statement
public Statement withStatementId(String id)
Statement
withStatementId
in interface Statement
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