Hi.

There is a simple query with text:query:
PREFIX   ex: http://www.example.org/resources#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX text: http://jena.apache.org/text#
SELECT ?s ?lbl
WHERE {
    ?s a ex:Product ;
       text:query (rdfs:label 'printer');
       rdfs:label ?lbl
}

Now I want to build such query SelectBuilder:


final Query query = new SelectBuilder()
        .setDistinct(true)
        .addPrefixes(NS_PREFIX_MAP)
        .addVar("s")
        .addVar("lbl")
        .addWhere(makeVar("s"), "rdf:type", "ex:Product ")
        .addWhere(makeVar("lbl"), "text:query", "(rdfs:label 'printer')")
        .addWhere(makeVar("lbl"), "rdfs:label", "?lbl")
        .build();

Result is:

PREFIX   ex: http://www.example.org/resources#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX text: http://jena.apache.org/text#
SELECT ?s ?lbl
WHERE {
    ?s rdf:type ex:Product ;
       text:query "(rdfs:label 'printer')";
       rdfs:label ?lbl
}


which is incorrect because (rdfs:label 'printer') is treated as literal, so in 
result it's wrapped by quotes.

Is there is a way to do it right?

Thank in advance.
Paweł

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to