Questions tagged [wikidata-query-service]

Wikidata Query Service (WDQS) is a SPARQL endpoint that allows to publicly access to Wikidata's database.

Wikidata Query Service (WDQS) is a SPARQL public endpoint that allows to access to Wikidata's database.

It is accessible via:

Further documentation:

160 questions
7
votes
3 answers

How to integrate Wikidata query in python

I am currently using Wikidata Query Service to run my Wikidata queries. For example, one of my Wikidata queries looks as follows. SELECT ?sLabel { SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "EntitySearch". …
EmJ
  • 4,398
  • 9
  • 44
  • 105
6
votes
1 answer

Getting the creation date of a page on Wikidata Query Service

I'm looking for a way to get all the movies on English Wikipedia, with their creation date. A movie for me is a page with IMDB ID attached to it. So, this is my query so far: SELECT DISTINCT ?item_label ?imdb_id (year(?dateCreation) as…
Binyamin Even
  • 3,318
  • 1
  • 18
  • 45
6
votes
2 answers

SPARQL query including a subquery on Wikidata gives unexpected results

I know the following SPARQL against Wikidata SPARQL Endpoint query is senseless. A similar query is automatically generated from within my application. Please disregard the conceptual soundness, and let's dig into this strange (for me at least)…
Median Hilal
  • 1,483
  • 9
  • 17
6
votes
1 answer

Some cities aren't instances of city or big city? Odd behaviour of Wikidata

While examining the results of the official example query "Continents, countries, regions and capitals" (on https://query.wikidata.org/, limited to Germany for your convenience here: link), I noticed that some capitals of German federal states were…
Leif
  • 2,143
  • 2
  • 15
  • 26
6
votes
3 answers

How to get Wikipedia page id from Wikidata id?

I want to get the Wikipedia page id from the Wikidata id, how can I get it from the Wikidata Query Service or other methods with python? Because I do not see any attribute in wikidata called something like wikipedia id.
Yue Cao
  • 61
  • 1
  • 3
5
votes
1 answer

Fetching entities label data using SPARQL in Wikidata

I am using wikidata Query Service to fetch data: https://query.wikidata.org/ I have already managed to use an entity's label using 2 methods: Using wikibase label service. For example: SELECT ?spouse ?spouseLabel WHERE { wd:Q1744 wdt:P26…
Shlomi Uziel
  • 868
  • 7
  • 15
5
votes
2 answers

Access the property of a property

I have the following query, that I ran on the wikidata query service web interface: SELECT ?objectLabel ?mass WHERE { ?object wdt:P397 wd:Q525. # the object should have the sun as parent astronomical body ?object wdt:P31 ?status. ?object…
aluriak
  • 5,559
  • 2
  • 26
  • 39
4
votes
1 answer

SPARQL query gives different result as a subquery

When running the following query I get only one result as expected SELECT DISTINCT ?city ?country WHERE { FILTER (?city = wd:Q1748) . # Primary country ?city p:P17 ?c . ?c ps:P17 ?country ; wikibase:rank ?rank . FILTER NOT EXISTS {…
Bjørn RL
  • 55
  • 1
  • 6
4
votes
1 answer

Fast publication date lookup with Wikidata Query Service

Is there a way to lookup publication dates quickly in Wikidata Query Service's SPARQL to find publications of a certain date, e.g., today? I was hoping that something like this query would be quick: SELECT * WHERE { ?work wdt:P577 ?datetime . …
Finn Årup Nielsen
  • 6,130
  • 1
  • 33
  • 43
4
votes
1 answer

Wikidata Query Service, filtering for values/string that lay above/below a certain value

I made a query, that shows all items that are 'found in taxon' 'Chlamydia trachomatis D/UW-3/CX'. These items must have the Properties P644 (genomic start) and P645 (genomic end). So far this works. But then I wanted to filter these items depending…
TIlls
  • 55
  • 5
3
votes
1 answer

get all DISTINCT labels of an item

I'm trying to get all distinct labels of a Wikidata Item. I know I can get all labels of an item with the following query: SELECT DISTINCT ?team ?labels WHERE { ?team wdt:P31 wd:Q13393265. ?team rdfs:label ?labels. } LIMIT 10 Link to query But…
Hein
  • 174
  • 1
  • 10
3
votes
1 answer

Wikibase Query Service GUI configuration with namespaces

I'm trying to set up the Wikibase Query Service GUI https://github.com/wikimedia/wikidata-query-gui with a Jena-Fuseki backend. I've edited the custom-config.json file and have populated the prefixes section with the prefixes I am using: …
3
votes
2 answers

Missing data fields in Wikidata Query Service results despite items having these data

I am trying to retrieve some municipalities from Wikidata using SPARQL but several items returned have much of their fields empty despite these items having these data. I do not understand what is wrong with the query below (link to WQS). For…
JAT86
  • 997
  • 12
  • 24
3
votes
4 answers

How to authenticate to Wikimedia Commons Query Service using OAuth in Python?

I am trying to use the Wikimedia Commons Query Service[1] programmatically using Python, but am having trouble authenticating via OAuth 1. Below is a self contained Python example which does not work as expected. The expected behaviour is that a…
3
votes
0 answers

Get multiple optional properties with multiple optional qualifiers on Wikidata Query Service

I want to load the following data of specific humans with the Wikidata Query Service: properties birth date lifestyles qualifiers start times of the lifestyles end times of the lifestyles And I want exactly one row for each human in the output,…
Adrian
  • 41
  • 2
1
2 3
10 11