John Apache list strips attachments, if you have a code sample please just paste it into the email or provide a link to a pastebin/similar site with your code sample
Rob On 4/23/13 11:02 AM, "John Liu" <[email protected]> wrote: >Thanks Andy for your quick reply. > >I tested Jena 2.10.1 and the problem still exists. Could you please run >the attached java code to see if it is a defect? > >Thanks, John > > >________________________________ > From: Andy Seaborne <[email protected]> >To: [email protected] >Sent: Tuesday, April 23, 2013 10:46:25 AM >Subject: Re: problem in rewriting query by AlgebraGenerator > > >On 23/04/13 03:10, John Liu wrote: >> Hello, >> I found a problem when rewriting a query by AlgebraGenerator, the >> generated query becomes syntax incorrect query. Can you please advise if >> this is a defect? Thanks. >> The version of JENA I tested is 2.7.1 > >There have been various improvements and fixes in this area which you'll >find in Jena 2.10.0 and in the active development system 2.10.1-SNAPSHOT >(from the Apache snapshot maven repository) > > Andy > >> The code I rewrite the query is: >> Query query = QueryFactory./create/(queryString); >> AlgebraGenerator ag = >> *new*AlgebraGenerator(); >> Op op = ag.compile(query); >> Query query2 = OpAsQuery./asQuery/(op); >> The original query is: >> PREFIX dcterms: <http://purl.org/dc/terms/> >> PREFIX dbpedia: <http://dbpedia.org/resource/> >> SELECT ?num_of_holidays ?celebrate_Chinese_New_Year WHERE { >> {SELECT ?country_cat (COUNT(?holiday) as ?num_of_holidays) >> WHERE {?country_cat <http://www.w3.org/2004/02/skos/core#broader> >> <http://dbpedia.org/resource/Category:Public_holidays_by_country>. >> ?holiday dcterms:subject ?country_cat >> }GROUP by ?country_cat >> } >> { >> SELECT ?country_cat (COUNT(?holiday) as ?celebrate_Chinese_New_Year) >> WHERE { >> ?country_cat <http://www.w3.org/2004/02/skos/core#broader> >> <http://dbpedia.org/resource/Category:Public_holidays_by_country>. >> ?holiday dcterms:subject ?country_cat >> FILTER(?holiday="http://dbpedia.org/resource/Lunar_New_Year's_Day") >> }GROUP by ?country_cat >> } >> } >> The generated query is: >> SELECT ?country_cat ?celebrate_Chinese_New_Year >> WHERE >> { { ?country_cat <http://www.w3.org/2004/02/skos/core#broader> >> <http://dbpedia.org/resource/Category:Public_holidays_by_country> . >> ?holiday <http://purl.org/dc/terms/subject> ?country_cat >> BIND(count(?holiday) AS ?num_of_holidays) >> } >> { ?country_cat <http://www.w3.org/2004/02/skos/core#broader> >> <http://dbpedia.org/resource/Category:Public_holidays_by_country> . >> ?holiday <http://purl.org/dc/terms/subject> ?country_cat >> FILTER ( ?holiday = "http://dbpedia.org/resource/Lunar_New_Year's_Day" ) >> BIND(count(?holiday) AS ?celebrate_Chinese_New_Year) >> } >> } >> GROUP BY ?country_cat >> The generated query has a syntax error: "Line 5, column 12: Aggregate >> expression not legal at this point". >> Attached is a hava program to demonstrate the problem, >>
