Class LexemeDocumentImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
org.wikidata.wdtk.datamodel.implementation.LexemeDocumentImpl
- All Implemented Interfaces:
EntityDocument,LexemeDocument,StatementDocument
Jackson implementation of
LexemeDocument.- Author:
- Thomas Pellissier Tanon
-
Field Summary
FieldsModifier and TypeFieldDescriptionThis is what is called claim in the JSON model.Fields inherited from class org.wikidata.wdtk.datamodel.implementation.EntityDocumentImpl
entityId, revisionId, siteIri -
Constructor Summary
ConstructorsConstructorDescriptionLexemeDocumentImpl(String jsonId, String lexicalCategory, String language, Map<String, MonolingualTextValue> lemmas, Map<String, List<StatementImpl.PreStatement>> claims, List<FormDocument> forms, List<SenseDocument> senses, long revisionId, String siteIri) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdds a Statement to a given collection of statement groups.createForm(List<MonolingualTextValue> representations) Creates a newFormDocumentfor this lexeme.createSense(List<MonolingualTextValue> glosses) Creates a newSenseDocumentfor this Lexeme.booleanfindStatementGroup(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 togetForm(FormIdValue formId) Return the inner form having the given idgetForms()Return the lexeme formsReturns the "claims".Return the ID of the language to which the lexeme belongs (French, British English...)Return the human readable representations of the lexeme indexed by Wikimedia language codeReturn the ID of the lexical category to which the lexeme belongs (noun, verb...)getSense(SenseIdValue senseId) Return the inner sense having the given idReturn the lexeme sensesReturn the list of all StatementGroups stored for this item.inthashCode()Removes statement ids from a collection of statement groups.toString()withEntityId(LexemeIdValue newEntityId) Returns a new version of this document with updated ID.withForm(FormDocument form) Adds aFormDocumentto this lexeme.withLanguage(ItemIdValue newLanguage) withLemma(MonolingualTextValue lemma) withLexicalCategory(ItemIdValue newLexicalCategory) withoutStatementIds(Set<String> statementIds) Returns a new version of this document where all statements matching any of the statement ids provided have been removed.withRevisionId(long newRevisionId) Returns a copy of this document with an updated revision id.withSense(SenseDocument sense) Adds aSenseDocumentto this lexeme.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, getSiteIriMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.wikidata.wdtk.datamodel.interfaces.EntityDocument
getRevisionIdMethods 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.
-
-
Constructor Details
-
LexemeDocumentImpl
public LexemeDocumentImpl(String jsonId, String lexicalCategory, String language, Map<String, MonolingualTextValue> lemmas, Map<String, List<StatementImpl.PreStatement>> claims, List<FormDocument> forms, List<SenseDocument> senses, long revisionId, String siteIri) Constructor. Creates an object that can be populated during JSON deserialization. Should only be used by Jackson for this very purpose.
-
-
Method Details
-
getEntityId
Description copied from interface:LexemeDocumentReturns the ID of the entity that the data refers to- Specified by:
getEntityIdin interfaceEntityDocument- Specified by:
getEntityIdin interfaceLexemeDocument- Returns:
- lexeme id
-
getLexicalCategory
Description copied from interface:LexemeDocumentReturn the ID of the lexical category to which the lexeme belongs (noun, verb...)- Specified by:
getLexicalCategoryin interfaceLexemeDocument- Returns:
- item id
-
getLanguage
Description copied from interface:LexemeDocumentReturn the ID of the language to which the lexeme belongs (French, British English...)- Specified by:
getLanguagein interfaceLexemeDocument- Returns:
- item id
-
getLemmas
Description copied from interface:LexemeDocumentReturn the human readable representations of the lexeme indexed by Wikimedia language code- Specified by:
getLemmasin interfaceLexemeDocument- Returns:
- a map from Wikimedia language code to the lemma
-
getForms
Description copied from interface:LexemeDocumentReturn the lexeme forms- Specified by:
getFormsin interfaceLexemeDocument- Returns:
- the list of forms
-
getSenses
Description copied from interface:LexemeDocumentReturn the lexeme senses- Specified by:
getSensesin interfaceLexemeDocument- Returns:
- the list of senses
-
getForm
Description copied from interface:LexemeDocumentReturn the inner form having the given id- Specified by:
getFormin interfaceLexemeDocument
-
getSense
Description copied from interface:LexemeDocumentReturn the inner sense having the given id- Specified by:
getSensein interfaceLexemeDocument
-
hashCode
public int hashCode() -
equals
-
toString
-
withEntityId
Description copied from interface:LexemeDocumentReturns a new version of this document with updated ID.- Specified by:
withEntityIdin interfaceLexemeDocument- Parameters:
newEntityId- new ID of the document- Returns:
- document with updated ID
-
withLexicalCategory
- Specified by:
withLexicalCategoryin interfaceLexemeDocument
-
withLanguage
- Specified by:
withLanguagein interfaceLexemeDocument
-
withLemma
- Specified by:
withLemmain interfaceLexemeDocument
-
withStatement
Description copied from interface:LexemeDocumentReturns 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:
withStatementin interfaceLexemeDocument- Specified by:
withStatementin interfaceStatementDocument- Parameters:
statement- the statement to add or update in the document
-
withoutStatementIds
Description copied from interface:LexemeDocumentReturns 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:
withoutStatementIdsin interfaceLexemeDocument- Specified by:
withoutStatementIdsin interfaceStatementDocument- Parameters:
statementIds- the identifiers of the statements to remove
-
createForm
Description copied from interface:LexemeDocumentCreates a newFormDocumentfor this lexeme. The form is not added to theLexemeDocumentobject, it should be done withLexemeDocument.withForm(org.wikidata.wdtk.datamodel.interfaces.FormDocument).- Specified by:
createFormin interfaceLexemeDocument
-
withForm
Description copied from interface:LexemeDocumentAdds aFormDocumentto this lexeme. The form id should be prefixed with the lexeme id.- Specified by:
withFormin interfaceLexemeDocument
-
createSense
Description copied from interface:LexemeDocumentCreates a newSenseDocumentfor this Lexeme. The form is not added to theLexemeDocumentobject, it should be done withLexemeDocument.withSense(org.wikidata.wdtk.datamodel.interfaces.SenseDocument).- Specified by:
createSensein interfaceLexemeDocument
-
withSense
Description copied from interface:LexemeDocumentAdds aSenseDocumentto this lexeme. The sense id should be prefixed with the lexeme id.- Specified by:
withSensein interfaceLexemeDocument
-
withRevisionId
Description copied from interface:LexemeDocumentReturns a copy of this document with an updated revision id.- Specified by:
withRevisionIdin interfaceEntityDocument- Specified by:
withRevisionIdin interfaceLexemeDocument- Specified by:
withRevisionIdin interfaceStatementDocument
-
getStatementGroups
Description copied from interface:StatementDocumentReturn the list of all StatementGroups stored for this item. The order of StatementGroups is significant.- Specified by:
getStatementGroupsin 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:
findStatementGroupin interfaceStatementDocument- Parameters:
propertyIdValue- the property to search for- Returns:
StatementGroupor 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:StatementDocumentReturns an iterator that provides access to all statements, without considering the statement groups. The order of statements is preserved.- Specified by:
getAllStatementsin 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:
-