You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andy Seaborne <an...@apache.org> on 2013/04/01 21:42:23 UTC

Re: OpAsQuery generating invalid query

Hi there,

Thanks for the report. I've captured this as:

https://issues.apache.org/jira/browse/JENA-429

	Andy

On 31/03/13 21:11, Diogo FC Patrao wrote:
> Hello
>
> I was performing a simple test with OpAsQuery:
>
> Here is the original query:
>
> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
>
>      SELECT ?yearmonth ( count(?document) as ?total )
>      WHERE
>      {
>          ?document a :Document;
>                   :documentDateOfCreation ?date ;
>                   :documentType "exam results" .
>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
> ?yearmonth )
>      } group by ?yearmonth
>
> Then I ran the code below, that compile the algebra then render the query
> again.
>
> Query query = QueryFactory.create( that_query_above,
> Syntax.syntaxSPARQL_11);
>
> Op op = Algebra.compile(query);
>
> System.out.println(OpAsQuery.asQuery(op));
>
> The result is below:
>
> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS ?yearmonth)
> (count(?document) AS ?total)
>
> WHERE
>
>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
>
>      ?document <
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreation>
> ?date .
>
>      ?document <
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType> "exam
> results"
>
>    }
>
> GROUP BY ?yearmonth
>
> However, this is not a valid query; notice that the BIND has gone, it
> somehow turned to a alias on query's head.
>
> ARQ 2.8.8. upon receiving this query, yields the error:
>
> Variable used when already in-scope: ?yearmonth in
> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date), "yyyy-MM") AS
> ?yearmonth)
>
> Is that a bug on ARQ or OpAsQuery? Or anything else?
>
> Thanks!
>
> --
> diogo patrão
>


Re: OpAsQuery generating invalid query

Posted by Diogo FC Patrao <dj...@gmail.com>.
Hi Rob

I just got the 20130403 compile and now my BINDs are back to where they
belong.

Thanks again,

--
diogo patrão




On Tue, Apr 2, 2013 at 8:50 PM, Rob Vesse <rv...@yarcdata.com> wrote:

> It looks like it didn't go in yet, you can check what has gone into a
> SNAPSHOT by looking at the build server:
>
> https://builds.apache.org/job/Jena__Development_Deploy/changes
>
> I don't see JENA-429 there yet so no this isn't available in a SNAPSHOT yet
>
> I have scheduled a new build but it will be a few hours before the Apache
> build servers have a free slot!
>
> Rob
>
>
> On 4/2/13 4:43 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:
>
> >Hello Rob
> >
> >I replaced the 2.10.0 library by apache-jena-2.10.1-20130401, however BIND
> >aren't getting into my query still.
> >
> >Is your fix in this version yet?
> >
> >Thanks
> >
> >
> >--
> >diogo patrão
> >
> >
> >
> >
> >On Tue, Apr 2, 2013 at 1:16 PM, Rob Vesse <rv...@yarcdata.com> wrote:
> >
> >> The syntax error was correct even in the current stable version
> >>
> >>
> >> The problem was that the code for converting from an algebra back into a
> >> query usually puts top level BIND as project expressions which in most
> >> cases is semantically equivalent to the original query.  However when
> >> there is a GROUP BY present it needs to recreate the BIND as an actual
> >> BIND or you get the variable scope error.
> >>
> >> In algebra terms a project expression and a BIND at the top level of the
> >> query pattern are semantically equivalent bar the above proviso about
> >> interaction with GROUP BY
> >>
> >> Rob
> >>
> >> On 4/1/13 7:47 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:
> >>
> >> >Hello Rob
> >> >
> >> >Should now be fixed, build from latest Trunk or wait 24 hrs or so for
> >>the
> >> >> snapshot to get build and deployed by the Apache build server
> >> >>
> >> >
> >> >* THANKS a million * ! I'm running a couple of experiments for my PhD
> >> >thesis, and was getting the excuses done, for that bug messed up part
> >>of
> >> >my
> >> >data. Now I can get everything right. Thanks, thanks.
> >> >
> >> >
> >> >> What version of ARQ are you using to do the OpAsQuery? I assume
> >> >> 2.10.1-SNAPSHOT since turning this type of query from its algebra
> >>back
> >> >> into a query only very recently became possible.  Previously the BIND
> >> >> would have been lost completely when converting back from an algebra
> >>to
> >> >>a
> >> >> query.
> >> >>
> >> >
> >> >The jar file says "2.10.0", I just downloaded the latest stable
> >>version.
> >> >
> >> >
> >> >> Also is there a reason you are using ARQ 2.8.8 in your system?
> >>That's
> >> >> very out of date (about 2 years so) now.
> >> >>
> >> >
> >> >well, I'm running this experiment for one year and two months now, and
> >> >just
> >> >copied the binaries and stuff that were working. TLDR: lazy.
> >> >
> >> >anyway, 2.10.0 ARQ yielded the same error.
> >> >
> >> >However, should defining an alias on the query head allow referring to
> >>it
> >> >elsewhere? Are alias and BINDs really equivalent? MySQL have this
> >> >behaviour, but not Oracle.
> >> >
> >> >Thanks (again).
> >> >
> >> >dfcp
> >> >
> >> >
> >> >
> >> >
> >> >> Andy - The report states that the query is passed off to a system
> >> >>running
> >> >> 2.8.8, even with this fix did ARQ support BIND syntax that far back?
> >> >>I.e.
> >> >> will this fix just move the error elsewhere?
> >> >>
> >> >> Rob
> >> >>
> >> >>
> >> >>
> >> >> On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:
> >> >>
> >> >> >Hi there,
> >> >> >
> >> >> >Thanks for the report. I've captured this as:
> >> >> >
> >> >> >https://issues.apache.org/jira/browse/JENA-429
> >> >> >
> >> >> >       Andy
> >> >> >
> >> >> >On 31/03/13 21:11, Diogo FC Patrao wrote:
> >> >> >> Hello
> >> >> >>
> >> >> >> I was performing a simple test with OpAsQuery:
> >> >> >>
> >> >> >> Here is the original query:
> >> >> >>
> >> >> >> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
> >> >> >> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> >> >> >> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
> >> >> >>
> >> >> >>      SELECT ?yearmonth ( count(?document) as ?total )
> >> >> >>      WHERE
> >> >> >>      {
> >> >> >>          ?document a :Document;
> >> >> >>                   :documentDateOfCreation ?date ;
> >> >> >>                   :documentType "exam results" .
> >> >> >>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
> >> >> >> ?yearmonth )
> >> >> >>      } group by ?yearmonth
> >> >> >>
> >> >> >> Then I ran the code below, that compile the algebra then render
> >>the
> >> >> >>query
> >> >> >> again.
> >> >> >>
> >> >> >> Query query = QueryFactory.create( that_query_above,
> >> >> >> Syntax.syntaxSPARQL_11);
> >> >> >>
> >> >> >> Op op = Algebra.compile(query);
> >> >> >>
> >> >> >> System.out.println(OpAsQuery.asQuery(op));
> >> >> >>
> >> >> >> The result is below:
> >> >> >>
> >> >> >> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
> >> >> >> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
> >> >> >>?yearmonth)
> >> >> >> (count(?document) AS ?total)
> >> >> >>
> >> >> >> WHERE
> >> >> >>
> >> >> >>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <
> >> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
> >> >> >>
> >> >> >>      ?document <
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >>
> >>
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
> >> >> >>on>
> >> >> >> ?date .
> >> >> >>
> >> >> >>      ?document <
> >> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType
> >
> >> >> "exam
> >> >> >> results"
> >> >> >>
> >> >> >>    }
> >> >> >>
> >> >> >> GROUP BY ?yearmonth
> >> >> >>
> >> >> >> However, this is not a valid query; notice that the BIND has
> >>gone, it
> >> >> >> somehow turned to a alias on query's head.
> >> >> >>
> >> >> >> ARQ 2.8.8. upon receiving this query, yields the error:
> >> >> >>
> >> >> >> Variable used when already in-scope: ?yearmonth in
> >> >> >> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date),
> >> >>"yyyy-MM")
> >> >> >>AS
> >> >> >> ?yearmonth)
> >> >> >>
> >> >> >> Is that a bug on ARQ or OpAsQuery? Or anything else?
> >> >> >>
> >> >> >> Thanks!
> >> >> >>
> >> >> >> --
> >> >> >> diogo patrão
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >>
> >>
>
>

Re: OpAsQuery generating invalid query

Posted by Rob Vesse <rv...@yarcdata.com>.
It looks like it didn't go in yet, you can check what has gone into a
SNAPSHOT by looking at the build server:

https://builds.apache.org/job/Jena__Development_Deploy/changes

I don't see JENA-429 there yet so no this isn't available in a SNAPSHOT yet

I have scheduled a new build but it will be a few hours before the Apache
build servers have a free slot!

Rob


On 4/2/13 4:43 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:

>Hello Rob
>
>I replaced the 2.10.0 library by apache-jena-2.10.1-20130401, however BIND
>aren't getting into my query still.
>
>Is your fix in this version yet?
>
>Thanks
>
>
>--
>diogo patrão
>
>
>
>
>On Tue, Apr 2, 2013 at 1:16 PM, Rob Vesse <rv...@yarcdata.com> wrote:
>
>> The syntax error was correct even in the current stable version
>>
>>
>> The problem was that the code for converting from an algebra back into a
>> query usually puts top level BIND as project expressions which in most
>> cases is semantically equivalent to the original query.  However when
>> there is a GROUP BY present it needs to recreate the BIND as an actual
>> BIND or you get the variable scope error.
>>
>> In algebra terms a project expression and a BIND at the top level of the
>> query pattern are semantically equivalent bar the above proviso about
>> interaction with GROUP BY
>>
>> Rob
>>
>> On 4/1/13 7:47 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:
>>
>> >Hello Rob
>> >
>> >Should now be fixed, build from latest Trunk or wait 24 hrs or so for
>>the
>> >> snapshot to get build and deployed by the Apache build server
>> >>
>> >
>> >* THANKS a million * ! I'm running a couple of experiments for my PhD
>> >thesis, and was getting the excuses done, for that bug messed up part
>>of
>> >my
>> >data. Now I can get everything right. Thanks, thanks.
>> >
>> >
>> >> What version of ARQ are you using to do the OpAsQuery? I assume
>> >> 2.10.1-SNAPSHOT since turning this type of query from its algebra
>>back
>> >> into a query only very recently became possible.  Previously the BIND
>> >> would have been lost completely when converting back from an algebra
>>to
>> >>a
>> >> query.
>> >>
>> >
>> >The jar file says "2.10.0", I just downloaded the latest stable
>>version.
>> >
>> >
>> >> Also is there a reason you are using ARQ 2.8.8 in your system?
>>That's
>> >> very out of date (about 2 years so) now.
>> >>
>> >
>> >well, I'm running this experiment for one year and two months now, and
>> >just
>> >copied the binaries and stuff that were working. TLDR: lazy.
>> >
>> >anyway, 2.10.0 ARQ yielded the same error.
>> >
>> >However, should defining an alias on the query head allow referring to
>>it
>> >elsewhere? Are alias and BINDs really equivalent? MySQL have this
>> >behaviour, but not Oracle.
>> >
>> >Thanks (again).
>> >
>> >dfcp
>> >
>> >
>> >
>> >
>> >> Andy - The report states that the query is passed off to a system
>> >>running
>> >> 2.8.8, even with this fix did ARQ support BIND syntax that far back?
>> >>I.e.
>> >> will this fix just move the error elsewhere?
>> >>
>> >> Rob
>> >>
>> >>
>> >>
>> >> On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:
>> >>
>> >> >Hi there,
>> >> >
>> >> >Thanks for the report. I've captured this as:
>> >> >
>> >> >https://issues.apache.org/jira/browse/JENA-429
>> >> >
>> >> >       Andy
>> >> >
>> >> >On 31/03/13 21:11, Diogo FC Patrao wrote:
>> >> >> Hello
>> >> >>
>> >> >> I was performing a simple test with OpAsQuery:
>> >> >>
>> >> >> Here is the original query:
>> >> >>
>> >> >> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
>> >> >> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>> >> >> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
>> >> >>
>> >> >>      SELECT ?yearmonth ( count(?document) as ?total )
>> >> >>      WHERE
>> >> >>      {
>> >> >>          ?document a :Document;
>> >> >>                   :documentDateOfCreation ?date ;
>> >> >>                   :documentType "exam results" .
>> >> >>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
>> >> >> ?yearmonth )
>> >> >>      } group by ?yearmonth
>> >> >>
>> >> >> Then I ran the code below, that compile the algebra then render
>>the
>> >> >>query
>> >> >> again.
>> >> >>
>> >> >> Query query = QueryFactory.create( that_query_above,
>> >> >> Syntax.syntaxSPARQL_11);
>> >> >>
>> >> >> Op op = Algebra.compile(query);
>> >> >>
>> >> >> System.out.println(OpAsQuery.asQuery(op));
>> >> >>
>> >> >> The result is below:
>> >> >>
>> >> >> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
>> >> >> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
>> >> >>?yearmonth)
>> >> >> (count(?document) AS ?total)
>> >> >>
>> >> >> WHERE
>> >> >>
>> >> >>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
>> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
>> >> >>
>> >> >>      ?document <
>> >> >>
>> >> >>
>> >>
>> >>
>> 
>>http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
>> >> >>on>
>> >> >> ?date .
>> >> >>
>> >> >>      ?document <
>> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType>
>> >> "exam
>> >> >> results"
>> >> >>
>> >> >>    }
>> >> >>
>> >> >> GROUP BY ?yearmonth
>> >> >>
>> >> >> However, this is not a valid query; notice that the BIND has
>>gone, it
>> >> >> somehow turned to a alias on query's head.
>> >> >>
>> >> >> ARQ 2.8.8. upon receiving this query, yields the error:
>> >> >>
>> >> >> Variable used when already in-scope: ?yearmonth in
>> >> >> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date),
>> >>"yyyy-MM")
>> >> >>AS
>> >> >> ?yearmonth)
>> >> >>
>> >> >> Is that a bug on ARQ or OpAsQuery? Or anything else?
>> >> >>
>> >> >> Thanks!
>> >> >>
>> >> >> --
>> >> >> diogo patrão
>> >> >>
>> >> >
>> >>
>> >>
>>
>>


Re: OpAsQuery generating invalid query

Posted by Diogo FC Patrao <dj...@gmail.com>.
Hello Rob

I replaced the 2.10.0 library by apache-jena-2.10.1-20130401, however BIND
aren't getting into my query still.

Is your fix in this version yet?

Thanks


--
diogo patrão




On Tue, Apr 2, 2013 at 1:16 PM, Rob Vesse <rv...@yarcdata.com> wrote:

> The syntax error was correct even in the current stable version
>
>
> The problem was that the code for converting from an algebra back into a
> query usually puts top level BIND as project expressions which in most
> cases is semantically equivalent to the original query.  However when
> there is a GROUP BY present it needs to recreate the BIND as an actual
> BIND or you get the variable scope error.
>
> In algebra terms a project expression and a BIND at the top level of the
> query pattern are semantically equivalent bar the above proviso about
> interaction with GROUP BY
>
> Rob
>
> On 4/1/13 7:47 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:
>
> >Hello Rob
> >
> >Should now be fixed, build from latest Trunk or wait 24 hrs or so for the
> >> snapshot to get build and deployed by the Apache build server
> >>
> >
> >* THANKS a million * ! I'm running a couple of experiments for my PhD
> >thesis, and was getting the excuses done, for that bug messed up part of
> >my
> >data. Now I can get everything right. Thanks, thanks.
> >
> >
> >> What version of ARQ are you using to do the OpAsQuery? I assume
> >> 2.10.1-SNAPSHOT since turning this type of query from its algebra back
> >> into a query only very recently became possible.  Previously the BIND
> >> would have been lost completely when converting back from an algebra to
> >>a
> >> query.
> >>
> >
> >The jar file says "2.10.0", I just downloaded the latest stable version.
> >
> >
> >> Also is there a reason you are using ARQ 2.8.8 in your system?  That's
> >> very out of date (about 2 years so) now.
> >>
> >
> >well, I'm running this experiment for one year and two months now, and
> >just
> >copied the binaries and stuff that were working. TLDR: lazy.
> >
> >anyway, 2.10.0 ARQ yielded the same error.
> >
> >However, should defining an alias on the query head allow referring to it
> >elsewhere? Are alias and BINDs really equivalent? MySQL have this
> >behaviour, but not Oracle.
> >
> >Thanks (again).
> >
> >dfcp
> >
> >
> >
> >
> >> Andy - The report states that the query is passed off to a system
> >>running
> >> 2.8.8, even with this fix did ARQ support BIND syntax that far back?
> >>I.e.
> >> will this fix just move the error elsewhere?
> >>
> >> Rob
> >>
> >>
> >>
> >> On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:
> >>
> >> >Hi there,
> >> >
> >> >Thanks for the report. I've captured this as:
> >> >
> >> >https://issues.apache.org/jira/browse/JENA-429
> >> >
> >> >       Andy
> >> >
> >> >On 31/03/13 21:11, Diogo FC Patrao wrote:
> >> >> Hello
> >> >>
> >> >> I was performing a simple test with OpAsQuery:
> >> >>
> >> >> Here is the original query:
> >> >>
> >> >> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
> >> >> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> >> >> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
> >> >>
> >> >>      SELECT ?yearmonth ( count(?document) as ?total )
> >> >>      WHERE
> >> >>      {
> >> >>          ?document a :Document;
> >> >>                   :documentDateOfCreation ?date ;
> >> >>                   :documentType "exam results" .
> >> >>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
> >> >> ?yearmonth )
> >> >>      } group by ?yearmonth
> >> >>
> >> >> Then I ran the code below, that compile the algebra then render the
> >> >>query
> >> >> again.
> >> >>
> >> >> Query query = QueryFactory.create( that_query_above,
> >> >> Syntax.syntaxSPARQL_11);
> >> >>
> >> >> Op op = Algebra.compile(query);
> >> >>
> >> >> System.out.println(OpAsQuery.asQuery(op));
> >> >>
> >> >> The result is below:
> >> >>
> >> >> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
> >> >> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
> >> >>?yearmonth)
> >> >> (count(?document) AS ?total)
> >> >>
> >> >> WHERE
> >> >>
> >> >>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
> >> >>
> >> >>      ?document <
> >> >>
> >> >>
> >>
> >>
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
> >> >>on>
> >> >> ?date .
> >> >>
> >> >>      ?document <
> >> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType>
> >> "exam
> >> >> results"
> >> >>
> >> >>    }
> >> >>
> >> >> GROUP BY ?yearmonth
> >> >>
> >> >> However, this is not a valid query; notice that the BIND has gone, it
> >> >> somehow turned to a alias on query's head.
> >> >>
> >> >> ARQ 2.8.8. upon receiving this query, yields the error:
> >> >>
> >> >> Variable used when already in-scope: ?yearmonth in
> >> >> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date),
> >>"yyyy-MM")
> >> >>AS
> >> >> ?yearmonth)
> >> >>
> >> >> Is that a bug on ARQ or OpAsQuery? Or anything else?
> >> >>
> >> >> Thanks!
> >> >>
> >> >> --
> >> >> diogo patrão
> >> >>
> >> >
> >>
> >>
>
>

Re: OpAsQuery generating invalid query

Posted by Rob Vesse <rv...@yarcdata.com>.
The syntax error was correct even in the current stable version


The problem was that the code for converting from an algebra back into a
query usually puts top level BIND as project expressions which in most
cases is semantically equivalent to the original query.  However when
there is a GROUP BY present it needs to recreate the BIND as an actual
BIND or you get the variable scope error.

In algebra terms a project expression and a BIND at the top level of the
query pattern are semantically equivalent bar the above proviso about
interaction with GROUP BY

Rob

On 4/1/13 7:47 PM, "Diogo FC Patrao" <dj...@gmail.com> wrote:

>Hello Rob
>
>Should now be fixed, build from latest Trunk or wait 24 hrs or so for the
>> snapshot to get build and deployed by the Apache build server
>>
>
>* THANKS a million * ! I'm running a couple of experiments for my PhD
>thesis, and was getting the excuses done, for that bug messed up part of
>my
>data. Now I can get everything right. Thanks, thanks.
>
>
>> What version of ARQ are you using to do the OpAsQuery? I assume
>> 2.10.1-SNAPSHOT since turning this type of query from its algebra back
>> into a query only very recently became possible.  Previously the BIND
>> would have been lost completely when converting back from an algebra to
>>a
>> query.
>>
>
>The jar file says "2.10.0", I just downloaded the latest stable version.
>
>
>> Also is there a reason you are using ARQ 2.8.8 in your system?  That's
>> very out of date (about 2 years so) now.
>>
>
>well, I'm running this experiment for one year and two months now, and
>just
>copied the binaries and stuff that were working. TLDR: lazy.
>
>anyway, 2.10.0 ARQ yielded the same error.
>
>However, should defining an alias on the query head allow referring to it
>elsewhere? Are alias and BINDs really equivalent? MySQL have this
>behaviour, but not Oracle.
>
>Thanks (again).
>
>dfcp
>
>
>
>
>> Andy - The report states that the query is passed off to a system
>>running
>> 2.8.8, even with this fix did ARQ support BIND syntax that far back?
>>I.e.
>> will this fix just move the error elsewhere?
>>
>> Rob
>>
>>
>>
>> On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:
>>
>> >Hi there,
>> >
>> >Thanks for the report. I've captured this as:
>> >
>> >https://issues.apache.org/jira/browse/JENA-429
>> >
>> >       Andy
>> >
>> >On 31/03/13 21:11, Diogo FC Patrao wrote:
>> >> Hello
>> >>
>> >> I was performing a simple test with OpAsQuery:
>> >>
>> >> Here is the original query:
>> >>
>> >> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
>> >> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>> >> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
>> >>
>> >>      SELECT ?yearmonth ( count(?document) as ?total )
>> >>      WHERE
>> >>      {
>> >>          ?document a :Document;
>> >>                   :documentDateOfCreation ?date ;
>> >>                   :documentType "exam results" .
>> >>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
>> >> ?yearmonth )
>> >>      } group by ?yearmonth
>> >>
>> >> Then I ran the code below, that compile the algebra then render the
>> >>query
>> >> again.
>> >>
>> >> Query query = QueryFactory.create( that_query_above,
>> >> Syntax.syntaxSPARQL_11);
>> >>
>> >> Op op = Algebra.compile(query);
>> >>
>> >> System.out.println(OpAsQuery.asQuery(op));
>> >>
>> >> The result is below:
>> >>
>> >> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
>> >> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
>> >>?yearmonth)
>> >> (count(?document) AS ?total)
>> >>
>> >> WHERE
>> >>
>> >>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
>> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
>> >>
>> >>      ?document <
>> >>
>> >>
>> 
>>http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
>> >>on>
>> >> ?date .
>> >>
>> >>      ?document <
>> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType>
>> "exam
>> >> results"
>> >>
>> >>    }
>> >>
>> >> GROUP BY ?yearmonth
>> >>
>> >> However, this is not a valid query; notice that the BIND has gone, it
>> >> somehow turned to a alias on query's head.
>> >>
>> >> ARQ 2.8.8. upon receiving this query, yields the error:
>> >>
>> >> Variable used when already in-scope: ?yearmonth in
>> >> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date),
>>"yyyy-MM")
>> >>AS
>> >> ?yearmonth)
>> >>
>> >> Is that a bug on ARQ or OpAsQuery? Or anything else?
>> >>
>> >> Thanks!
>> >>
>> >> --
>> >> diogo patrão
>> >>
>> >
>>
>>


Re: OpAsQuery generating invalid query

Posted by Diogo FC Patrao <dj...@gmail.com>.
Hello Rob

Should now be fixed, build from latest Trunk or wait 24 hrs or so for the
> snapshot to get build and deployed by the Apache build server
>

* THANKS a million * ! I'm running a couple of experiments for my PhD
thesis, and was getting the excuses done, for that bug messed up part of my
data. Now I can get everything right. Thanks, thanks.


> What version of ARQ are you using to do the OpAsQuery? I assume
> 2.10.1-SNAPSHOT since turning this type of query from its algebra back
> into a query only very recently became possible.  Previously the BIND
> would have been lost completely when converting back from an algebra to a
> query.
>

The jar file says "2.10.0", I just downloaded the latest stable version.


> Also is there a reason you are using ARQ 2.8.8 in your system?  That's
> very out of date (about 2 years so) now.
>

well, I'm running this experiment for one year and two months now, and just
copied the binaries and stuff that were working. TLDR: lazy.

anyway, 2.10.0 ARQ yielded the same error.

However, should defining an alias on the query head allow referring to it
elsewhere? Are alias and BINDs really equivalent? MySQL have this
behaviour, but not Oracle.

Thanks (again).

dfcp




> Andy - The report states that the query is passed off to a system running
> 2.8.8, even with this fix did ARQ support BIND syntax that far back?  I.e.
> will this fix just move the error elsewhere?
>
> Rob
>
>
>
> On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:
>
> >Hi there,
> >
> >Thanks for the report. I've captured this as:
> >
> >https://issues.apache.org/jira/browse/JENA-429
> >
> >       Andy
> >
> >On 31/03/13 21:11, Diogo FC Patrao wrote:
> >> Hello
> >>
> >> I was performing a simple test with OpAsQuery:
> >>
> >> Here is the original query:
> >>
> >> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
> >> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> >> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
> >>
> >>      SELECT ?yearmonth ( count(?document) as ?total )
> >>      WHERE
> >>      {
> >>          ?document a :Document;
> >>                   :documentDateOfCreation ?date ;
> >>                   :documentType "exam results" .
> >>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
> >> ?yearmonth )
> >>      } group by ?yearmonth
> >>
> >> Then I ran the code below, that compile the algebra then render the
> >>query
> >> again.
> >>
> >> Query query = QueryFactory.create( that_query_above,
> >> Syntax.syntaxSPARQL_11);
> >>
> >> Op op = Algebra.compile(query);
> >>
> >> System.out.println(OpAsQuery.asQuery(op));
> >>
> >> The result is below:
> >>
> >> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
> >> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
> >>?yearmonth)
> >> (count(?document) AS ?total)
> >>
> >> WHERE
> >>
> >>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
> >>
> >>      ?document <
> >>
> >>
> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
> >>on>
> >> ?date .
> >>
> >>      ?document <
> >> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType>
> "exam
> >> results"
> >>
> >>    }
> >>
> >> GROUP BY ?yearmonth
> >>
> >> However, this is not a valid query; notice that the BIND has gone, it
> >> somehow turned to a alias on query's head.
> >>
> >> ARQ 2.8.8. upon receiving this query, yields the error:
> >>
> >> Variable used when already in-scope: ?yearmonth in
> >> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date), "yyyy-MM")
> >>AS
> >> ?yearmonth)
> >>
> >> Is that a bug on ARQ or OpAsQuery? Or anything else?
> >>
> >> Thanks!
> >>
> >> --
> >> diogo patrão
> >>
> >
>
>

Re: OpAsQuery generating invalid query

Posted by Rob Vesse <rv...@yarcdata.com>.
Should now be fixed, build from latest Trunk or wait 24 hrs or so for the
snapshot to get build and deployed by the Apache build server

Diogo:

What version of ARQ are you using to do the OpAsQuery? I assume
2.10.1-SNAPSHOT since turning this type of query from its algebra back
into a query only very recently became possible.  Previously the BIND
would have been lost completely when converting back from an algebra to a
query.

Also is there a reason you are using ARQ 2.8.8 in your system?  That's
very out of date (about 2 years so) now.

Andy - The report states that the query is passed off to a system running
2.8.8, even with this fix did ARQ support BIND syntax that far back?  I.e.
will this fix just move the error elsewhere?

Rob



On 4/1/13 12:42 PM, "Andy Seaborne" <an...@apache.org> wrote:

>Hi there,
>
>Thanks for the report. I've captured this as:
>
>https://issues.apache.org/jira/browse/JENA-429
>
>	Andy
>
>On 31/03/13 21:11, Diogo FC Patrao wrote:
>> Hello
>>
>> I was performing a simple test with OpAsQuery:
>>
>> Here is the original query:
>>
>> PREFIX : <http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>
>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>> PREFIX mylib: <java:dateadd.lib.pkgfor.arq.>
>>
>>      SELECT ?yearmonth ( count(?document) as ?total )
>>      WHERE
>>      {
>>          ?document a :Document;
>>                   :documentDateOfCreation ?date ;
>>                   :documentType "exam results" .
>>          BIND( mylib:DateFormat( xsd:string(?date), "yyyy-MM" ) as
>> ?yearmonth )
>>      } group by ?yearmonth
>>
>> Then I ran the code below, that compile the algebra then render the
>>query
>> again.
>>
>> Query query = QueryFactory.create( that_query_above,
>> Syntax.syntaxSPARQL_11);
>>
>> Op op = Algebra.compile(query);
>>
>> System.out.println(OpAsQuery.asQuery(op));
>>
>> The result is below:
>>
>> SELECT  (<java:dateadd.lib.pkgfor.arq.DateFormat>(<
>> http://www.w3.org/2001/XMLSchema#string>(?date), "yyyy-MM") AS
>>?yearmonth)
>> (count(?document) AS ?total)
>>
>> WHERE
>>
>>    { ?document <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
>> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#Document> .
>>
>>      ?document <
>> 
>>http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentDateOfCreati
>>on>
>> ?date .
>>
>>      ?document <
>> http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#documentType> "exam
>> results"
>>
>>    }
>>
>> GROUP BY ?yearmonth
>>
>> However, this is not a valid query; notice that the BIND has gone, it
>> somehow turned to a alias on query's head.
>>
>> ARQ 2.8.8. upon receiving this query, yields the error:
>>
>> Variable used when already in-scope: ?yearmonth in
>> (<java:dateadd.lib.pkgfor.arq.DateFormat>(xsd:string(?date), "yyyy-MM")
>>AS
>> ?yearmonth)
>>
>> Is that a bug on ARQ or OpAsQuery? Or anything else?
>>
>> Thanks!
>>
>> --
>> diogo patrão
>>
>