[Nepomuk] SPARQL construct queries in Soprano with Virtuoso

Ilkka Laukkanen ilkka.s.laukkanen at gmail.com
Wed May 5 13:55:24 CEST 2010


Hi,

I'm using Soprano 2.4.2 and the Virtuoso backend to store a bunch of
data and wanted to run a construct SPARQL query on it. I was a bit
surprised when I noticed that the QueryResultIterator returned by my
query was not a Graph iterator but a Binding iterator instead. Here's
the query:

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix dc: <http://purl.org/dc/elements/1.1/>
construct {
        ?thing ?property ?propval .
        ?property rdfs:label ?label .
}
where {
        ?thing ?property ?propval .
	?thing dc:format "application/x-whatever" .
        ?thing ?matchproperty ?matchval .
        filter regex(str(?matchval), "Foobar") .
        ?property rdfs:label ?label .
}

Naturally "Foobar" would be replaced by a real search term and the
dc:format would be a bit more specific, but you get the gist of it.
Anyway, the resulting QueryResultIterator is a Binding iterator, with
a single binding, "fmtaggret-" that contans the result as a string
with embedded escaped tabs and newlines, instead of a Graph iterator
that I could use to get at the statements in my result graph.

What am I doing wrong?


-- 
Ilkka


More information about the Nepomuk mailing list