You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Martynas Jusevičius <ma...@graphity.org> on 2017/01/01 12:53:15 UTC
Custom SERVICE HTTP requests
Hey,
happy 2017 :)
I am wondering if there is a way to "intercept" the HTTP request that
is being generated by the SERVICE clause?
As you might know, some triplestores (RDF4J, Dydra) provide an
extension of the SPARQL protocol that allows sending query bindings
separately from the query string. (Too bad it's not standardized and
I'm not even able to find a good reference right now, but that is
another topic).
We have implemented it with a custom SPARQL client, but how can we
plug it into the federated query execution?
Thanks.
Martynas
Re: Custom SERVICE HTTP requests
Posted by Andy Seaborne <an...@apache.org>.
On 03/01/17 14:34, Martynas Jusevi\u010dius wrote:
> On Sun, Jan 1, 2017 at 6:59 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>
>> On 01/01/17 12:53, Martynas Jusevi\u010dius wrote:
>>> I am wondering if there is a way to "intercept"
>>
>>
>> Any thing can be intercepted with a custom OpExecutor.
>
> Any examples? What should it extend/where should it plug in?
protected QueryIterator execute(OpService, QueryIterator)
Andy
Re: Custom SERVICE HTTP requests
Posted by Andy Seaborne <an...@apache.org>.
On 03/01/17 14:41, james anderson wrote:
> good evening;
>
>> On 2017-01-03, at 15:34, Martynas Jusevi\u010dius <ma...@graphity.org> wrote:
>>
>> [\u2026]
>>
>> As for the original Sesame protocol, it's hard to find the spec these
>> days (maybe it is deprecated?), but here's a short note about variable
>> bindings with N-Triples-encoded values:
>> http://graphdb.ontotext.com/sesame/system/ch08.html#d0e247
>
> http://docs.rdf4j.org/rest-api/
Interesting - that seems to be syntactic replacement while Dydra is
value-insertion. So the two main styles of doing this - which for many
cases have the same outcome but not all cases by a long way.
Both can be done client side - it is only when query references are also
used does this become a necessity.
Andy
>
>
> best regards, from berlin,
> ---
> james anderson | james@dydra.com | http://dydra.com
>
>
>
>
>
>
Re: Custom SERVICE HTTP requests
Posted by james anderson <ja...@dydra.com>.
good evening;
> On 2017-01-03, at 15:34, Martynas Jusevičius <ma...@graphity.org> wrote:
>
> […]
>
> As for the original Sesame protocol, it's hard to find the spec these
> days (maybe it is deprecated?), but here's a short note about variable
> bindings with N-Triples-encoded values:
> http://graphdb.ontotext.com/sesame/system/ch08.html#d0e247
http://docs.rdf4j.org/rest-api/
best regards, from berlin,
---
james anderson | james@dydra.com | http://dydra.com
Re: Custom SERVICE HTTP requests
Posted by Martynas Jusevičius <ma...@graphity.org>.
On Sun, Jan 1, 2017 at 6:59 PM, Andy Seaborne <an...@apache.org> wrote:
>
>
> On 01/01/17 12:53, Martynas Jusevičius wrote:
>> I am wondering if there is a way to "intercept"
>
>
> Any thing can be intercepted with a custom OpExecutor.
Any examples? What should it extend/where should it plug in?
>
>> the HTTP request that
>> is being generated by the SERVICE clause?
>
>
> See Service.configureQuery for the use of serviceContext
Yes I have used Context, but I don't think that is enough, as it does
not provide full control of the request.
(Again, I think the HTTP access would be much cleaner using JAX-RS
API, but that is probably off-topic).
>> As you might know, some triplestores (RDF4J, Dydra) provide an
>> extension of the SPARQL protocol that allows sending query bindings
>> separately from the query string. (Too bad it's not standardized and
>> I'm not even able to find a good reference right now, but that is
>> another topic).
>
>
> What semantics do they have? Specifically, is it replace name-by-value
> regardless? (so inside nested SELECT where it can be a "different"
> variable)? What about aggregates?
Does James' answer help clarify that?
As for the original Sesame protocol, it's hard to find the spec these
days (maybe it is deprecated?), but here's a short note about variable
bindings with N-Triples-encoded values:
http://graphdb.ontotext.com/sesame/system/ch08.html#d0e247
>> We have implemented it with a custom SPARQL client, but how can we
>> plug it into the federated query execution?
>
>
> You can have query string parameters in the SERVICE URL.
For GET requests? What about POST body params, does Service take care
of that? It should be possible to use POST for large query strings.
And what about headers? Such as Cache-Control, for example?
Re: Custom SERVICE HTTP requests
Posted by "A. Soroka" <aj...@virginia.edu>.
Just a bit more on how SERVICE-specific HTTP action is managed:
https://jena.apache.org/documentation/query/service.html#configuration-from-jena-version-311
The code is here:
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java#L613
It may or may not be a useful pattern for you, but if your desired customization can be packaged in an HTTP client, you _can_ inject HTTP clients on a per-service basis.
---
A. Soroka
The University of Virginia Library
> On Jan 1, 2017, at 12:59 PM, Andy Seaborne <an...@apache.org> wrote:
>
>
>
> On 01/01/17 12:53, Martynas Jusevičius wrote:
>> Hey,
>>
>> happy 2017 :)
>>
>> I am wondering if there is a way to "intercept"
>
> Any thing can be intercepted with a custom OpExecutor.
>
>> the HTTP request that
>> is being generated by the SERVICE clause?
>
> See Service.configureQuery for the use of serviceContext
>
>>
>> As you might know, some triplestores (RDF4J, Dydra) provide an
>> extension of the SPARQL protocol that allows sending query bindings
>> separately from the query string. (Too bad it's not standardized and
>> I'm not even able to find a good reference right now, but that is
>> another topic).
>
> What semantics do they have? Specifically, is it replace name-by-value regardless? (so inside nested SELECT where it can be a "different" variable)? What about aggregates?
>
>>
>> We have implemented it with a custom SPARQL client, but how can we
>> plug it into the federated query execution?
>
> You can have query string parameters in the SERVICE URL.
>
> Andy
>
>>
>> Thanks.
>>
>> Martynas
>>
Re: Custom SERVICE HTTP requests
Posted by james anderson <ja...@dydra.com>.
good afternoon;
> On 2017-01-01, at 18:59, Andy Seaborne <an...@apache.org> wrote:
>
> […]
>
>>
>> As you might know, some triplestores (RDF4J, Dydra) provide an
>> extension of the SPARQL protocol that allows sending query bindings
>> separately from the query string. (Too bad it's not standardized and
>> I'm not even able to find a good reference right now, but that is
>> another topic).
>
> What semantics do they have? Specifically, is it replace name-by-value regardless? (so inside nested SELECT where it can be a "different" variable)? What about aggregates?
as one may have gathered from the discussion related to filters and shacl, the dydra sparql processor implements dynamic variables.
that is, it supports variable bindings with dynamic extent and indefinite scope.
in addition to the cases where "(not) exists" would depend on such a binding, we recognize request arguments to establish such bindings.
the consequence is that a variable which is not governed by some combinational binding form observes a dynamic binding, if one exists.
this serves to implement a behavior analogous to sesame query arguments, but based on bindings rather than interpolation.
in order to avoid that the client must mint queries in order to communicate constraints and to allow them to take advantage of pre-compilation, we recognize arguments which correspond to values clauses based on the clause dimensions (that is the “var*”) and substitute the parsed compound datablock into the expression at run-time.
examples are present here: https://github.com/dydra/http-api-tests/tree/master/extensions/sparql-protocol/values
best regards, from berlin,
Re: Custom SERVICE HTTP requests
Posted by Andy Seaborne <an...@apache.org>.
On 01/01/17 12:53, Martynas Jusevi\u010dius wrote:
> Hey,
>
> happy 2017 :)
>
> I am wondering if there is a way to "intercept"
Any thing can be intercepted with a custom OpExecutor.
> the HTTP request that
> is being generated by the SERVICE clause?
See Service.configureQuery for the use of serviceContext
>
> As you might know, some triplestores (RDF4J, Dydra) provide an
> extension of the SPARQL protocol that allows sending query bindings
> separately from the query string. (Too bad it's not standardized and
> I'm not even able to find a good reference right now, but that is
> another topic).
What semantics do they have? Specifically, is it replace name-by-value
regardless? (so inside nested SELECT where it can be a "different"
variable)? What about aggregates?
>
> We have implemented it with a custom SPARQL client, but how can we
> plug it into the federated query execution?
You can have query string parameters in the SERVICE URL.
Andy
>
> Thanks.
>
> Martynas
>