Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPARQL query to get the information of a specific uri

Tags:

sparql

dbpedia

I want to get the id (or maybe other information) of a page with a specific uri (http://dbpedia.org/page/Weight_gain). I tried these: (none of them works)

select ?id WHERE {<http://dbpedia.org/page/Weight_gain>
<http://dbpedia.org/ontology/wikiPageID> ?id}

select ?uri ?id WHERE {?uri <http://dbpedia.org/ontology/wikiPageID> ?id.
FILTER (?uri = <http://dbpedia.org/page/Weight_gain>) }

Any suggestions?

like image 692
Andisheh Keikha Avatar asked Sep 19 '25 02:09

Andisheh Keikha


1 Answers

The actual resource identifier in DBPedia is http://dbpedia.org/resource/Weight_gain. The URL you are using (with /page/ instead of /resource/) is just the URL of the HTML representation. It's not the URI you should be using in querying via SPARQL.

This should do the trick:

 SELECT ?uri ?id 
 WHERE {
     ?uri <http://dbpedia.org/ontology/wikiPageID> ?id.
     FILTER (?uri = <http://dbpedia.org/resource/Weight_gain>) 
 }

Query Result

like image 155
Jeen Broekstra Avatar answered Sep 21 '25 21:09

Jeen Broekstra