Hi.

We are embedding a sparql query into a for of virtuoso procedure. Everything
works great if we do the following.
Focus on the value of the offset:

...
for(sparql select distinct ?documentId ?title ?abstract ?relevance
?classification from <http://dev.epistemonikos.com> where {
            ?documentId ?p ?o .
            ?o bif:contains ?:query OPTION (score ?relevance) .
            ?documentId <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://purl.org/ontology/bibo/Document> .
            ?documentId <http://purl.org/dc/elements/1.1/title> ?title .
            ?documentId <
http://dev.epistemonikos.com/semantic/ontology/abstract> ?abstract .
            OPTIONAL { ?documentId <
http://dev.epistemonikos.com/semantic/ontology/classification>
?classification. } .
        } order by desc(?relevance) limit 50 offset 0
    ) do {
...
}
...

But if we replace the value of the offset, for the value of a variable (we
need this because we are serving this procedure in a restfull way and we
wont to do pagination) and we cannot make it work.
...
for(sparql select distinct ?documentId ?title ?abstract ?relevance
?classification from <http://dev.epistemonikos.com> where {
            ?documentId ?p ?o .
            ?o bif:contains ?:query OPTION (score ?relevance) .
            ?documentId <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://purl.org/ontology/bibo/Document> .
            ?documentId <http://purl.org/dc/elements/1.1/title> ?title .
            ?documentId <
http://dev.epistemonikos.com/semantic/ontology/abstract> ?abstract .
            OPTIONAL { ?documentId <
http://dev.epistemonikos.com/semantic/ontology/classification>
?classification. } .
        } order by desc(?relevance) limit 50 offset ?:offsetValue
    ) do {
...
}
...

Its warn.
syntax error at '?:offsetValue' at ')' before 'do'

We are using wrong the variable?
We do the same on the query
?o bif:contains ?:query OPTION (score ?relevance)
and its works perfect.

There is any way to solve this not putting the query into a varchar and
using exec?

Thanks.
Z.

Reply via email to