RDFAuthor does SPARQL

Damian is working on a new version of RDFAuthor that generates SPARQL queries (instead of the older Squish notation). It can also (not sure which protocol(s)) get results from a query service. Here’s a screenshot:

Example screenshot of RDFAuthor for query authoring and result display. Nodes and arcs at top of window, tabular results at bottom

The automatically generated (and hence not 100% user-friendly) query was as follows:

SELECT *
 WHERE
 {
      ?var_4 <http ://xmlns.filsa.net/emir/0.2/#subject> ?var_1 .
      ?var_4 <http ://xmlns.filsa.net/emir/0.2/#from> ?var_5 .
      ?var_4 <http ://xmlns.filsa.net/emir/0.2/#date> ?var_2 .
      ?var_5 <http ://xmlns.com/foaf/0.1/name> ?var_3 .
      ?var_5 <http ://xmlns.com/foaf/0.1/mbox> <mailto :pldms@mac.com> .
 }

What does this say? Pretty much just the following:

Match where we have (in some default RDF graph) the foaf:name of any things with a foaf:mbox of mailto:pldms@mac.com,
whenever there is something that has an emir:subject and emir:date, and that is also emir:from the first thing. SELECT from that the name, subject and date.

This is based on a template graph whose structure can be seen in the screenshot, decorated with yellow variable markers where a node is marked as unknown. Actually I screwed up after the query executed and subsequently marked the mailbox node as unknown too, before taking the screenshot; if that query had been executed, the resultset would have been much larger. The target database is a Joseki service that has an RDF version of the jena-dev mail archives.

A more readable version of the query (untested) might be:

PREFIX emir: <http ://xmlns.filsa.net/emir/0.2/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT ?name ?date ?sub

WHERE
{
[
emir:subject ?sub ;
emir:date ?date ;
emir:from
[
foaf:name ?name;
foaf:mbox>mailto:pldms@mac.com> .
]
]
}

Leave a Reply