[Nepomuk] SPARQL construct queries in Soprano with Virtuoso

Sebastian Trüg trueg at kde.org
Thu May 6 09:48:50 CEST 2010


Hi Ilkka,

you are not doing anything wrong. Virtuoso returns graph query results
as blobs of turtle encoded rdf. Soprano tries to parse the data and then
provide a StatementIterator over the statements (via the
QueryResultIterator). As such, the Virtuoso backend depends on the
raptor parser plugin, a dependency that is not reflected in the build
system (I should change that).
Thus, my first question: is the Soprano raptor parser plugin installed?
BTW: If not, there should be an error message about that on the console
when you try to open the iterator.

Cheers,
Sebastian

On 05/05/2010 01:55 PM, Ilkka Laukkanen wrote:
> 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?
> 
> 


More information about the Nepomuk mailing list