Class FormDocumentImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
org.wikidata.wdtk.datamodel.implementation.FormDocumentImpl
- All Implemented Interfaces:
EntityDocument
,FormDocument
,StatementDocument
Jackson implementation of
FormDocument
.- Author:
- Thomas Pellissier Tanon
-
Field Summary
Modifier and TypeFieldDescriptionThis is what is called claim in the JSON model.Fields inherited from class org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
entityId, revisionId, siteIri
-
Method Summary
Modifier and TypeMethodDescriptionAdds a Statement to a given collection of statement groups.boolean
findStatementGroup
(String propertyIdValue) Find a statement group by its property id, without checking for equality with the site IRI.Returns an iterator that provides access to all statements, without considering the statement groups.Returns the ID of the entity that the data refers toReturn the IDs of the grammatical features of the form (masculine, singular...)Returns the "claims".Return the human readable representations of the form indexed by Wikimedia language codeReturn the list of all StatementGroups stored for this item.int
hashCode()
Removes statement ids from a collection of statement groups.toString()
withEntityId
(FormIdValue newEntityId) Returns a new version of this document with updated ID.withGrammaticalFeature
(ItemIdValue grammaticalFeature) withoutStatementIds
(Set<String> statementIds) Returns a new version of this document where all statements matching any of the statement ids provided have been removed.withRepresentation
(MonolingualTextValue representation) withRevisionId
(long newRevisionId) Returns a copy of this document with an updated revision id.withStatement
(Statement statement) Returns a new version of this document which includes the statement provided.Methods inherited from class org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
getJsonId, getRevisionId, getSiteIri
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.wikidata.wdtk.datamodel.interfaces.EntityDocument
getRevisionId
Methods inherited from interface org.wikidata.wdtk.datamodel.interfaces.StatementDocument
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
-
Field Details
-
claims
This is what is called claim in the JSON model. It corresponds to the statement group in the WDTK model.
-
-
Method Details
-
getEntityId
Description copied from interface:FormDocument
Returns the ID of the entity that the data refers to- Specified by:
getEntityId
in interfaceEntityDocument
- Specified by:
getEntityId
in interfaceFormDocument
- Returns:
- form id
-
getGrammaticalFeatures
Description copied from interface:FormDocument
Return the IDs of the grammatical features of the form (masculine, singular...)- Specified by:
getGrammaticalFeatures
in interfaceFormDocument
- Returns:
- item ids
-
getRepresentations
Description copied from interface:FormDocument
Return the human readable representations of the form indexed by Wikimedia language code- Specified by:
getRepresentations
in interfaceFormDocument
- Returns:
- a map from Wikimedia language code to the representations
-
hashCode
public int hashCode() -
equals
-
toString
-
withEntityId
Description copied from interface:FormDocument
Returns a new version of this document with updated ID.- Specified by:
withEntityId
in interfaceFormDocument
- Parameters:
newEntityId
- new ID of the document- Returns:
- document with updated ID
-
withRevisionId
Description copied from interface:FormDocument
Returns a copy of this document with an updated revision id.- Specified by:
withRevisionId
in interfaceEntityDocument
- Specified by:
withRevisionId
in interfaceFormDocument
- Specified by:
withRevisionId
in interfaceStatementDocument
-
withRepresentation
- Specified by:
withRepresentation
in interfaceFormDocument
-
withGrammaticalFeature
- Specified by:
withGrammaticalFeature
in interfaceFormDocument
-
withStatement
Description copied from interface:FormDocument
Returns a new version of this document which includes the statement provided. If the identifier of this statement matches that of any other statement for the same property, then the existing statement will be replaced by the new one. Otherwise, the new statement will be added at the end of the list of statements in this group.- Specified by:
withStatement
in interfaceFormDocument
- Specified by:
withStatement
in interfaceStatementDocument
- Parameters:
statement
- the statement to add or update in the document
-
withoutStatementIds
Description copied from interface:FormDocument
Returns a new version of this document where all statements matching any of the statement ids provided have been removed. These statements can use different properties.- Specified by:
withoutStatementIds
in interfaceFormDocument
- Specified by:
withoutStatementIds
in interfaceStatementDocument
- Parameters:
statementIds
- the identifiers of the statements to remove
-
getStatementGroups
Description copied from interface:StatementDocument
Return the list of all StatementGroups stored for this item. The order of StatementGroups is significant.- Specified by:
getStatementGroups
in interfaceStatementDocument
- Returns:
- list of StatementGroups
-
findStatementGroup
Find a statement group by its property id, without checking for equality with the site IRI. More efficient implementation than the default one.- Specified by:
findStatementGroup
in interfaceStatementDocument
- Parameters:
propertyIdValue
- the property to search for- Returns:
StatementGroup
or null
-
getJsonClaims
Returns the "claims". Only used by Jackson.JSON "claims" correspond to statement groups in the WDTK model. You should use
StatementDocument.getStatementGroups()
to obtain this data.- Returns:
- map of statement groups
-
getAllStatements
Description copied from interface:StatementDocument
Returns an iterator that provides access to all statements, without considering the statement groups. The order of statements is preserved.- Specified by:
getAllStatements
in interfaceStatementDocument
- Returns:
- iterator over all statements
-
addStatementToGroups
protected static Map<String,List<Statement>> addStatementToGroups(Statement statement, Map<String, List<Statement>> claims) Adds a Statement to a given collection of statement groups. If the statement id is not null and matches that of an existing statement, this statement will be replaced.- Parameters:
statement
-claims
-- Returns:
-
removeStatements
protected static Map<String,List<Statement>> removeStatements(Set<String> statementIds, Map<String, List<Statement>> claims) Removes statement ids from a collection of statement groups.- Parameters:
statementIds
-claims
-- Returns:
-