Sunday, November 04, 2007

The Poor State of SPARQL Implementations

*Sigh* I had a simple task. Really I did. I am putting the final touches on a journal article and wanted to expand an example to be more interesting. All I wanted to do was demonstrate (in SPARQL) that multiple RDF graphs can be pulled in from URLs and the dynamically-assembled graph queried. I wouldn't have thought that was such a big ask for 2007. Alas, I was wrong.

Here is the query:


prefix sec: <http://www.itee.uq.edu.au/~dwood/ontologies/sec.owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?class ?test ?testresults
FROM <http://www.itee.uq.edu.au/~dwood/ontologies/sec-example.owl>
FROM <http://www.itee.uq.edu.au/~dwood/ontologies/sec-testresults.owl>
WHERE {
?class rdf:type sec:OOClass .
?test sec:isTestOf ?class .
?test sec:hasTestResults ?testresults
}


Redland won't do it because it does not support FROM (or FROM NAMED). The same for OpenLink Virtuoso SPARQL and JRDF. Sesame 2.0 might do it, but I got tired of looking. I'll have to get back to it tomorrow.

In the meantime, I hacked around the problem by using a little-known feature of JRDF - one can import a series of RDF or OWL files and query the subsequent graph. It is annoying, and requires local copies of the documents, but it works (kind of).

The really sad thing is that Tucana had this feature (in the iTQL query language) in 2000 or 2001. Mulgara still does, of course. Paul assures me that SPARQL support in Mulgara is finally close. That is wonderful, but it does make me feel a bit guilty for not contributing to it given its obvious need.

I still (since 2000) think that querying multiple data sources from the WEB makes the SEMANTIC WEB a bit more useful, and interesting. *Sigh* I guess I will have to either contribute more or live with it.

UPDATE: Sesame does not support SPARQL datasets according to this bug, even though a patch has apparently already been contributed.

UPDATE: OpenLink Virtuoso demos at http://demo.openlinksw.com/sparql and http://demo.openlinksw.com/isparql now both return results. However, they return four results where I expect two.

Dave Beckett claims that the latest Redland/Rasql from svn now supports the query, but that he also gets four results.

Danny's SPARQLer now returns correct results (two).

Thanks to everyone who responded! Having proper FROM and FROM NAMED support opens a floodgate of potential new SemWeb applications.

UPDATE: Changing "SELECT" to "SELECT DISTINCT" returns the correct two results from Virtuoso. I suspect that change may be needed with others, too.