On 23/01/15 19:52, Martynas Jusevičius wrote:
Hey,
I need to implement Sesame HTTP protocol for remotely parameterized queries:
http://rdf4j.org/sesame/2.7/docs/system.docbook?view#repository-queries
My plan is to pass QuerySolutionMap to the QueryEngineHTTP level which
then would encode the values as N-Triples and add them to the query
string.
The question is, what is the most efficient Jena-way to achieve this?
The N-Triples encoding is where I need leads most.
The writer code works on Nodes so that's the place to useful stuff.
e.g. NodeFmtLib.str on the RDFNode.asNode followed by www-encoding.
IRILib has .encodeUriComponent, .encodeUriPath and .encodeNonASCII
(misplaced - the code is, I think, general working on strings but came
about while working on safe IRIs).
If you want efficiency, and the scale probably does not warrant that in
this case, NodeFormatterNT for stream output. One or two less strings
but if a network if involved, I'd doubt you can measure that.
A completely alternative approach is to insert a VALUES clause into the
query.
Or ParameterizedSparqlString (which will do the processing client side).
Andy
Thanks,
Martynas
graphityhq.com