Class Datamodel
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.Datamodel
This class contains static methods to create WDTK data objects. This is the
preferred way of creating data objects in WDTK.
- Author:
- Markus Kroetzsch
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AliasUpdatemakeAliasUpdate(List<MonolingualTextValue> recreated) Creates newAliasUpdatethat completely replaces all aliases.static AliasUpdatemakeAliasUpdate(List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdatethat adds and/or removes some of the aliases.static AliasUpdatemakeAliasUpdate(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdate.static ClaimmakeClaim(EntityIdValue subject, Snak mainSnak, List<SnakGroup> qualifiers) Creates aClaim.static DatatypeIdValueDeprecated.static DatatypeIdValuemakeDatatypeIdValueFromJsonString(String jsonString) Creates aDatatypeIdValue.static FormDocumentmakeFormDocument(FormIdValue formIdValue, List<MonolingualTextValue> representations, List<ItemIdValue> grammaticalFeatures, List<StatementGroup> statementGroups) Creates aFormDocument.static FormIdValuemakeFormIdValue(String id, String siteIri) Creates anFormIdValue.static FormUpdatemakeFormUpdate(FormIdValue entityId, long revisionId, TermUpdate representations, Collection<ItemIdValue> grammaticalFeatures, StatementUpdate statements) Creates newFormUpdate.static GlobeCoordinatesValuemakeGlobeCoordinatesValue(double latitude, double longitude, double precision, String globeIri) Creates aGlobeCoordinatesValue.static ItemDocumentmakeItemDocument(ItemIdValue itemIdValue) Creates an emptyItemDocument.static ItemDocumentmakeItemDocument(ItemIdValue itemIdValue, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, Map<String, SiteLink> siteLinks) Creates anItemDocumentwith empty revision id.static ItemDocumentmakeItemDocument(ItemIdValue itemIdValue, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, Map<String, SiteLink> siteLinks, long revisionId) Creates anItemDocument.static ItemIdValuemakeItemIdValue(String id, String siteIri) Creates anItemIdValue.static ItemUpdatemakeItemUpdate(ItemIdValue entityId, long revisionId, TermUpdate labels, TermUpdate descriptions, Map<String, AliasUpdate> aliases, StatementUpdate statements, Collection<SiteLink> modifiedSiteLinks, Collection<String> removedSiteLinks) Creates newItemUpdate.static LexemeDocumentmakeLexemeDocument(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas) Creates an emptyLexemeDocument.static LexemeDocumentmakeLexemeDocument(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas, List<StatementGroup> statementGroups, List<FormDocument> forms, List<SenseDocument> senses) Creates aLexemeDocument.static LexemeIdValuemakeLexemeIdValue(String id, String siteIri) Creates anLexemeIdValue.static LexemeUpdatemakeLexemeUpdate(LexemeIdValue entityId, long revisionId, ItemIdValue language, ItemIdValue lexicalCategory, TermUpdate lemmas, StatementUpdate statements, Collection<SenseDocument> addedSenses, Collection<SenseUpdate> updatedSenses, Collection<SenseIdValue> removedSenses, Collection<FormDocument> addedForms, Collection<FormUpdate> updatedForms, Collection<FormIdValue> removedForms) Creates newLexemeUpdate.static MediaInfoDocumentmakeMediaInfoDocument(MediaInfoIdValue mediaInfoIdValue) Creates an emptyMediaInfoDocument.static MediaInfoDocumentmakeMediaInfoDocument(MediaInfoIdValue mediaInfoIdValue, List<MonolingualTextValue> labels, List<StatementGroup> statementGroups) Creates aMediaInfoDocument.static MediaInfoIdValuemakeMediaInfoIdValue(String id, String siteIri) Creates anMediaInfoIdValue.static MediaInfoUpdatemakeMediaInfoUpdate(MediaInfoIdValue entityId, long revisionId, TermUpdate labels, StatementUpdate statements) Creates newMediaInfoUpdate.static MonolingualTextValuemakeMonolingualTextValue(String text, String languageCode) Creates aMonolingualTextValue.static NoValueSnakmakeNoValueSnak(PropertyIdValue propertyId) Creates aNoValueSnak.static PropertyDocumentmakePropertyDocument(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId) Creates aPropertyDocumentwith empty revision id.static PropertyDocumentmakePropertyDocument(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId, long revisionId) Creates aPropertyDocument.static PropertyDocumentmakePropertyDocument(PropertyIdValue propertyId, DatatypeIdValue datatypeId) Creates an emptyPropertyDocument.static PropertyIdValuemakePropertyIdValue(String id, String siteIri) Creates aPropertyIdValue.static PropertyUpdatemakePropertyUpdate(PropertyIdValue entityId, long revisionId, TermUpdate labels, TermUpdate descriptions, Map<String, AliasUpdate> aliases, StatementUpdate statements) Creates newPropertyUpdate.static QuantityValuemakeQuantityValue(long numericValue, long lowerBound, long upperBound) Creates aQuantityValuefrom long numbers.static QuantityValuemakeQuantityValue(BigDecimal numericValue) Creates aQuantityValuewith an empty unit and without bounds.static QuantityValuemakeQuantityValue(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound) Creates aQuantityValuewith an empty unit.static QuantityValuemakeQuantityValue(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit) Creates aQuantityValue.static QuantityValuemakeQuantityValue(BigDecimal numericValue, ItemIdValue unit) Creates aQuantityValuewithout bounds.static ReferencemakeReference(List<SnakGroup> snakGroups) Creates aReference.static SenseDocumentmakeSenseDocument(SenseIdValue senseIdValue, List<MonolingualTextValue> glosses, List<StatementGroup> statementGroups) Creates aSenseDocument.static SenseIdValuemakeSenseIdValue(String id, String siteIri) Creates anSenseIdValue.static SenseUpdatemakeSenseUpdate(SenseIdValue entityId, long revisionId, TermUpdate glosses, StatementUpdate statements) Creates newSenseUpdate.static SiteLinkmakeSiteLink(String title, String siteKey) Creates aSiteLinkwithout badges.static SiteLinkmakeSiteLink(String title, String siteKey, List<ItemIdValue> badges) Creates aSiteLink.static SnakGroupmakeSnakGroup(List<? extends Snak> snaks) Creates aSnakGroup.static SomeValueSnakmakeSomeValueSnak(PropertyIdValue propertyId) Creates aSomeValueSnak.static StatementmakeStatement(Claim claim, List<Reference> references, StatementRank rank, String statementId) Creates aStatement.static StatementmakeStatement(EntityIdValue subject, Snak mainSnak, List<SnakGroup> qualifiers, List<Reference> references, StatementRank rank, String statementId) Creates aStatement.static StatementGroupmakeStatementGroup(List<Statement> statements) Creates aStatementGroup.static StatementUpdatemakeStatementUpdate(Collection<Statement> added, Collection<Statement> replaced, Collection<String> removed) Creates newStatementUpdate.static StringValuemakeStringValue(String string) Creates aStringValue.static TermUpdatemakeTermUpdate(Collection<MonolingualTextValue> modified, Collection<String> removed) Creates newTermUpdate.static TimeValuemakeTimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String calendarModel) Creates aTimeValue.static TimeValuemakeTimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, int timezoneOffset, String calendarModel) Creates aTimeValuefor a given date and time.static TimeValuemakeTimeValue(long year, byte month, byte day, String calendarModel) Creates aTimeValuefor a given date.static ValueSnakmakeValueSnak(PropertyIdValue propertyId, Value value) Creates aValueSnak.static FormIdValueCreates anFormIdValuefor Wikidata.static ItemIdValueCreates anItemIdValuefor Wikidata.static LexemeIdValueCreates anLexemeIdValuefor Wikidata.static PropertyIdValueCreates aPropertyIdValue.static SenseIdValueCreates anSenseIdValuefor Wikidata.static MediaInfoIdValueCreates anMediaInfoIdValuefor Wikimedia Commons.
-
Field Details
-
SITE_WIKIDATA
The site IRI of Wikidata.- See Also:
-
SITE_WIKIMEDIA_COMMONS
The site IRI of Wikimedia Commons.- See Also:
-
-
Constructor Details
-
Datamodel
public Datamodel()
-
-
Method Details
-
makeItemIdValue
Creates anItemIdValue.- Parameters:
id- a string of the form Qn... where n... is the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- an
ItemIdValuecorresponding to the input
-
makeWikidataItemIdValue
Creates anItemIdValuefor Wikidata.- Parameters:
id- a string of the form Qn... where n... is the string representation of a positive integer number- Returns:
- an
ItemIdValuecorresponding to the input
-
makePropertyIdValue
Creates aPropertyIdValue.- Parameters:
id- a string of the form Pn... where n... is the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- a
PropertyIdValuecorresponding to the input
-
makeWikidataPropertyIdValue
Creates aPropertyIdValue.- Parameters:
id- a string of the form Pn... where n... is the string representation of a positive integer number- Returns:
- a
PropertyIdValuecorresponding to the input
-
makeLexemeIdValue
Creates anLexemeIdValue.- Parameters:
id- a string of the form Ln... where n... is the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- an
LexemeIdValuecorresponding to the input
-
makeWikidataLexemeIdValue
Creates anLexemeIdValuefor Wikidata.- Parameters:
id- a string of the form Ln... where n... is the string representation of a positive integer number- Returns:
- an
LexemeIdValuecorresponding to the input
-
makeFormIdValue
Creates anFormIdValue.- Parameters:
id- a string of the form Ln...-Fm... where n... and m... are the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- an
FormIdValuecorresponding to the input
-
makeWikidataFormIdValue
Creates anFormIdValuefor Wikidata.- Parameters:
id- a string of the form Ln...-F... where n... and m... are the string representation of a positive integer number- Returns:
- an
FormIdValuecorresponding to the input
-
makeSenseIdValue
Creates anSenseIdValue.- Parameters:
id- a string of the form Ln...-Sm... where n... and m... are the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- an
SenseIdValuecorresponding to the input
-
makeWikidataSenseIdValue
Creates anSenseIdValuefor Wikidata.- Parameters:
id- a string of the form Ln...-S... where n... and m... are the string representation of a positive integer number- Returns:
- an
SenseIdValuecorresponding to the input
-
makeMediaInfoIdValue
Creates anMediaInfoIdValue.- Parameters:
id- a string of the form Mn... where n... is the string representation of a positive integer numbersiteIri- IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/"- Returns:
- an
MediaInfoIdValuecorresponding to the input
-
makeWikimediaCommonsMediaInfoIdValue
Creates anMediaInfoIdValuefor Wikimedia Commons.- Parameters:
id- a string of the form Mn... where n... is the string representation of a positive integer number- Returns:
- an
MediaInfoIdValuecorresponding to the input
-
makeDatatypeIdValue
Deprecated.Creates aDatatypeIdValue. The datatype IRI is usually one of the constants defined inDatatypeIdValue, but this is not enforced, since there might be extensions that provide additional types.- Parameters:
id- the IRI string that identifies the datatype- Returns:
- a
DatatypeIdValuecorresponding to the input
-
makeDatatypeIdValueFromJsonString
Creates aDatatypeIdValue. The string is an identifier used in the JSON serialization of properties to identify the datatype, and is one of the constants defined inDatatypeIdValue, but this is not enforced, since there are extensions that provide additional types.- Parameters:
jsonString- the string that identifies the datatype- Returns:
- a
DatatypeIdValuecorresponding to the input
-
makeTimeValue
public static TimeValue makeTimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String calendarModel) Creates aTimeValue.- Parameters:
year- a year number, where 0 refers to 1BCEmonth- a month number between 1 and 12day- a day number between 1 and 31hour- an hour number between 0 and 23minute- a minute number between 0 and 59second- a second number between 0 and 60 (possible leap second)precision- a value in the range ofTimeValue.PREC_DAY, ...,TimeValue.PREC_1GYbeforeTolerance- non-negative integer tolerance before the value; seeTimeValue.getBeforeTolerance()afterTolerance- non-zero, positive integer tolerance before the value; seeTimeValue.getAfterTolerance()timezoneOffset- offset in minutes that should be applied when displaying this timecalendarModel- the IRI of the calendar model preferred when displaying the date; usuallyTimeValue.CM_GREGORIAN_PROorTimeValue.CM_JULIAN_PRO- Returns:
- a
TimeValuecorresponding to the input
-
makeTimeValue
public static TimeValue makeTimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, int timezoneOffset, String calendarModel) Creates aTimeValuefor a given date and time. The precision is automatically set toTimeValue.PREC_SECOND.- Parameters:
year- a year number, where 0 refers to 1BCEmonth- a month number between 1 and 12day- a day number between 1 and 31hour- an hour number between 0 and 23minute- a minute number between 0 and 59second- a second number between 0 and 60 (possible leap second)timezoneOffset- offset in minutes that should be applied when displaying this timecalendarModel- the IRI of the calendar model preferred when displaying the date; usuallyTimeValue.CM_GREGORIAN_PROorTimeValue.CM_JULIAN_PRO- Returns:
- a
TimeValuecorresponding to the input
-
makeTimeValue
Creates aTimeValuefor a given date. The precision is automatically set toTimeValue.PREC_DAY.- Parameters:
year- a year number, where 0 refers to 1BCEmonth- a month number between 1 and 12day- a day number between 1 and 31calendarModel- the IRI of the calendar model preferred when displaying the date; usuallyTimeValue.CM_GREGORIAN_PROorTimeValue.CM_JULIAN_PRO- Returns:
- a
TimeValuecorresponding to the input
-
makeGlobeCoordinatesValue
public static GlobeCoordinatesValue makeGlobeCoordinatesValue(double latitude, double longitude, double precision, String globeIri) Creates aGlobeCoordinatesValue.- Parameters:
latitude- the latitude of the coordinates in degreeslongitude- the longitude of the coordinates in degreesprecision- the precision of the coordinates in degreesglobeIri- IRI specifying the celestial objects of the coordinates- Returns:
- a
GlobeCoordinatesValuecorresponding to the input
-
makeStringValue
Creates aStringValue.- Parameters:
string-- Returns:
- a
StringValuecorresponding to the input
-
makeMonolingualTextValue
Creates aMonolingualTextValue.- Parameters:
text- the text of the valuelanguageCode- the language code of the value- Returns:
- a
MonolingualTextValuecorresponding to the input
-
makeQuantityValue
public static QuantityValue makeQuantityValue(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit) Creates aQuantityValue.- Parameters:
numericValue- the numeric value of this quantitylowerBound- the lower bound of the numeric value of this quantityupperBound- the upper bound of the numeric value of this quantityunit- the unit identifier to use for this quantity- Returns:
- a
QuantityValuecorresponding to the input
-
makeQuantityValue
Creates aQuantityValuewithout bounds.- Parameters:
numericValue- the numeric value of this quantityunit- the unit identifier to use for this quantity- Returns:
- a
QuantityValuecorresponding to the input
-
makeQuantityValue
public static QuantityValue makeQuantityValue(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound) Creates aQuantityValuewith an empty unit.- Parameters:
numericValue- the numeric value of this quantitylowerBound- the lower bound of the numeric value of this quantityupperBound- the upper bound of the numeric value of this quantity- Returns:
- a
QuantityValuecorresponding to the input
-
makeQuantityValue
Creates aQuantityValuewith an empty unit and without bounds.- Parameters:
numericValue- the numeric value of this quantity- Returns:
- a
QuantityValuecorresponding to the input
-
makeQuantityValue
Creates aQuantityValuefrom long numbers.- Parameters:
numericValue- the numeric value of this quantitylowerBound- the lower bound of the numeric value of this quantityupperBound- the upper bound of the numeric value of this quantity- Returns:
- a
QuantityValuecorresponding to the input
-
makeValueSnak
Creates aValueSnak.- Parameters:
propertyId-value-- Returns:
- a
ValueSnakcorresponding to the input
-
makeSomeValueSnak
Creates aSomeValueSnak.- Parameters:
propertyId-- Returns:
- a
SomeValueSnakcorresponding to the input
-
makeNoValueSnak
Creates aNoValueSnak.- Parameters:
propertyId-- Returns:
- a
NoValueSnakcorresponding to the input
-
makeSnakGroup
Creates aSnakGroup.- Parameters:
snaks- a non-empty list of snaks that use the same property- Returns:
- a
SnakGroupcorresponding to the input
-
makeClaim
Creates aClaim. It might be more convenient to usemakeStatement(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue, org.wikidata.wdtk.datamodel.interfaces.Snak, java.util.List<org.wikidata.wdtk.datamodel.interfaces.SnakGroup>, java.util.List<org.wikidata.wdtk.datamodel.interfaces.Reference>, org.wikidata.wdtk.datamodel.interfaces.StatementRank, java.lang.String)directly if you want to build a statement.- Parameters:
subject- the subject the Statement refers tomainSnak- the main Snak of the Statementqualifiers- the qualifiers of the Statement, grouped in SnakGroups- Returns:
- a
Claimcorresponding to the input
-
makeReference
Creates aReference. It might be more convenient to use theReferenceBuilderinstead.- Parameters:
snakGroups- list of snak groups- Returns:
- a
Referencecorresponding to the input
-
makeStatement
public static Statement makeStatement(EntityIdValue subject, Snak mainSnak, List<SnakGroup> qualifiers, List<Reference> references, StatementRank rank, String statementId) Creates aStatement. It might be more convenient to use theStatementBuilderinstead.The string id 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.
- Parameters:
subject- the subject the Statement refers tomainSnak- the main Snak of the Statementqualifiers- the qualifiers of the Statement, grouped in SnakGroupsreferences- the references for the Statementrank- the rank of the StatementstatementId- the string id of the Statement- Returns:
- a
Statementcorresponding to the input
-
makeStatement
public static Statement makeStatement(Claim claim, List<Reference> references, StatementRank rank, String statementId) Creates aStatement. It might be more convenient to use theStatementBuilderinstead.The string id 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.
- Parameters:
claim- the main claim the Statement refers toreferences- the references for the Statementrank- the rank of the StatementstatementId- the string id of the Statement- Returns:
- a
Statementcorresponding to the input
-
makeStatementGroup
Creates aStatementGroup.- Parameters:
statements- a non-empty list of statements that use the same subject and main-snak property in their claim- Returns:
- a
StatementGroupcorresponding to the input
-
makeSiteLink
Creates aSiteLink.- Parameters:
title- the title string of the linked page, including namespace prefixes if anysiteKey- the string key of the site of the linked articlebadges- the list of badges of the linked article- Returns:
- a
SiteLinkcorresponding to the input
-
makeSiteLink
Creates aSiteLinkwithout badges.- Parameters:
title- the title string of the linked page, including namespace prefixes if anysiteKey- the string key of the site of the linked article- Returns:
- a
SiteLinkcorresponding to the input
-
makePropertyDocument
public static PropertyDocument makePropertyDocument(PropertyIdValue propertyId, DatatypeIdValue datatypeId) Creates an emptyPropertyDocument.- Parameters:
propertyId- the id of the property that data is aboutdatatypeId- the datatype of that property- Returns:
- a
PropertyDocumentcorresponding to the input
-
makePropertyDocument
public static PropertyDocument makePropertyDocument(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId) Creates aPropertyDocumentwith empty revision id. It might be more convenient to use thePropertyDocumentBuilderinstead.- Parameters:
propertyId- the id of the property that data is aboutlabels- the list of labels of this property, with at most one label for each language codedescriptions- the list of descriptions of this property, with at most one description for each language codealiases- the list of aliases of this propertystatementGroups- the list of statement groups of this item; all of them must have the given itemIdValue as their subjectdatatypeId- the datatype of that property- Returns:
- a
PropertyDocumentcorresponding to the input
-
makePropertyDocument
public static PropertyDocument makePropertyDocument(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId, long revisionId) Creates aPropertyDocument. It might be more convenient to use thePropertyDocumentBuilderinstead.- Parameters:
propertyId- the id of the property that data is aboutlabels- the list of labels of this property, with at most one label for each language codedescriptions- the list of descriptions of this property, with at most one description for each language codealiases- the list of aliases of this propertystatementGroups- the list of statement groups of this item; all of them must have the given itemIdValue as their subjectdatatypeId- the datatype of that propertyrevisionId- the revision ID or 0 if not known; seeEntityDocument.getRevisionId()- Returns:
- a
PropertyDocumentcorresponding to the input
-
makeItemDocument
Creates an emptyItemDocument.- Parameters:
itemIdValue- the id of the item that data is about- Returns:
- an
ItemDocumentcorresponding to the input
-
makeItemDocument
public static ItemDocument makeItemDocument(ItemIdValue itemIdValue, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, Map<String, SiteLink> siteLinks) Creates anItemDocumentwith empty revision id. It might be more convenient to use theItemDocumentBuilderinstead.- Parameters:
itemIdValue- 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 itemstatementGroups- the list of statement groups of this item; all of them must have the given itemIdValue as their subjectsiteLinks- the sitelinks of this item by site key- Returns:
- an
ItemDocumentcorresponding to the input
-
makeItemDocument
public static ItemDocument makeItemDocument(ItemIdValue itemIdValue, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, Map<String, SiteLink> siteLinks, long revisionId) Creates anItemDocument. It might be more convenient to use theItemDocumentBuilderinstead.- Parameters:
itemIdValue- 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 itemstatementGroups- the list of statement groups of this item; all of them must have the given itemIdValue as their subjectsiteLinks- the sitelinks of this item by site keyrevisionId- the revision ID or 0 if not known; seeEntityDocument.getRevisionId()- Returns:
- an
ItemDocumentcorresponding to the input
-
makeLexemeDocument
public static LexemeDocument makeLexemeDocument(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas) Creates an emptyLexemeDocument.- Parameters:
lexemeIdValue- the id of the lexeme that data is aboutlexicalCategory- the lexical category to which the lexeme belongs (noun, verb...)language- the language to which the lexeme belongs (French, British English...)lemmas- the human readable representations of the lexeme- Returns:
- a
LexemeDocumentcorresponding to the input
-
makeLexemeDocument
public static LexemeDocument makeLexemeDocument(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas, List<StatementGroup> statementGroups, List<FormDocument> forms, List<SenseDocument> senses) Creates aLexemeDocument.- Parameters:
lexemeIdValue- the id of the lexeme that data is aboutlexicalCategory- the lexical category to which the lexeme belongs (noun, verb...)language- the language to which the lexeme belongs (French, British English...)lemmas- the human readable representations of the lexemestatementGroups- the list of statement groups of this lexeme; all of them must have the given lexemeIdValue as their subjectforms- the forms of the lexemesenses- the senses of the lexeme- Returns:
- a
LexemeDocumentcorresponding to the input
-
makeFormDocument
public static FormDocument makeFormDocument(FormIdValue formIdValue, List<MonolingualTextValue> representations, List<ItemIdValue> grammaticalFeatures, List<StatementGroup> statementGroups) Creates aFormDocument. If you plan to add this form to a specific lexeme, it might be easier to useLexemeDocument.createForm(List).- Parameters:
formIdValue- the id of the form that data is aboutrepresentations- the list of representations of this lexeme, with at most one lemma for each language codegrammaticalFeatures- the grammatical features of the lexemestatementGroups- the list of statement groups of this lexeme; all of them must have the given lexemeIdValue as their subject- Returns:
- a
LexemeDocumentcorresponding to the input
-
makeSenseDocument
public static SenseDocument makeSenseDocument(SenseIdValue senseIdValue, List<MonolingualTextValue> glosses, List<StatementGroup> statementGroups) Creates aSenseDocument. If you plan to add this sense to a specific lexeme, it might be easier to useLexemeDocument.createSense(List))}.- Parameters:
senseIdValue- the id of the form that data is aboutglosses- the list of glosses of this lexeme, with at most one gloss for each language codestatementGroups- the list of statement groups of this lexeme; all of them must have the given lexemeIdValue as their subject- Returns:
- a
SenseDocumentcorresponding to the input
-
makeMediaInfoDocument
Creates an emptyMediaInfoDocument.- Parameters:
mediaInfoIdValue- the id of the media that data is about- Returns:
- an
MediaInfoDocumentcorresponding to the input
-
makeMediaInfoDocument
public static MediaInfoDocument makeMediaInfoDocument(MediaInfoIdValue mediaInfoIdValue, List<MonolingualTextValue> labels, List<StatementGroup> statementGroups) Creates aMediaInfoDocument.- Parameters:
mediaInfoIdValue- the id of the media that data is aboutlabels- the list of labels of this media, with at most one label for each language codestatementGroups- the list of statement groups of this media info; all of them must have the given mediaInfoIdValue as their subject- Returns:
- an
MediaInfoDocumentcorresponding to the input
-
makeTermUpdate
public static TermUpdate makeTermUpdate(Collection<MonolingualTextValue> modified, Collection<String> removed) Creates newTermUpdate. It might be more convenient to useTermUpdateBuilder.- Parameters:
modified- added or changed valuesremoved- language codes of removed values- Returns:
- new
TermUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeAliasUpdate
public static AliasUpdate makeAliasUpdate(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdate. Callers should specify eitherrecreatedparameter oraddedandremovedparameters, because combination of the two update approaches is not possible. To remove all aliases, pass empty list inrecreatedparameter.In most cases, it is more convenient to use
makeAliasUpdate(List),makeAliasUpdate(List, Collection), orAliasUpdateBuilder.- Parameters:
recreated- new list of aliases that completely replaces the old ones ornullto not recreate aliasesadded- aliases added in this update or empty collection for no additionsremoved- aliases removed in this update or empty collection for no removals- Returns:
- new
AliasUpdate - Throws:
NullPointerException- ifadded,removed, or any alias isnullIllegalArgumentException- if given invalid combination of parameters
-
makeAliasUpdate
Creates newAliasUpdatethat completely replaces all aliases.- Parameters:
recreated- new list of aliases that completely replaces the old ones- Returns:
- new
AliasUpdate - Throws:
NullPointerException- if the parameter or any alias isnullIllegalArgumentException- if language codes are inconsistent or there are alias duplicates
-
makeAliasUpdate
public static AliasUpdate makeAliasUpdate(List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdatethat adds and/or removes some of the aliases. It might be more convenient to useAliasUpdateBuilder.- Parameters:
added- aliases to addremoved- aliases to remove- Returns:
- new
AliasUpdate - Throws:
NullPointerException- if any parameter or any alias isnullIllegalArgumentException- if language codes are inconsistent or there are alias duplicates
-
makeStatementUpdate
public static StatementUpdate makeStatementUpdate(Collection<Statement> added, Collection<Statement> replaced, Collection<String> removed) Creates newStatementUpdate. It might be more convenient to useStatementUpdateBuilder.- Parameters:
added- added statementsreplaced- replaced statementsremoved- IDs of removed statements- Returns:
- new
StatementUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeSenseUpdate
public static SenseUpdate makeSenseUpdate(SenseIdValue entityId, long revisionId, TermUpdate glosses, StatementUpdate statements) Creates newSenseUpdate. It might be more convenient to useSenseUpdateBuilder.- Parameters:
entityId- ID of the sense that is to be updatedrevisionId- base sense revision to be updated or zero if not availableglosses- changes in sense glosses ornullfor no changestatements- changes in entity statements, possibly empty- Returns:
- new
SenseUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeFormUpdate
public static FormUpdate makeFormUpdate(FormIdValue entityId, long revisionId, TermUpdate representations, Collection<ItemIdValue> grammaticalFeatures, StatementUpdate statements) Creates newFormUpdate. It might be more convenient to useFormUpdateBuilder.- Parameters:
entityId- ID of the form that is to be updatedrevisionId- base form revision to be updated or zero if not availablerepresentations- changes in form representations ornullfor no changegrammaticalFeatures- new grammatical features of the form ornullfor no changestatements- changes in entity statements, possibly empty- Returns:
- new
FormUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeLexemeUpdate
public static LexemeUpdate makeLexemeUpdate(LexemeIdValue entityId, long revisionId, ItemIdValue language, ItemIdValue lexicalCategory, TermUpdate lemmas, StatementUpdate statements, Collection<SenseDocument> addedSenses, Collection<SenseUpdate> updatedSenses, Collection<SenseIdValue> removedSenses, Collection<FormDocument> addedForms, Collection<FormUpdate> updatedForms, Collection<FormIdValue> removedForms) Creates newLexemeUpdate. It might be more convenient to useLexemeUpdateBuilder.- Parameters:
entityId- ID of the lexeme that is to be updatedrevisionId- base lexeme revision to be updated or zero if not availablelanguage- new lexeme language ornullfor no changelexicalCategory- new lexical category of the lexeme ornullfor no changelemmas- changes in lemmas ornullfor no changestatements- changes in entity statements, possibly emptyaddedSenses- added sensesupdatedSenses- updated sensesremovedSenses- IDs of removed sensesaddedForms- added formsupdatedForms- updated formsremovedForms- IDs of removed forms- Returns:
- new
LexemeUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeMediaInfoUpdate
public static MediaInfoUpdate makeMediaInfoUpdate(MediaInfoIdValue entityId, long revisionId, TermUpdate labels, StatementUpdate statements) Creates newMediaInfoUpdate. It might be more convenient to useMediaInfoUpdateBuilder.- Parameters:
entityId- ID of the media that is to be updatedrevisionId- base media revision to be updated or zero if not availablelabels- changes in entity labels ornullfor no changestatements- changes in entity statements, possibly empty- Returns:
- new
MediaInfoUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeItemUpdate
public static ItemUpdate makeItemUpdate(ItemIdValue entityId, long revisionId, TermUpdate labels, TermUpdate descriptions, Map<String, AliasUpdate> aliases, StatementUpdate statements, Collection<SiteLink> modifiedSiteLinks, Collection<String> removedSiteLinks) Creates newItemUpdate. It might be more convenient to useItemUpdateBuilder.- Parameters:
entityId- ID of the item that is to be updatedrevisionId- base item revision to be updated or zero if not availablelabels- changes in entity labels ornullfor no changedescriptions- changes in entity descriptions ornullfor no changealiases- changes in entity aliases, possibly emptystatements- changes in entity statements, possibly emptymodifiedSiteLinks- added or replaced site linksremovedSiteLinks- site keys of removed site links- Returns:
- new
ItemUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makePropertyUpdate
public static PropertyUpdate makePropertyUpdate(PropertyIdValue entityId, long revisionId, TermUpdate labels, TermUpdate descriptions, Map<String, AliasUpdate> aliases, StatementUpdate statements) Creates newPropertyUpdate. It might be more convenient to usePropertyUpdateBuilder.- Parameters:
entityId- ID of the property entity that is to be updatedrevisionId- base property revision to be updated or zero if not availablelabels- changes in entity labels ornullfor no changedescriptions- changes in entity descriptions ornullfor no changealiases- changes in entity aliases, possibly emptystatements- changes in entity statements, possibly empty- Returns:
- new
PropertyUpdate - Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if any parameters or their combination is invalid
-
makeDatatypeIdValueFromJsonString(String)