WikidataData[item,property]
gives the values of the specified property for the given item.
WikidataData[{item1,item2,…},property]
gives values for each of the itemi.
WikidataData[item,{property1,property2,…}]
gives values for each of the propertyi.
WikidataData[items,properties]
gives values for each of the properties for each of the items.
WikidataData
WikidataData[item,property]
gives the values of the specified property for the given item.
WikidataData[{item1,item2,…},property]
gives values for each of the itemi.
WikidataData[item,{property1,property2,…}]
gives values for each of the propertyi.
WikidataData[items,properties]
gives values for each of the properties for each of the items.
Details and Options
- WikidataData retrieves data from Wikidata's SPARQL endpoint.
- Each item and property can be specified as an ExternalIdentifier object, a URL or a raw Wikidata identifier like "Q15241057" or "P31".
- Raw Wikidata identifiers are conventionally of the form "Qnnn" for items and "Pnnn" for properties.
- The following properties are also supported:
-
"Label" the label of the item "Description" the description of the item "AlternativeLabels" alternate labels of the item "WikidataID" the ExternalIdentifier["WikidataID",…] object corresponding to the item "Entity" entities corresponding to the item - Any type from $ExternalIdentifierTypes can be used as a property to request an ExternalIdentifier object of the specified type.
- WikidataData[item,"Properties"] gives a list of all available properties for the specified item. Named subsets of available properties can be obtained with WikidataData[item,"sname"]. Possible values for "sname" include:
-
"IdentifierProperties" external identifier properties "NonIdentifierProperties" all properties excluding external identifier properties - An item can also be specified as Entity[…].
- An implicit list of items can be specified as EntityClass[type,{prop1vspec1,…}], where type is an entity type or an ExternalIdentifier object, the propi are EntityProperty or ExternalIdentifier objects, and the vspeci are values or Boolean operators.
- Supported Boolean operators include:
-
EqualTo[x] the value is equal to x UnequalTo[x] the value is unequal to x GreaterThan[x] the value is greater than x GreaterEqualThan[x] the value is greater than or equal to x LessThan[x] the value is less than x LessEqualThan[x] the value is less than or equal to x Between[{min,max}] the value is between min and max MissingQ there is no value for this property Not@*MissingQ there is a value for this property - EntityClass[type,rules] containing a single rule of the form propTakeLargest[n] or propTakeSmallest[n] is also supported.
- WikidataData[itemspec,propspec] returns lists for each value, one additional level if itemspec is a list or is list-like and one additional level if propspec is a list or is list-like.
- WikidataData[itemspec,propspec,"format"] can be used to modify the result format. Possible values for "format" include:
-
"Dataset" a Dataset in which the lowest level keys are the specified items and the second-lowest level keys are the specified properties "Association" a nested association in which the lowest level keys are the specified items and the selcond-lowest level keys are the specified properties - WikidataData[itemspec,pclass,"format"] includes all available properties from the specified property class pclass for each specified item. Possible value for pclass include:
-
All all properties "IdentifierProperties" external identifier properties "NonIdentifierProperties" all properties excluding external identifier properties - The short form WikidataData[itemspec,"format"] is equivalent to WikidataData[itemspec,All,"format"].
- The following options can be given:
-
Language $Language what language to use Method Automatic which statements to select and which information to include in each statement - The setting for Language affects the "Label" and "Description" values of returned ExternalIdentifier objects.
- In Method{opt1val1,…}, the following suboptions opti can be given:
-
"StatementFormat" "Value" what infromation to include for each statement "StatementRank" "Best" which statements to include - Settings for "StatementFormat" include:
-
"Value" the value (default) "Association" an association including the value, qualifiers and references "Dataset" a Dataset including the value, qualifiers and references {"format","opt1"val1,…} suboptions controlling what to include in an association or a dataset All an association including the value, qualifiers and references - The following suboptions can be given:
-
"IncludeQualifiers" Automatic whether to include qualifiers "IncludeReferences" Automatic whether to include references - Settings for "StatementRank" include:
-
"Best" either normal-rank statements, if no preferred statement is available, or preferred statements otherwise (default) "Preferred" preferred statements "Normal" normal-rank statements "Deprecated" deprecated statements "NonDeprecated" normal-rank or preferred statements All all statements
Examples
open all close allBasic Examples (3)
Look up the mass of the Moon according to Wikidata:
WikidataData[ExternalIdentifier["WikidataID", "Q405", <|"Label" -> "Moon", "Description" -> "only natural satellite of Earth"|>], ExternalIdentifier["WikidataID", "P2067", <|"Label" -> "mass", "Description" -> "mass (in colloquial usage also known as weight) of the item"|>]]Look up properties available for an item:
WikidataData[ExternalIdentifier["WikidataID", "Q937", <|"Label" -> "Albert Einstein", "Description" -> "German-born physicist and founder of the theory of relativity"|>], "NonIdentifierProperties"]//ShallowRetrieve values for multiple properties:
WikidataData[ExternalIdentifier["WikidataID", "Q937", <|"Label" -> "Albert Einstein", "Description" -> "German-born physicist and founder of the theory of relativity"|>], {ExternalIdentifier["WikidataID", "P1066", <|"Label" -> "student of", "Description" -> "person who has taught this person"|>], ExternalIdentifier["WikidataID", "P19", <|"Label" -> "place of birth", "Description" -> "most specific known (e.g. city instead of country, or hospital instead of city) birth location of a person, animal or fictional character"|>]}]Retrieve all data available for an Entity and make a Dataset:
WikidataData[Entity["City", {"Munich", "Bavaria", "Germany"}], "Dataset"]Scope (2)
Look up data about a book specified by an ISBN:
WikidataData[ExternalIdentifier["ISBN10", "0-7167-0344-0"], {ExternalIdentifier["WikidataID", "P1476", <|"Label" -> "title", "Description" -> "published title of a work, such as a newspaper article, a literary work, a website, or a performance work"|>], ExternalIdentifier["WikidataID", "P50", <|"Label" -> "author", "Description" -> "main creator(s) of a written work (use on works, not humans); use P2093 when Wikidata item is unknown or does not exist"|>], ExternalIdentifier["WikidataID", "P577", <|"Label" -> "publication date", "Description" -> "date or point in time when a work was first published or released"|>], ExternalIdentifier["WikidataID", "P921", <|"Label" -> "main subject", "Description" -> "primary topic of a work (see also P180: depicts)"|>]}, "Association"]Specify a class of lakes using an implicit EntityClass:
lakes = EntityClass["Lake", {EntityProperty["Lake", "Countries"] -> Entity["Country", "Germany"], EntityProperty["Lake", "SurfaceArea"] -> TakeLargest[5]}];Retrieve the surface area for each lake:
Median /@ WikidataData[lakes, EntityProperty["Lake", "SurfaceArea"], "Association"]Options (3)
Language (1)
Look up the label and description of a Wikidata item in the default language:
WikidataData["Q25269", {"Label", "Description"}]The default language is given by $Language:
$LanguageLook up the label and description in Spanish:
WikidataData["Q25269", {"Label", "Description"}, Language -> Entity["Language", "Spanish::77gfp"]]Method (2)
Look up the visitors per year of the Smithsonian:
WikidataData[ExternalIdentifier["WikidataID", "Q131626", <|"Label" -> "Smithsonian Institution", "Description" -> "group of museums and research centers administered by the United States government"|>], ExternalIdentifier["WikidataID", "P1174", <|"Label" -> "visitors per year", "Description" -> "number of people visiting a location or an event each year"|>]]Return an association including qualifiers and excluding references:
WikidataData[ExternalIdentifier["WikidataID", "Q131626", <|"Label" -> "Smithsonian Institution", "Description" -> "group of museums and research centers administered by the United States government"|>], ExternalIdentifier["WikidataID", "P1174", <|"Label" -> "visitors per year", "Description" -> "number of people visiting a location or an event each year"|>], Method -> {"StatementFormat" -> {"Association", "IncludeQualifiers" -> True, "IncludeReferences" -> False}}]By default, only values of best rank are returned:
WikidataData[ExternalIdentifier["WikidataID", "Q1", <|"Label" -> "Universe", "Description" -> "totality consisting of space, time, mass and energy"|>], ExternalIdentifier["WikidataID", "P1419", <|"Label" -> "shape", "Description" -> "shape of an object"|>]]Include any non-deprecated value:
WikidataData[ExternalIdentifier["WikidataID", "Q1", <|"Label" -> "Universe", "Description" -> "totality consisting of space, time, mass and energy"|>], ExternalIdentifier["WikidataID", "P1419", <|"Label" -> "shape", "Description" -> "shape of an object"|>], Method -> {"StatementRank" -> "NonDeprecated"}]Include all values, including deprecated ones:
WikidataData[ExternalIdentifier["WikidataID", "Q1", <|"Label" -> "Universe", "Description" -> "totality consisting of space, time, mass and energy"|>], ExternalIdentifier["WikidataID", "P1419", <|"Label" -> "shape", "Description" -> "shape of an object"|>], Method -> {"StatementRank" -> All}]Applications (1)
Retrieve life expectancy data, including references and date qualifiers:
lifeExp = WikidataData[{ExternalIdentifier["WikidataID", "Q298", <|"Label" -> "Chile", "Description" -> "republic in South America"|>], ExternalIdentifier["WikidataID", "Q414", <|"Label" -> "Argentina", "Description" -> "federal republic in South America"|>], ExternalIdentifier["WikidataID", "Q77", <|"Label" -> "Uruguay", "Description" -> "republic in South America"|>]}, ExternalIdentifier["WikidataID", "P2250", <|"Label" -> "life expectancy", "Description" -> "life expectancy for this group or species"|>], "Association", Method -> {"StatementRank" -> "NonDeprecated", "StatementFormat" -> All}];Create TimeSeries objects for values claimed by UNESCO:
TimeSeries /@ Cases[KeyValuePattern[{
"References" -> _ ? (MemberQ[
KeyValuePattern[ExternalIdentifier["WikidataID", "P248", <|"Label" -> "stated in", "Description" -> "to be used in the references field to refer to the information document or database in which a claim is made; for qualifiers use P805; for the type of document in which a claim is made use P3865"|>] -> {ExternalIdentifier["WikidataID", "Q3152127", <|"Label" -> "UNESCO Institute for Statistics", "Description" -> "international organization"|>]}]]),
ExternalIdentifier["WikidataID", "P585", <|"Label" -> "point in time", "Description" -> "date something took place, existed or a statement was true; for providing time use the \"refine date\" property (P4241)"|>] -> {date_},
"Value" -> value_
}] :> {date, value}] /@ lifeExpDateListPlot[%]Related Guides
History
Text
Wolfram Research (2020), WikidataData, Wolfram Language function, https://reference.wolfram.com/language/ref/WikidataData.html.
CMS
Wolfram Language. 2020. "WikidataData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WikidataData.html.
APA
Wolfram Language. (2020). WikidataData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WikidataData.html
BibTeX
@misc{reference.wolfram_2026_wikidatadata, author="Wolfram Research", title="{WikidataData}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/WikidataData.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_wikidatadata, organization={Wolfram Research}, title={WikidataData}, year={2020}, url={https://reference.wolfram.com/language/ref/WikidataData.html}, note=[Accessed: 13-June-2026]}