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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AliasUpdate
makeAliasUpdate
(List<MonolingualTextValue> recreated) Creates newAliasUpdate
that completely replaces all aliases.static AliasUpdate
makeAliasUpdate
(List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdate
that adds and/or removes some of the aliases.static AliasUpdate
makeAliasUpdate
(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdate
.static Claim
makeClaim
(EntityIdValue subject, Snak mainSnak, List<SnakGroup> qualifiers) Creates aClaim
.static DatatypeIdValue
Deprecated.static DatatypeIdValue
makeDatatypeIdValueFromJsonString
(String jsonString) Creates aDatatypeIdValue
.static FormDocument
makeFormDocument
(FormIdValue formIdValue, List<MonolingualTextValue> representations, List<ItemIdValue> grammaticalFeatures, List<StatementGroup> statementGroups) Creates aFormDocument
.static FormIdValue
makeFormIdValue
(String id, String siteIri) Creates anFormIdValue
.static FormUpdate
makeFormUpdate
(FormIdValue entityId, long revisionId, TermUpdate representations, Collection<ItemIdValue> grammaticalFeatures, StatementUpdate statements) Creates newFormUpdate
.static GlobeCoordinatesValue
makeGlobeCoordinatesValue
(double latitude, double longitude, double precision, String globeIri) Creates aGlobeCoordinatesValue
.static ItemDocument
makeItemDocument
(ItemIdValue itemIdValue) Creates an emptyItemDocument
.static ItemDocument
makeItemDocument
(ItemIdValue itemIdValue, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, Map<String, SiteLink> siteLinks) Creates anItemDocument
with empty revision id.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
.static ItemIdValue
makeItemIdValue
(String id, String siteIri) Creates anItemIdValue
.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
.static LexemeDocument
makeLexemeDocument
(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas) Creates an emptyLexemeDocument
.static LexemeDocument
makeLexemeDocument
(LexemeIdValue lexemeIdValue, ItemIdValue lexicalCategory, ItemIdValue language, List<MonolingualTextValue> lemmas, List<StatementGroup> statementGroups, List<FormDocument> forms, List<SenseDocument> senses) Creates aLexemeDocument
.static LexemeIdValue
makeLexemeIdValue
(String id, String siteIri) Creates anLexemeIdValue
.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
.static MediaInfoDocument
makeMediaInfoDocument
(MediaInfoIdValue mediaInfoIdValue) Creates an emptyMediaInfoDocument
.static MediaInfoDocument
makeMediaInfoDocument
(MediaInfoIdValue mediaInfoIdValue, List<MonolingualTextValue> labels, List<StatementGroup> statementGroups) Creates aMediaInfoDocument
.static MediaInfoIdValue
makeMediaInfoIdValue
(String id, String siteIri) Creates anMediaInfoIdValue
.static MediaInfoUpdate
makeMediaInfoUpdate
(MediaInfoIdValue entityId, long revisionId, TermUpdate labels, StatementUpdate statements) Creates newMediaInfoUpdate
.static MonolingualTextValue
makeMonolingualTextValue
(String text, String languageCode) Creates aMonolingualTextValue
.static NoValueSnak
makeNoValueSnak
(PropertyIdValue propertyId) Creates aNoValueSnak
.static PropertyDocument
makePropertyDocument
(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId) Creates aPropertyDocument
with empty revision id.static PropertyDocument
makePropertyDocument
(PropertyIdValue propertyId, List<MonolingualTextValue> labels, List<MonolingualTextValue> descriptions, List<MonolingualTextValue> aliases, List<StatementGroup> statementGroups, DatatypeIdValue datatypeId, long revisionId) Creates aPropertyDocument
.static PropertyDocument
makePropertyDocument
(PropertyIdValue propertyId, DatatypeIdValue datatypeId) Creates an emptyPropertyDocument
.static PropertyIdValue
makePropertyIdValue
(String id, String siteIri) Creates aPropertyIdValue
.static PropertyUpdate
makePropertyUpdate
(PropertyIdValue entityId, long revisionId, TermUpdate labels, TermUpdate descriptions, Map<String, AliasUpdate> aliases, StatementUpdate statements) Creates newPropertyUpdate
.static QuantityValue
makeQuantityValue
(long numericValue, long lowerBound, long upperBound) Creates aQuantityValue
from long numbers.static QuantityValue
makeQuantityValue
(BigDecimal numericValue) Creates aQuantityValue
with an empty unit and without bounds.static QuantityValue
makeQuantityValue
(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound) Creates aQuantityValue
with an empty unit.static QuantityValue
makeQuantityValue
(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit) Creates aQuantityValue
.static QuantityValue
makeQuantityValue
(BigDecimal numericValue, ItemIdValue unit) Creates aQuantityValue
without bounds.static Reference
makeReference
(List<SnakGroup> snakGroups) Creates aReference
.static SenseDocument
makeSenseDocument
(SenseIdValue senseIdValue, List<MonolingualTextValue> glosses, List<StatementGroup> statementGroups) Creates aSenseDocument
.static SenseIdValue
makeSenseIdValue
(String id, String siteIri) Creates anSenseIdValue
.static SenseUpdate
makeSenseUpdate
(SenseIdValue entityId, long revisionId, TermUpdate glosses, StatementUpdate statements) Creates newSenseUpdate
.static SiteLink
makeSiteLink
(String title, String siteKey) Creates aSiteLink
without badges.static SiteLink
makeSiteLink
(String title, String siteKey, List<ItemIdValue> badges) Creates aSiteLink
.static SnakGroup
makeSnakGroup
(List<? extends Snak> snaks) Creates aSnakGroup
.static SomeValueSnak
makeSomeValueSnak
(PropertyIdValue propertyId) Creates aSomeValueSnak
.static Statement
makeStatement
(Claim claim, List<Reference> references, StatementRank rank, String statementId) Creates aStatement
.static Statement
makeStatement
(EntityIdValue subject, Snak mainSnak, List<SnakGroup> qualifiers, List<Reference> references, StatementRank rank, String statementId) Creates aStatement
.static StatementGroup
makeStatementGroup
(List<Statement> statements) Creates aStatementGroup
.static StatementUpdate
makeStatementUpdate
(Collection<Statement> added, Collection<Statement> replaced, Collection<String> removed) Creates newStatementUpdate
.static StringValue
makeStringValue
(String string) Creates aStringValue
.static TermUpdate
makeTermUpdate
(Collection<MonolingualTextValue> modified, Collection<String> removed) Creates newTermUpdate
.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
.static TimeValue
makeTimeValue
(long year, byte month, byte day, byte hour, byte minute, byte second, int timezoneOffset, String calendarModel) Creates aTimeValue
for a given date and time.static TimeValue
makeTimeValue
(long year, byte month, byte day, String calendarModel) Creates aTimeValue
for a given date.static ValueSnak
makeValueSnak
(PropertyIdValue propertyId, Value value) Creates aValueSnak
.static FormIdValue
Creates anFormIdValue
for Wikidata.static ItemIdValue
Creates anItemIdValue
for Wikidata.static LexemeIdValue
Creates anLexemeIdValue
for Wikidata.static PropertyIdValue
Creates aPropertyIdValue
.static SenseIdValue
Creates anSenseIdValue
for Wikidata.static MediaInfoIdValue
Creates anMediaInfoIdValue
for 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
ItemIdValue
corresponding to the input
-
makeWikidataItemIdValue
Creates anItemIdValue
for Wikidata.- Parameters:
id
- a string of the form Qn... where n... is the string representation of a positive integer number- Returns:
- an
ItemIdValue
corresponding 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
PropertyIdValue
corresponding 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
PropertyIdValue
corresponding 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
LexemeIdValue
corresponding to the input
-
makeWikidataLexemeIdValue
Creates anLexemeIdValue
for Wikidata.- Parameters:
id
- a string of the form Ln... where n... is the string representation of a positive integer number- Returns:
- an
LexemeIdValue
corresponding 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
FormIdValue
corresponding to the input
-
makeWikidataFormIdValue
Creates anFormIdValue
for 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
FormIdValue
corresponding 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
SenseIdValue
corresponding to the input
-
makeWikidataSenseIdValue
Creates anSenseIdValue
for 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
SenseIdValue
corresponding 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
MediaInfoIdValue
corresponding to the input
-
makeWikimediaCommonsMediaInfoIdValue
Creates anMediaInfoIdValue
for Wikimedia Commons.- Parameters:
id
- a string of the form Mn... where n... is the string representation of a positive integer number- Returns:
- an
MediaInfoIdValue
corresponding 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
DatatypeIdValue
corresponding 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
DatatypeIdValue
corresponding 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_1GY
beforeTolerance
- 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_PRO
orTimeValue.CM_JULIAN_PRO
- Returns:
- a
TimeValue
corresponding 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 aTimeValue
for 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_PRO
orTimeValue.CM_JULIAN_PRO
- Returns:
- a
TimeValue
corresponding to the input
-
makeTimeValue
Creates aTimeValue
for 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_PRO
orTimeValue.CM_JULIAN_PRO
- Returns:
- a
TimeValue
corresponding 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
GlobeCoordinatesValue
corresponding to the input
-
makeStringValue
Creates aStringValue
.- Parameters:
string
-- Returns:
- a
StringValue
corresponding to the input
-
makeMonolingualTextValue
Creates aMonolingualTextValue
.- Parameters:
text
- the text of the valuelanguageCode
- the language code of the value- Returns:
- a
MonolingualTextValue
corresponding 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
QuantityValue
corresponding to the input
-
makeQuantityValue
Creates aQuantityValue
without bounds.- Parameters:
numericValue
- the numeric value of this quantityunit
- the unit identifier to use for this quantity- Returns:
- a
QuantityValue
corresponding to the input
-
makeQuantityValue
public static QuantityValue makeQuantityValue(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound) Creates aQuantityValue
with 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
QuantityValue
corresponding to the input
-
makeQuantityValue
Creates aQuantityValue
with an empty unit and without bounds.- Parameters:
numericValue
- the numeric value of this quantity- Returns:
- a
QuantityValue
corresponding to the input
-
makeQuantityValue
Creates aQuantityValue
from 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
QuantityValue
corresponding to the input
-
makeValueSnak
Creates aValueSnak
.- Parameters:
propertyId
-value
-- Returns:
- a
ValueSnak
corresponding to the input
-
makeSomeValueSnak
Creates aSomeValueSnak
.- Parameters:
propertyId
-- Returns:
- a
SomeValueSnak
corresponding to the input
-
makeNoValueSnak
Creates aNoValueSnak
.- Parameters:
propertyId
-- Returns:
- a
NoValueSnak
corresponding to the input
-
makeSnakGroup
Creates aSnakGroup
.- Parameters:
snaks
- a non-empty list of snaks that use the same property- Returns:
- a
SnakGroup
corresponding 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
Claim
corresponding to the input
-
makeReference
Creates aReference
. It might be more convenient to use theReferenceBuilder
instead.- Parameters:
snakGroups
- list of snak groups- Returns:
- a
Reference
corresponding 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 theStatementBuilder
instead.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
Statement
corresponding 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 theStatementBuilder
instead.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
Statement
corresponding 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
StatementGroup
corresponding 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
SiteLink
corresponding to the input
-
makeSiteLink
Creates aSiteLink
without 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
SiteLink
corresponding 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
PropertyDocument
corresponding 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 aPropertyDocument
with empty revision id. It might be more convenient to use thePropertyDocumentBuilder
instead.- 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
PropertyDocument
corresponding 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 thePropertyDocumentBuilder
instead.- 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
PropertyDocument
corresponding to the input
-
makeItemDocument
Creates an emptyItemDocument
.- Parameters:
itemIdValue
- the id of the item that data is about- Returns:
- an
ItemDocument
corresponding 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 anItemDocument
with empty revision id. It might be more convenient to use theItemDocumentBuilder
instead.- 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
ItemDocument
corresponding 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 theItemDocumentBuilder
instead.- 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
ItemDocument
corresponding 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
LexemeDocument
corresponding 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
LexemeDocument
corresponding 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
LexemeDocument
corresponding 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
SenseDocument
corresponding to the input
-
makeMediaInfoDocument
Creates an emptyMediaInfoDocument
.- Parameters:
mediaInfoIdValue
- the id of the media that data is about- Returns:
- an
MediaInfoDocument
corresponding 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
MediaInfoDocument
corresponding 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 isnull
IllegalArgumentException
- 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 eitherrecreated
parameter oradded
andremoved
parameters, because combination of the two update approaches is not possible. To remove all aliases, pass empty list inrecreated
parameter.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 ornull
to 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 isnull
IllegalArgumentException
- if given invalid combination of parameters
-
makeAliasUpdate
Creates newAliasUpdate
that 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 isnull
IllegalArgumentException
- if language codes are inconsistent or there are alias duplicates
-
makeAliasUpdate
public static AliasUpdate makeAliasUpdate(List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Creates newAliasUpdate
that 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 isnull
IllegalArgumentException
- 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 isnull
IllegalArgumentException
- 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 ornull
for no changestatements
- changes in entity statements, possibly empty- Returns:
- new
SenseUpdate
- Throws:
NullPointerException
- if any required parameter isnull
IllegalArgumentException
- 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 ornull
for no changegrammaticalFeatures
- new grammatical features of the form ornull
for no changestatements
- changes in entity statements, possibly empty- Returns:
- new
FormUpdate
- Throws:
NullPointerException
- if any required parameter isnull
IllegalArgumentException
- 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 ornull
for no changelexicalCategory
- new lexical category of the lexeme ornull
for no changelemmas
- changes in lemmas ornull
for 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 isnull
IllegalArgumentException
- 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 ornull
for no changestatements
- changes in entity statements, possibly empty- Returns:
- new
MediaInfoUpdate
- Throws:
NullPointerException
- if any required parameter isnull
IllegalArgumentException
- 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 ornull
for no changedescriptions
- changes in entity descriptions ornull
for 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 isnull
IllegalArgumentException
- 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 ornull
for no changedescriptions
- changes in entity descriptions ornull
for no changealiases
- changes in entity aliases, possibly emptystatements
- changes in entity statements, possibly empty- Returns:
- new
PropertyUpdate
- Throws:
NullPointerException
- if any required parameter isnull
IllegalArgumentException
- if any parameters or their combination is invalid
-
makeDatatypeIdValueFromJsonString(String)