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?
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>)
}