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
2
votes
1 answer

Wikidata: Filter post codes only current valid

I would like to filter post codes to show only the current active for today. Problem is there are are cities with old post codes (Example). My current query shows the old post codes: SELECT ?city ?cityLabel ?postcode ?federal_stateLabel…
PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
2
votes
0 answers

Named subquery slow in Wikidata Query Service

I am wondering why the following SPARQL query with a named subquery is slow on Blazegraph instance Wikidata Query Service. Taking out the subquery and executing that alone completes in around a second on the Wikidata Query Service, while the one…
Finn Årup Nielsen
  • 6,130
  • 1
  • 33
  • 43
2
votes
1 answer

R SPARQL Wikidata: "Opening and ending tag mismatch"

My aim is to query wikidata using R. I just realized that Wikidata Query Service offers code examples in order to so: Go to https://w.wiki/AkK Execute query Click on Code next to the Download button Select R. This gives the following…
kalakaru
  • 131
  • 3
2
votes
1 answer

Wikidata federated SPARQL query and variable

In Wikidata (https://query.wikidata.org/), I tried the following simple SPARQL federated query with SERVICE. I got the results back, but they do not seem to be what I expected. It seems that ?geonamesid (i.e. reference to the entity "London") is not…
2
votes
1 answer

How to access child properties using Wikidata SPARQL Query Service?

I would like to access child properties of wikidata entities. An example may be property P1033, which is a child of P4952, for an entity such as Q49546. How can I do this dynamically in a SPARQL query? Using the query builder provided by the online…
2
votes
1 answer

wikidata query missing out countries in Europe

I am using the following query against wikidata; SELECT ?country ?countryLabel WHERE { ?country wdt:P30 wd:Q46; wdt:P31 wd:Q6256. SERVICE wikibase:label { bd:serviceParam wikibase:language …
nishant
  • 736
  • 1
  • 12
  • 22
2
votes
0 answers

Using a year's natural number value in a SPARQL query

How do I query wikidata for a list of scientists that died in a prime-numbered year, and also were born in a prime-numbered year, using SPARQL? Here is what I have so far, which returns no results, and I'm assuming that's because people don't die in…
pgblu
  • 662
  • 1
  • 7
  • 29
2
votes
0 answers

CONSTRUCT a subgraph in SPARQL with propertyPath of unknown length

I am trying to extract a subgraph from a large dataset (namely Wikidata, through their Query Service ). I have found pairs of nodes that are of my interest (uses a certain property) and now I would like to CONSTRUCT a new graph, that would contain…
jmac
  • 95
  • 8
2
votes
2 answers

How to comment/uncomment in bulk in wikidata's SPARQL gui by shortcut?

Wikidata provides a tool for query building. https://query.wikidata.org/ But I cannot find any shortcut in the editor to comment/uncomment in bulk (that is, comment/uncomment multiple lines at the same time).
Loredra L
  • 1,485
  • 2
  • 16
  • 32
2
votes
1 answer

Should xsd:date convert for datetimes before common era in SPARQL

Consider this SPARQL where datetime is a date in 36 BC: SELECT ?date ?year WHERE { wd:Q1180731 wdt:P577 ?datetime . BIND(xsd:date(?datetime) AS ?date) # BIND(YEAR(?datetime) AS ?year) } The xsd:date(?datetime) function fails on the Wikidata…
Finn Årup Nielsen
  • 6,130
  • 1
  • 33
  • 43
2
votes
0 answers

Wikidata Query Service not showing data on wikipedia page

I am new to the Wikidata Query Service. I want to find all the installed capacity of power stations. I tried the following: Wikidata Query SELECT ?power_station ?power_stationLabel ?installed_capacity WHERE { SERVICE wikibase:label {…
Sorade
  • 915
  • 1
  • 14
  • 29
2
votes
1 answer

Wikidata:SPARQL Query Service Units

How do I get unit type and date precision in the Wikidata Query service (https://query.wikidata.org) with SPARQL? Below is example query looking at dimensions and inception of tapestries. SELECT ?item ?itemLabel ?height ?width ?inception WHERE { …
2
votes
1 answer

How can get default return values for a SPARQL query when counting

I have a query where I count with a grouping on years. For some of the years there is no items to count and thus no result. I would like to have SPARQL return a count of zero for such years. I am using the Wikidata Query Service,…
Finn Årup Nielsen
  • 6,130
  • 1
  • 33
  • 43
2
votes
1 answer

Wikidata property statement and property direct

I'm trying to retrieve entities as well as their properties that relate to Golden Gate Bridge. I used this query (https://query.wikidata.org/#SELECT%20%3Fp2%20%3Fs%0AWHERE%0A%7B%0A%20%20%09%3Fs%20%3Fp2%20wd%3AQ44440%20.%0A%7D): SELECT ?p2…
al3xtouch
  • 491
  • 4
  • 19
2
votes
1 answer

SPARQL - AND & OR Filters on Literal

I am trying to understand how to do filtering in SPARQL with combined AND and OR conditions. I try to find all physicists living within Newton's lifetime via the Wikidata Query Service (query.wikidata.org). This is my query: SELECT ?p1 ?p1Label…
Paul Milde
  • 35
  • 6
1 2
3
10 11