Dave Beckett

Rasqal 0.9.5 - SPARQL optionals

2005-01-16 20:28

After a lot of testing and staring at the crazyness that is Solaris shared library paths, I've released Rasqal RDF Query Library 0.9.5 which has a lot of internal changes, specifically it now operates in terms of graph patterns - sets of triple patterns, so that it can handle certain SPARQL features. It also uses Raptor 1.4.4 to write result sets as XML.

The one feature I particularly wanted to get out was optionals. These are pretty handy when you have a somewhat unknown graph that you are querying, which could have some useful triples, ahem, optionally. So rather than do lots of queries of the form "do you have triple (?x prop1 ?y) ?" and "do you have triple (?x prop2 ?z)?"

they can be just attached to the other triples in the graph pattern, marked optional, and only if they match you get a binding, otherwise, the query carries on. This is all properly explained in the Including Optional Values section of the SPARQL query draft.

You can try them yourself in the Redland Rasqal RDF Query Demo which has an optional example at the bottom. Surely there are bugs, it's new code. I prefer diff -urN patches, thanks! :)