Not sure where you are stuck - it is very simple:
SELECT ?label WHERE { <http://dbpedia.org/resource/Asturias> dbpedia-owl:wikiPageExternalLink ?label }
Typically, you need to declare namespace prefixes such as rdfs: or dbpedia-owl: if you want to use them in a query, but at the DBpedia endpoint this works even without. If you want, you can declare them anyway:
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?label WHERE { <http://dbpedia.org/resource/Asturias> dbpedia-owl:wikiPageExternalLink ?label }
You can find out the full URI corresponding to the prefix by going to http://dbpedia.org/sparql and clicking on the "Namespace Prefix" in the upper right corner.
If you want to rename a variable (for example, from ?label to ?link ), follow these steps:
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?link WHERE { <http://dbpedia.org/resource/Asturias> dbpedia-owl:wikiPageExternalLink ?link }
and you should also change the "label" to "link" in the Python code, which gets the value from the JSON result.
cygri
source share