Questions tagged [sparql]

SPARQL is a standardized query language for RDF and part of the Semantic Web.

Filter by
Sorted by
Tagged with
1 vote
1 answer
26 views

Query Japanese verbs and their different conjugations

I am pretty new to SPARQL, and I am trying to query Japanese verbs and their different conjugations. I am not getting any results for the optional ?pastTense, and I can not grasp why. PREFIX wikibase: ...
cyborgreptile93's user avatar
3 votes
1 answer
52 views

Wikidata SPARQL query: adding qualifiers?

I have put together this SparQL query that basically get's all the members of UK cabinets. SELECT ?personLabel ?positionLabel ?parliamentLabel ?startDate ?endDate WHERE { ?person wdt:P106 wd:Q82955; ...
Kaura's user avatar
  • 31
1 vote
1 answer
51 views

Get Wikidata Dump with countries and attributes

I'm trying to write a SPARQL-query for wikidata, returning all European countries with their most recent properties (population, area, average income, age of retirement and human development index). ...
Lunar Cultist's user avatar
0 votes
1 answer
26 views

Trying to get a qualifier to work, not sure what's wrong

I'm trying to get total assets for companies within the US, but I only want assets from the most recent year available in Wikidata. I'm using P2403 to get total assets and I'm trying to use the ...
eespie's user avatar
  • 1
1 vote
2 answers
166 views

Wikidata COUNT(*) query times out

I have a straightforward query that counts how many humans have an English Wikipedia page. prefix schema: <http://schema.org/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wd: <...
abhinavkulkarni's user avatar
1 vote
0 answers
28 views

getting the latest data about covid-19 pandemic per country with a Wikidata SPARQL query

I'm trying to extract some of the latest data about covid-19 pandemic statistics (number of cases, recoveries, point in time) per country from Wikidata using this SPARQL query: SELECT DISTINCT ?...
amine4392's user avatar
1 vote
2 answers
70 views

Fail to search a wikidata item through SPARQL

I tried to search and get the ID of a item with a certain label: Teodor Bogdanov. I can search this name successfully through wikidata website. However, I failed to do so by searching through SPARQL. ...
codelover123's user avatar
0 votes
1 answer
165 views

Find random 10 people Wikidata

Using Sparql I can find person on Wikdata by his name: SELECT distinct (SAMPLE(?image)as ?image) ?item ?itemLabel ?itemDescription (SAMPLE(?DR) as ?DR)(SAMPLE(?RIP) as ?RIP)(SAMPLE(?...
Alexan's user avatar
  • 442
2 votes
0 answers
109 views

WikiData: filter mwapi results

I am trying to write a sparql query that can retrieve all categories/items from a root and filter down only the ones that are of "human" type. Using the query below, I can retrieve all ...
webber's user avatar
  • 121
1 vote
1 answer
88 views

Wikidata reconciliation with OpenRefine—get only those subjects with English as the language flag

Leptospermum scoparium (Q1520028) has 8 common name (P1843) entries. I have data in OpenRefine reconciled to this object: How can I get only those P1843 entries that are in English? The ...
Hugh's user avatar
  • 13
0 votes
1 answer
705 views

How to get person name and other attributes from Wikidata Sparql (resolving entities)?

I have this Node.js sparql fetcher from Wikidata: next() async function next(offset = 0) { const sparql = ` SELECT ?person ?pic ?givenName ?familyName ?placeOfBirth WHERE { ?person wdt:P31 ...
Lance's user avatar
  • 387
1 vote
0 answers
37 views

Explanation for behaviour of FILTER in WDQS

I try to write a simple SPARQL query using WDQS to show some information about a city. My first attempt was to filter using a check for equality, like: SELECT ?city ?cityLabel WHERE { ?city wdt:P31/...
Michael Kremser's user avatar
1 vote
1 answer
143 views

SPARQL query to find invalid date in Wikidata

The following wikidata query lists the teams Cristiano Ronaldo played for including start and end dates. SELECT ?playerLabel ?teamLabel ?start ?end WHERE { VALUES ?player { wd:Q11571 } ?...
Wainage's user avatar
  • 111
1 vote
2 answers
416 views

Where can I find databases in .rdf or in .ttl format

I have to make web application with rdf and sparql and I need database in rdf/xml or in ttl format but I can not find. I thought about music or movies or books database but I did'nt find if you know ...
Meli's user avatar
  • 11
1 vote
0 answers
48 views

DOID , SYMP Ontology Sparql Queries

I need to extract the list of diseases, categories, bodyparts and symptoms. I've found several ontologies for that datasets. Disease ontology, symptom ontology, Bioportal and Wikipedia. But I don't ...
Freeedy's user avatar
  • 21
1 vote
0 answers
68 views

How to get List of all diseases , categories , causes and symptoms?

I am looking for a medical dataset. I Need a list of all diseases, symptoms, categories, causes, body part relations. I don't know how to get it. Actually I've found some semantic sources like DO ...
Freeedy's user avatar
  • 21
0 votes
0 answers
41 views

How to retrieve infos about creators with sparql in wikidata

I'm trying to retrieve infos about birth and death corresponding to paintors with this query, however I have an empty result if I uncomment birth and death infos. # added before 2016-10 # Recherche de ...
Ben's user avatar
  • 201
1 vote
0 answers
116 views

How can I override this «Query is malformed: Bad aggregate» error message?

I'm working with a Wikidata query: SELECT DISTINCT ?protected_area ?protected_areaLabel ?coordinate_location ?territorialEntity ?territorialEntityLabel (SAMPLE(?instance_of) AS ?instance_of) ?...
Ismael Olea's user avatar
2 votes
0 answers
22 views

Workflow to backup SPARQL Endpoint to Git repository?

We want to provide version control to a small sized Virtuoso SPARQL endpoint but the workflow we use is quite cumbersome and always generates huge diffs for blank nodes because they get new IDs every ...
Konrad Höffner's user avatar
1 vote
0 answers
42 views

SPARQL to get Wikidata items that have no P18 image but have a Commons image depicting them?

Many Commons images depict Wikidata concepts. How to find these concepts, in particular those that do not have an image (P18) property? The request should output the URIs of both the Wikidata item ...
Nicolas Raoul's user avatar
  • 8,426
1 vote
1 answer
315 views

How to get the path details between two nodes in DBpedia in SPARQL

I want to check if two DBpedia nodes have a path using; dct:subject and skos:broader properties without specifying properties For instance consider the two DBpedia nodes http://dbpedia.org/resource/...
EmJ's user avatar
  • 245
2 votes
1 answer
192 views

Does Wikidata offer inferencing/reasoning?

I would like to use RDFS level inferencing in some queries posed in the Wikidata Query Service which uses SPARQL. Does it support inferencing/reasoning? If so, in what kind? For example, is it Forward ...
pgmank's user avatar
  • 161
1 vote
2 answers
101 views

Find all Wikidata items whose image (P18) URL contains a certain word

I am trying to find all Wikidata items whose P18 property is an URL that has the word "Montage" anywhere in its filename. Example: I managed to find items by their complete P18 filename: SELECT ?...
Nicolas Raoul's user avatar
  • 8,426
1 vote
1 answer
837 views

SPARQL get all the data before it reaches timeout

I am trying to get all the city names of all countries in the world using this below query. Whenever I execute this below query it returns this message "Query timeout limit reached". Is there any ...
Karuppiah RK's user avatar
4 votes
1 answer
69 views

Find most-depicted Wikidata items that have no image

Wikimedia Commons has a new feature where a picture can have metadata saying it depicts a given Wikidata item. For instance, https://commons.wikimedia.org/wiki/File:Grandpark_Plaza.jpg depicts https:/...
Nicolas Raoul's user avatar
  • 8,426
1 vote
0 answers
43 views

How come there are missing entities in this SPARQL query?

I was interested in listing all books, so I wrote: SELECT ?book ?url WHERE { ?book wdt:P31 wd:Q571 . OPTIONAL { ?url schema:about ?book . ?url schema:inLanguage "en" . ?url schema:...
JammingThebBits's user avatar
2 votes
0 answers
113 views

SPARQL - Filter wikidata identifiers

Query below gives me all programming languages entities, with their statements. Problem is that I don't need identifiers now, but these IDs might become necessary. I was just gonna model database ...
nanquim's user avatar
  • 121
2 votes
0 answers
181 views

Wikidata SPARQL - get company entities and the location of their headquarters

I'm having trouble extracting location attributes of company HQ's. My query: finds all companies or sub-classes, and returns some basic properties such as ISIN and URL, and the Headquarter location. ...
BenP's user avatar
  • 121
3 votes
0 answers
45 views

SPARQL query to get capacity of event venues from Wikidata

I am trying to query Wikidata to find out the capacities of all event venues in specific geographic regions (US urban centers). They have this service for querying: Wikidata Query Service The answer ...
Mike's user avatar
  • 143
2 votes
0 answers
125 views

How to use wikidata property paths?

Given a term/concept, I want to decide if it belongs to computer science. For that, I am checking if the concept has a property path to computer science node. In other words, I am checking whether ...
EmJ's user avatar
  • 245
1 vote
0 answers
102 views

Wikidata SPARQL How to speed up this query?

I have come to this query, which retrieves wikipedia and wikidata info from a wikipedia title: SELECT ?wikipediaId ?wikipediaTitle ?wikidataId ?desc ?imageUrl (GROUP_CONCAT(?instanceOfS; SEPARATOR=";"...
Henrique Bruno's user avatar
1 vote
0 answers
114 views

Wikidata Sparql Getting properties from a Wikipedia generator list

I am trying to get the properties that the linked pages from a wikipedia page have. SELECT ?item ?wikipediaTitle ?target WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "en....
Henrique Bruno's user avatar
4 votes
1 answer
181 views

Wikidata Query: How to retrieve the normal (non-verbose) JSON?

We can download the results of a Wikidata Query as "JSON file" or "JSON file (verbose)" Example link of random query: http://w.wiki/WQ. I am developing a javascript software which retrieves some ...
Henrique Bruno's user avatar
1 vote
1 answer
96 views

Wikidata SPARQL get current VALUES index

I have the current SPARQL code: SELECT ?currentQid ?propQid ?targetQid WHERE { VALUES ?current {wd:Q5 wd:Q6 wd:Q7 wd:Q8 wd:Q9} VALUES ?prop {wdt:P31 wdt:P279 wdt:P361} BIND (STRAFTER(STR(?...
Henrique Bruno's user avatar
2 votes
1 answer
310 views

Wikidata SPARQL with optional qualifiers

I am trying to adapt the Mona Lisa exercise in the Wikidata SPARQL tutorial so it will show all the materials used and where they apply. If I simply do: SELECT ?painting ?paintingLabel ?material ?...
Alan Buxton's user avatar
1 vote
1 answer
104 views

Expand Wikidata SPARQL query to self-join

I have this query to get the population of cities and the country they belong to: SELECT ?city (?population as ?city_pop) ?country ?countryLabel ?continent ?continentLabel ?cityLabel WHERE { ...
philshem's user avatar
  • 17.6k
1 vote
1 answer
2k views

How to output only English labels in SPARQL query?

I don't understand why this SPARQL queries produce duplicates: SELECT DISTINCT ?WikidataItem ?itemLabel WHERE { ?WikidataItem rdfs:label ?itemLabel. ?WikidataItem ?label "Mozilla Firefox"@en. ...
sondra.kinsey's user avatar
0 votes
1 answer
67 views

Wikidata - Filter or Detect or Get incomplete date

I've the following query PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?item ?itemLabel ?dod ?dob WHERE { ?item wdt:P570 ?dod. ?item wdt:P31 wd:Q5. SERVICE wikibase:label { bd:...
Leandro Bardelli's user avatar
2 votes
1 answer
390 views

Limiting a SPARQL Query to Lastest Point in Time

I'm trying to get information on Prefectures in Japan out of Wikidata. I succeeded to read the population statement, however there are occasionally several values with different point in time fields. ...
mwil.me's user avatar
  • 123
3 votes
0 answers
76 views

(How) Was SPARQL influenced by erotetics?

Erotetics is the logic of questions and answers. The field has been developed over the last hundred years and is nicely summarized by (Wisniewski 2015). How, if at all, was SPARQL, the RDF query ...
Henry Story's user avatar
1 vote
1 answer
671 views

Get list of all wikidata properties used to link to an item

The first part of my question is, is there a SPARQL equivalent of the "What links here" link? E.g. as described at https://opendata.stackexchange.com/a/5271/20321 I tried: WHERE { ?item wdt:?...
Darren Cook's user avatar
2 votes
0 answers
53 views

Querying Sparql dataset and caching results locally

During querying LOD datasets (using Sparql queries), we could face connection or server problems. Is there a reliable strategy that helps us to get data is a reliable way ? I'm looking for a tool (in ...
Nasreddine's user avatar
3 votes
1 answer
572 views

Numerically order SPARQL results that are external identifiers but actually all numbers

I wrote this query to list Wikidata items that have an RFC identifier: SELECT ?rfcId ?itemLabel ?classLabel ?item WHERE { ?item wdt:P31 ?class. ?item wdt:P892 ?rfcId. SERVICE wikibase:label { ...
Nicolas Raoul's user avatar
  • 8,426
2 votes
1 answer
276 views

How can I query Wikidata for a label and optional image without further constraints?

I made a derivation of the cats with images example where I query for a specific cat, in particular its label and a possible image (in the web interface): SELECT ?item ?itemLabel ?pic WHERE { ...
funky-future's user avatar
3 votes
1 answer
141 views

Why does Wikidata's query interface return no results for entities with an id of Q10000001 or higher?

I have this SPARQL query to return an item's label and the url of a Wikipedia article: PREFIX schema: <http://schema.org/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?article ?...
funky-future's user avatar
6 votes
1 answer
151 views

Julian and Gregorian dates from Wikidata

How can I get the Julian birth or death date for someone who was born or died under the Julian Calendar (Isaac Newton, for example) on Wikidata using a SPARQL query? This simple query returns "4 ...
Aaron Enright's user avatar
2 votes
1 answer
149 views

Search in wikidata with specific Q code

I've this query but I can't understand why doesn't return any result. I try different versions (with link, with only code, with wd:code) but nothing seems to work. What I need is this query but ...
Leandro Bardelli's user avatar
1 vote
1 answer
245 views

Weird results in search from wikidata

I ve this query, which i want to find every instance of human with name Jose (already a first name like John, very common) in wikidata spanish, and then I get only 10 results. I believe is the way of ...
Leandro Bardelli's user avatar
2 votes
0 answers
100 views

Property and sub-property pairs

Here are some example records: https://www.wikidata.org/wiki/Q11361734 https://www.wikidata.org/wiki/Q74669 I have the following (updated) query: # Script #2 SELECT (GROUP_CONCAT( ?...
posfan12's user avatar
  • 121
2 votes
1 answer
131 views

Find all Wikidata items that use a particular P18 picture

I want to find all Wikidata items that have "Gthumb.svg" as a P18 property. Leaving aside the fact that "Gthumb.svg" may not exist on Commons and that normal P18 values have a "commons:" prefix, it ...
Nicolas Raoul's user avatar
  • 8,426