- From: Bob DuCharme <bob@snee.com>
- Date: Thu, 04 Mar 2010 15:52:47 -0500
- To: Monika Solanki <m.solanki@mcs.le.ac.uk>
- CC: public-lod@w3.org
Monika Solanki wrote:
>I am looking for a REST based API for programmatically accessing
>DBpedia's SPARQL end point. Any pointers much appreciated.
A SPARQL endpoint is by its nature already a REST-based API. You send it
HTTP GETs, and it returns data laid out in a specific protocol
(http://www.w3.org/TR/2008/REC-rdf-sparql-protocol-20080115/).
To create the URL for the GET for DBpedia, you can escape the SPARQL
query (most programming languages have a function for this, but
http://www.xs4all.nl/~jlpoutre/BoT/Javascript/Utils/endecode.html is
nice for experiments) and append it to the following:
http://dbpedia.org/sparql?format=XML&default-graph-uri=
For example, doing this with this query
SELECT ?p ?o WHERE { <http://dbpedia.org/resource/IBM> ?p ?o }
gets you this URL, which you can paste into your browser:
http://dbpedia.org/sparql?format=XML&default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT%20%3Fp%20%3Fo%20%20%20WHERE%20%7B%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FIBM%3E%20%3Fp%20%3Fo%20%7D
Virtuoso provides the dbpedia endpoint, so you'll see more doc on this
at http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSparqlProtocol.
Or am I misunderstanding what you're looking for?
Bob
Received on Thursday, 4 March 2010 20:53:33 UTC