Querying with SPARQL

TwitterFacebook
Get flash to fully experience Pearltrees

SPARQL

SPARQL (pronounced " sparkle ", a recursive acronym for S PARQL P rotocol a nd R DF Q uery L anguage ) is an RDF query language , that is, a query language for databases , able to retrieve and manipulate data stored in Resource Description Framework format. [ 1 ] [ 2 ] It was made a standard by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium , and is considered as one of the key technologies of the semantic web . On 15 January 2008, SPARQL 1.0 became an official W3C Recommendation. [ 3 ] [ 4 ] SPARQL allows for a query to consist of triple patterns , conjunctions , disjunctions , and optional patterns . [ 5 ] http://en.wikipedia.org/wiki/SPARQL
DBpedia, as its home page tells us, "is a community effort to extract structured information from Wikipedia and to make this information available on the Web." That's "available" in the sense of available as data to programs that read and process it, because the data was already available to eyeballs on Wikipedia. This availability is a big deal to the semantic web community because it's a huge amount of valuable (and often, fun) information that the public can now query with SPARQL , the W3C standard query language that is one of the pillars of the semantic web. Although I'd dabbled in SPARQL and seen several sample SPARQL queries against DBpedia in action, I had a little trouble working out how to create my own SPARQL queries against DBpedia data. I finally managed to do it, so I thought I'd describe here how I successfully implemented my first use case.

Querying DBpedia

http://www.snee.com/bobdc.blog/2007/11/querying-dbpedia.html
Since I first wrote on sending DBpedia SPARQL queries about Bart's blackboard messages at the start of Simpsons episodes, I've learned a lot more about SPARQL (reading the spec helped) and I wanted to walk through some of the things I've learned by expanding on and refining my original query. I had finished that entry by wondering how to list Bart's blackboard entries for all episodes instead of for just one season. Vaclav Synacek showed me one way , and I recently realized that there's a much simpler way—maybe too simple (all queries shown assume the namespace declarations shown on the SNORQL interface form for sending SPARQL queries to DBpedia): (See it executed here .) What makes this too simple is that it asks for the dbpedia2:blackboard value for anything in DBpedia, whether it's a Simpsons episode or not. http://www.snee.com/bobdc.blog/2008/10/learning-more-about-sparql.html

Learning more about SPARQL

Federated SPARQL queries

Much of the promise of RDF and Linked Data is the ease of pulling data from multiple sources and combining it. I recently discovered the SERVICE extension that Jena adds to SPARQL, letting you send subqueries off to multiple SPARQL endpoints and then combine the results. Because a given SPARQL endpoint may be an interface to a triplestore or a relational data store or something else, the ability to query several endpoints with one query is very nice. The ability to query several endpoints with one query is very nice. http://www.snee.com/bobdc.blog/2010/01/federated-sparql-queries.html