SPARQL

SPARQL (pronounced "sparkle" is an RDF Query Language, that is, a semantic query language for databases, able to retrieve and manipulate data stored in RDF format - wikipedia

SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.

Use Cases

The idea here is that if you want to search from a given Federated Wiki Page you can simply queery it using SPARQL - so each wiki page becomes a SPARQL end point.

It is not clear what to do, when we have a Federated WIki URI which displays several wiki-page "panels" in a singe web page, but the problem looks to have interesting solutions and uses.

Taking the two standard examples of SPARQL query's below, we can imagine looking at a Federated Wiki page that contains an index of people - such as Teaching Machines Sites and send a SPARQL query to teaching-machines-sites which asks "Give me the names and emails of every person linked to this page".

Similarly if we are looking at a page about geography that contains a map and an index to pages about those countries - we could ask "What are all the country capitals in Africa?" - or an even more specific query.

In this way adding data to wiki=pages and organising them the way you wish, results as a side effect, in the creation of a beautifully anotated and custom crafted database that other people can query in a wide range tools.

Examples

The following query returns names and emails of every person in the dataset:

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?email WHERE { ?person a foaf:Person. ?person foaf:name ?name. ?person foaf:mbox ?email. }

Another SPARQL query example that models the question:

  • What are all the country capitals in Africa?

PREFIX abc: <http://example.com/exampleOntology#> SELECT ?capital ?country WHERE { ?x abc:cityname ?capital ; abc:isCapitalOf ?y . ?y abc:countryname ?country ; abc:isInContinent abc:Africa . }

Implementations

Implementations for multiple programming languages exist. "SPARQL will make a huge difference" making the web machine-readable according to Tim Berners-Lee in a May 2006 interview.

There exist tools that allow one to connect and semi-automatically construct a SPARQL query for a SPARQL endpoint, for example ViziQuer. In addition, there exist tools that translate SPARQL queries to other query languages, for example to SQL and to XQuery.