I am looking for tutorials on how to consume and parse data from a sparql endpoint such as DBPedia. I am new to semantic web and rdf and sparql. Would I just treat the response as XML and use one of the many third party xml parsers to read rdf input?
A link to a good tutorial for consuming sparql endpoints on the iphone would be great
DBpedia Live SPARQL Endpoint: The DBpedia-Live SPARQL Endpoint can be accessed at http://live.dbpedia.org/sparql.
A SPARQL Endpoint is a Point of Presence on an HTTP network that's capable of receiving and processing SPARQL Protocol requests. It is identified by a URL commonly referred to as a SPARQL Endpoint URL.
SPARQL (pronounced "sparkle" /ˈspɑːkəl/, a recursive acronym for SPARQL Protocol and RDF Query Language) is an RDF query language—that is, a semantic query language for databases—able to retrieve and manipulate data stored in Resource Description Framework (RDF) format.
SPARQL can be used to express queries across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware. SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions.
You send the query as a HTTP GET request, and parse the result (usually XML or JSON, you can request either) using an XML or JSON parser.
For example the query:
http://dbpedia.org/sparql?query=SELECT+DISTINCT+?concept+WHERE+{+?s+a+?concept+}+LIMIT+50
Will run the SPARQL query:
SELECT DISTINCT ?concept
WHERE {
?s a ?concept .
} LIMIT 50
And return the results in XML.
You can test this in curl with:
$ curl -g 'http://dbpedia.org/sparql?query=SELECT+DISTINCT+?concept+WHERE+{+?s+a+?concept+}+LIMIT+50'
If you set the Accept: header you can control the return type, e.g. in curl:
$ curl -g -H 'Accept: application/json' 'http://dbpedia.org/sparql?query=SELECT+DISTINCT+?concept+WHERE+{+?s+a+?concept+}+LIMIT+50'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With