You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2014/09/02 12:10:53 UTC
prepared statements in Jena
I recall a discussion of prepared statements in Jena awhile back. Now my
google search has turned up using bind to do something like a prepared
statement, but for some reason I thought there was a proposal to do real
prepared statement with replacable parameters. Somthing that would work
with service calls as the parameters would be replaced before the statement
executed.
Does anyone else remember such a conversation? Does anyone know of such a
solution?
Claude
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: prepared statements in Jena
Posted by Andy Seaborne <an...@apache.org>.
A transform system for the Query abstract syntax tree (and updates) that
was written a while back when we were discussing this:
https://github.com/afs/AFS-Dev/tree/master/src/main/java/element
Like ParameterizedSparqlString, it is client-side.
Andy
On 02/09/14 13:51, Claude Warren wrote:
> I have a QueryBuilder that currently builds a query string. Andy had asked
> if I could make it build the query object so that we didn't have to parse
> the string. One of the features of the current method is that it allows
> you to use the String.format() parameters and replace them before calling
> the parser. I am looking for a way to do that while building the query
> objects. I had thought about allowing replacement of the variables with
> concrete values similar to what the parameterized-sparql-strings does.
>
>
>
>
> On Tue, Sep 2, 2014 at 1:27 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>
>> Claude
>>
>> There is the ParameterizedSparqlString functionality which is essentially
>> just textual parameterization -
>> https://jena.apache.org/documentation/query/parameterized-sparql-strings.ht
>> ml - so it is somewhat limited but that has existed in ARQ for a year or
>> two now.
>>
>> There was some talk about doing the parameterisation at the query/algebra
>> level. Certainly some of the plumbing that supports parameterisation at
>> the algebra level already exists because it is used by optimisations
>>
>> Maybe you could elaborate more on what you intend?
>>
>> Rob
>>
>> On 02/09/2014 11:10, "Claude Warren" <cl...@xenei.com> wrote:
>>
>>> I recall a discussion of prepared statements in Jena awhile back. Now my
>>> google search has turned up using bind to do something like a prepared
>>> statement, but for some reason I thought there was a proposal to do real
>>> prepared statement with replacable parameters. Somthing that would work
>>> with service calls as the parameters would be replaced before the
>>> statement
>>> executed.
>>>
>>> Does anyone else remember such a conversation? Does anyone know of such a
>>> solution?
>>>
>>> Claude
>>>
>>> --
>>> I like: Like Like - The likeliest place on the web
>>> <http://like-like.xenei.com>
>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>
>>
>>
>>
>>
>
>
Re: prepared statements in Jena
Posted by Claude Warren <cl...@xenei.com>.
You misunderstood me. I was saying the current implementation supports
String.format() type replacable parameters. I was just looking for a way
to do replacable parameters inside a querybuilder.
On Tue, Sep 2, 2014 at 2:58 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
> I'm not sure that using String.format() style parameters makes sense
> because SPARQL expects values to be in certain restricted formats and
> values not matching those formats would be invalid
>
> For example consider the format specifier %,d I.e integer with thousands
> separator. Values printed with that format into a SPARQL string would not
> always be valid integers according to SPARQL and depending on where they
> were inserted would not necessarily be immediate syntax errors either but
> might only manifest as unexpected runtime behaviour
>
> Rob
>
> On 02/09/2014 13:51, "Claude Warren" <cl...@xenei.com> wrote:
>
> >I have a QueryBuilder that currently builds a query string. Andy had
> >asked
> >if I could make it build the query object so that we didn't have to parse
> >the string. One of the features of the current method is that it allows
> >you to use the String.format() parameters and replace them before calling
> >the parser. I am looking for a way to do that while building the query
> >objects. I had thought about allowing replacement of the variables with
> >concrete values similar to what the parameterized-sparql-strings does.
> >
> >
> >
> >
> >On Tue, Sep 2, 2014 at 1:27 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
> >
> >> Claude
> >>
> >> There is the ParameterizedSparqlString functionality which is
> >>essentially
> >> just textual parameterization -
> >>
> >>https://jena.apache.org/documentation/query/parameterized-sparql-strings
> .
> >>ht
> >> ml - so it is somewhat limited but that has existed in ARQ for a year or
> >> two now.
> >>
> >> There was some talk about doing the parameterisation at the
> >>query/algebra
> >> level. Certainly some of the plumbing that supports parameterisation at
> >> the algebra level already exists because it is used by optimisations
> >>
> >> Maybe you could elaborate more on what you intend?
> >>
> >> Rob
> >>
> >> On 02/09/2014 11:10, "Claude Warren" <cl...@xenei.com> wrote:
> >>
> >> >I recall a discussion of prepared statements in Jena awhile back. Now
> >>my
> >> >google search has turned up using bind to do something like a prepared
> >> >statement, but for some reason I thought there was a proposal to do
> >>real
> >> >prepared statement with replacable parameters. Somthing that would
> >>work
> >> >with service calls as the parameters would be replaced before the
> >> >statement
> >> >executed.
> >> >
> >> >Does anyone else remember such a conversation? Does anyone know of
> >>such a
> >> >solution?
> >> >
> >> >Claude
> >> >
> >> >--
> >> >I like: Like Like - The likeliest place on the web
> >> ><http://like-like.xenei.com>
> >> >LinkedIn: http://www.linkedin.com/in/claudewarren
> >>
> >>
> >>
> >>
> >>
> >
> >
> >--
> >I like: Like Like - The likeliest place on the web
> ><http://like-like.xenei.com>
> >LinkedIn: http://www.linkedin.com/in/claudewarren
>
>
>
>
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: prepared statements in Jena
Posted by Rob Vesse <rv...@dotnetrdf.org>.
I'm not sure that using String.format() style parameters makes sense
because SPARQL expects values to be in certain restricted formats and
values not matching those formats would be invalid
For example consider the format specifier %,d I.e integer with thousands
separator. Values printed with that format into a SPARQL string would not
always be valid integers according to SPARQL and depending on where they
were inserted would not necessarily be immediate syntax errors either but
might only manifest as unexpected runtime behaviour
Rob
On 02/09/2014 13:51, "Claude Warren" <cl...@xenei.com> wrote:
>I have a QueryBuilder that currently builds a query string. Andy had
>asked
>if I could make it build the query object so that we didn't have to parse
>the string. One of the features of the current method is that it allows
>you to use the String.format() parameters and replace them before calling
>the parser. I am looking for a way to do that while building the query
>objects. I had thought about allowing replacement of the variables with
>concrete values similar to what the parameterized-sparql-strings does.
>
>
>
>
>On Tue, Sep 2, 2014 at 1:27 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>
>> Claude
>>
>> There is the ParameterizedSparqlString functionality which is
>>essentially
>> just textual parameterization -
>>
>>https://jena.apache.org/documentation/query/parameterized-sparql-strings.
>>ht
>> ml - so it is somewhat limited but that has existed in ARQ for a year or
>> two now.
>>
>> There was some talk about doing the parameterisation at the
>>query/algebra
>> level. Certainly some of the plumbing that supports parameterisation at
>> the algebra level already exists because it is used by optimisations
>>
>> Maybe you could elaborate more on what you intend?
>>
>> Rob
>>
>> On 02/09/2014 11:10, "Claude Warren" <cl...@xenei.com> wrote:
>>
>> >I recall a discussion of prepared statements in Jena awhile back. Now
>>my
>> >google search has turned up using bind to do something like a prepared
>> >statement, but for some reason I thought there was a proposal to do
>>real
>> >prepared statement with replacable parameters. Somthing that would
>>work
>> >with service calls as the parameters would be replaced before the
>> >statement
>> >executed.
>> >
>> >Does anyone else remember such a conversation? Does anyone know of
>>such a
>> >solution?
>> >
>> >Claude
>> >
>> >--
>> >I like: Like Like - The likeliest place on the web
>> ><http://like-like.xenei.com>
>> >LinkedIn: http://www.linkedin.com/in/claudewarren
>>
>>
>>
>>
>>
>
>
>--
>I like: Like Like - The likeliest place on the web
><http://like-like.xenei.com>
>LinkedIn: http://www.linkedin.com/in/claudewarren
Re: prepared statements in Jena
Posted by Claude Warren <cl...@xenei.com>.
I have a QueryBuilder that currently builds a query string. Andy had asked
if I could make it build the query object so that we didn't have to parse
the string. One of the features of the current method is that it allows
you to use the String.format() parameters and replace them before calling
the parser. I am looking for a way to do that while building the query
objects. I had thought about allowing replacement of the variables with
concrete values similar to what the parameterized-sparql-strings does.
On Tue, Sep 2, 2014 at 1:27 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
> Claude
>
> There is the ParameterizedSparqlString functionality which is essentially
> just textual parameterization -
> https://jena.apache.org/documentation/query/parameterized-sparql-strings.ht
> ml - so it is somewhat limited but that has existed in ARQ for a year or
> two now.
>
> There was some talk about doing the parameterisation at the query/algebra
> level. Certainly some of the plumbing that supports parameterisation at
> the algebra level already exists because it is used by optimisations
>
> Maybe you could elaborate more on what you intend?
>
> Rob
>
> On 02/09/2014 11:10, "Claude Warren" <cl...@xenei.com> wrote:
>
> >I recall a discussion of prepared statements in Jena awhile back. Now my
> >google search has turned up using bind to do something like a prepared
> >statement, but for some reason I thought there was a proposal to do real
> >prepared statement with replacable parameters. Somthing that would work
> >with service calls as the parameters would be replaced before the
> >statement
> >executed.
> >
> >Does anyone else remember such a conversation? Does anyone know of such a
> >solution?
> >
> >Claude
> >
> >--
> >I like: Like Like - The likeliest place on the web
> ><http://like-like.xenei.com>
> >LinkedIn: http://www.linkedin.com/in/claudewarren
>
>
>
>
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: prepared statements in Jena
Posted by Rob Vesse <rv...@dotnetrdf.org>.
Claude
There is the ParameterizedSparqlString functionality which is essentially
just textual parameterization -
https://jena.apache.org/documentation/query/parameterized-sparql-strings.ht
ml - so it is somewhat limited but that has existed in ARQ for a year or
two now.
There was some talk about doing the parameterisation at the query/algebra
level. Certainly some of the plumbing that supports parameterisation at
the algebra level already exists because it is used by optimisations
Maybe you could elaborate more on what you intend?
Rob
On 02/09/2014 11:10, "Claude Warren" <cl...@xenei.com> wrote:
>I recall a discussion of prepared statements in Jena awhile back. Now my
>google search has turned up using bind to do something like a prepared
>statement, but for some reason I thought there was a proposal to do real
>prepared statement with replacable parameters. Somthing that would work
>with service calls as the parameters would be replaced before the
>statement
>executed.
>
>Does anyone else remember such a conversation? Does anyone know of such a
>solution?
>
>Claude
>
>--
>I like: Like Like - The likeliest place on the web
><http://like-like.xenei.com>
>LinkedIn: http://www.linkedin.com/in/claudewarren