Questions tagged [wikidata]

Wikidata is a free, collaborative, multilingual database, collecting structured data to provide support for Wikipedia, Wikimedia Commons, and the other wikis of the Wikimedia movement. One can retrieve all data using Wikidata Query Service (Wikidata SPARQL endpoint) or Wikidata API (Wikidata MediaWiki API extension). If you are completely new both to SPARQL and MediaWiki API, please consider to ask your question on opendata.stackexchange.com.

Wikidata is a free, collaboratively edited knowledge base operated by the Wikimedia Foundation. It is intended to provide a common source of certain data types (for example, birth dates) which can be used by Wikimedia projects such as Wikipedia. This is similar to the way Wikimedia Commons provides storage for media files and access to those files for all Wikimedia projects.

Concepts:

Wikidata is a document-oriented database, focused around items. Each item represents a topic (or an administrative page used to maintain Wikipedia) and is identified by a unique number, prefixed with the letter Q — for example, the item for the topic Politics is Q7163. This enables the basic information required to identify the topic the item covers to be translated without favouring any one language.

Information is added to items by creating statements. Statements take the form of key-value pairs, with each statement consisting of a property (the key) and a value linked to the property.

Wikidata statement

Further reference:

887 questions
0
votes
1 answer

Wikidata SPARQL: How to filter by date if available?

I want a list of all dial codes and postal codes of Germany, but some towns have data for old postal codes and this query returns one of them, but not the newest: SELECT DISTINCT ?item ?itemLabel ?officialName ?dialcode ?zipCode WHERE { ?item…
R2D2
  • 3
  • 1
0
votes
0 answers

Filter search in Wikidata API

I am trying to get filtered data from the Wikidata API, currently I can do a general search using this API, but now there have been specific cases where I have to filter this information, for example, I need to get a list of only authors to get the…
0
votes
2 answers

Is there a way to skip first x lines of a bz2 file in Python without calling next()?

I'm trying to read the latest Wikidata dump while skipping the first, say, 100 lines. Is there a better way to do this than calling next() repeatedly? WIKIDATA_JSON_DUMP = bz2.open('latest-all.json.bz2', 'rt') for n in range(100): …
zadrozny
  • 1,631
  • 3
  • 22
  • 27
0
votes
1 answer

Select footballers from two or more countries with SPARQL wikidata query

I'm trying to get the day of birth of all the footballers on wikipedia per country. Until now I've managed to get all the ones for one country, but I would like to get the ones on many countries at the same time, something like: SELECT ?person…
arderoma
  • 388
  • 3
  • 15
0
votes
1 answer

SPARQL - Concat values on multiple rows

I want a list of all currencies by El Salvador with their subdivision. I use this query: SELECT ?currency ?currencyLabel ?currencyIso4217 ?subdivisionLabel { ?currency wdt:P498 ?currencyIso4217 . ?currency wdt:P9059 ?subdivision . SERVICE…
NLAnaconda
  • 1,534
  • 3
  • 14
  • 38
0
votes
0 answers

Is it possible to retrieve external identifier URLs through the wikidata API or does that need SPARQL?

I'd like to retrieve the URLs of the external identifiers from wikidata entities. I found a solution using SPARQL, but I'm wondering if this is possible to do using the mediawiki API also?
0
votes
1 answer

wikidata api retrieve properties from entity (wikidata entry)

i would like to retrieve properties of a wikidata entry (eg I want to retrieve date of birth (P569) of Donald Trump (Q22686)). I tried to use wbgetentities as action but failed to retrieve more than the description of the wikidata entry. Is it…
mango123
  • 29
  • 5
0
votes
0 answers

Return cities in Wikidata SPARQL Query, similar to a Wikipedia page

I'm not sure what I'm doing wrong. I have a nice list, but not only are the cities duplicating, but I'm unsure how they're defined as cities. I would expect to see London in the results and have similar results to this Wikipedia page. These results…
Dol
  • 944
  • 3
  • 10
  • 25
0
votes
0 answers

Sparql query for searching specific label

I want a lookup service for Wikidata similiar to what DBpedia lookup (https://lookup.dbpedia.org/) is for dbpedia but for Wikidata. Because I didn't find any I try to create a query which searches the labels of Wikidata. Here is my problem. I have…
Angelos
  • 23
  • 1
  • 4
0
votes
0 answers

How do I run SPARQL-select to Wikidata from Protege?

I have a query that returns if page with such name exists in Wikidata. SELECT ?boolean WHERE{ BIND(EXISTS{?item ?label "Water"} AS ?boolean) } Now I need to run it from Protege tab SPARQL-query. What do I have to add to it to make it work? Maybe…
0
votes
0 answers

How to get a list of Wikidata entity IDs from Wikiquote

I would like to get a list of the Q-item entity IDs for every individual person who has a wikiquote page. There is not much in the way of information on how wikiquote is integrated with wikidata and I can't find a wikidata property of "has a…
aloea
  • 191
  • 1
  • 12
0
votes
0 answers

Only select shortest value for column with multiple values on Wikidata query

I have the following query: SELECT ?admin ?name ?abbr WHERE { VALUES ?admin { wd:Q771 } ?admin wdt:P131 ?country; wdt:P17 ?country. OPTIONAL { ?admin wdt:P1813 ?alias. } SERVICE wikibase:label { bd:serviceParam wikibase:language…
theberzi
  • 2,142
  • 3
  • 20
  • 34
0
votes
0 answers

Wikidata Query - Health Specialty of a Disease name

I want to query the "instance of P31" and "health specialty P115" for a disease name "left bundle branch hemiblock (Q2143688)" I want an output like : left bundle branch hemiblock (Q2143688) instance of : thoracic disease health specialty…
A Developer
  • 1,001
  • 3
  • 12
  • 32
0
votes
1 answer

SPARQL get data from list

I want to list pokemons. I am able to reach to a list(wd:Q106036966) from the Pokemon entity(Q864) on Wikidata. But I can't find the way to retrieve the data on that list. At first I thought that maybe the data wasn't added, but if I search for…
0
votes
0 answers

Getting labels/names and invert wikidata query

I'am trying to get the names of the victims, which got a "stolperstein" (stumblestone) in my hometown. But I can't get the names with SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } I think, the query should…
MySt3rY
  • 11
  • 2