hi Andy, I'll further enrich the test data and add JUnit tests in TestAPI for better coverage.
I'm thinking of the problem you mentioned. In fact, there're 2 types of query strings: a) Query String without Construct Quad, e.g. "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }"; b) Query String with Construct Quad, e.g. "CONSTRUCT { ?s ?p ?o GRAPH :g1 { :s1 ?p :o1 } } WHERE { ?s ?p ?o }" Also, the users can choose to execute 2 kinds of query methods: 1) Iterator<Triple> execTriples() 2) Iterator<Quad> execQuads() These make 4 cases: a)+1): No problem, original ARQ construct query b)+2): No problem, new construct quad query a)+2): The result quads are in the default graph? Or just throw exception saying the query string not working with the query method? b)+1)(you mentioned): The result triples contain only the "?s ?p ?o" part, ignoring construct "GRAPH :g1 { :s1 ?p :o1 }"? Or just throw exception saying the query string not working with the query method? Could you please tell me your opnions about the last 2 cases? regards, Qihong On Mon, Aug 10, 2015 at 9:58 PM, Andy Seaborne <a...@apache.org> wrote: > I've managed to integrate the latest updates. > > The scripted ones look, at first glance OK, but the data isn't very rich. > > Also, please can we have some API tests in "TestAPI". These are JUnit tests > in java. These should be have comprehensive coverage. > > I also tried out execConstructTriples(), I noticed that the result is from > all graphs. When just triples are asked for, only those in the default > graph should be returned. Template.getTriples calls Quad.asTriple. But it > needs to deal with just the default graph, and c can't rely on > Quad.asTriple. > > Andy > > > On 10/08/15 12:44, Qihong Lin wrote: >> >> Hi, >> >> I've enriched the syntax tests with "short form" and "default graph" >> cases. >> >> For execution tests, I add the test support in QueryTest for construct >> quad with the scripts files and data files in TRIG (see >> jena-arq/testing/ARQ/Construct/*.trig). I think construct quad should >> be part of the construct of ARQ. So I add the execution tests in >> jena-arq/testing/ARQ/Construct/manifest.ttl. >> >> The fuseki part of construct quad has been implemented (not committed >> yet). I'll submit the code as soon as the PR 89 [1] being merged. >> Anything to be improved for PR 89 from your reviews? >> >> regards, >> Qihong >> >> [1] https://github.com/apache/jena/pull/89 >> >> >> On Thu, Aug 6, 2015 at 8:55 PM, Andy Seaborne <a...@apache.org> wrote: >>> >>> Hi - looking better - I see the syntax tests I provided. >>> >>> Does that set of tests cover all cases of the new syntax? >>> >>> Next, we need execution tests for ARQ. >>> >>>> There will need to be execute tests in jena-arq as well. These can be >>>> Junit tests in java and do not need to be external script files. >>>> This is separate from testing in Fuseki. >>> >>> >>> >>> Do you have any other constraints on your time over the next 2 weeks? >>> >>> Andy >>> >>> >>> On 06/08/15 04:18, Qihong Lin wrote: >>>> >>>> >>>> Hi, >>>> >>>> I've fixed the bugs related to syntax checks. Please see my latest >>>> commits. Here're the output of the syntax files through qparse (you >>>> can also run "ExampleConstructQuads.java" to get the results). Are >>>> these with the expected behaviors, especially for >>>> "syntax-quad-construct-07.arq"? >>>> >>>> run-construct-quad-test: ======== File: syntax-quad-construct-01.arq >>>> PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH :g { :s :p :o } } WHERE {} ==== Output of qparse >>>> --file syntax-quad-construct-01.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH :g { :s :p :o .} } WHERE { } ======== File: >>>> syntax-quad-construct-02.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { ?s ?p ?o } } WHERE { ?s ?p ?o } ==== Output of >>>> qparse --file syntax-quad-construct-02.arq PREFIX : >>>> <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { ?s ?p ?o .} } WHERE { ?s ?p ?o } ======== >>>> File: syntax-quad-construct-03.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { :s :p :o } WHERE {} ==== Output of qparse --file >>>> syntax-quad-construct-03.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { :s :p :o . } WHERE { } ======== File: >>>> syntax-quad-construct-04.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o } ?s ?p ?o } WHERE { GRAPH ?g { ?s ?p >>>> ?o } } ==== Output of qparse --file syntax-quad-construct-04.arq >>>> PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o .} ?s ?p ?o . } WHERE { GRAPH ?g { ?s >>>> ?p ?o } } ======== File: syntax-quad-construct-05.arq PREFIX : >>>> <http://example/> >>>> >>>> CONSTRUCT { ?s ?p ?o GRAPH ?g { :s :p :o } } WHERE { GRAPH ?g { ?s ?p >>>> ?o } } ==== Output of qparse --file syntax-quad-construct-05.arq >>>> PREFIX : <http://example/> >>>> >>>> CONSTRUCT { ?s ?p ?o . GRAPH ?g { :s :p :o .} } WHERE { GRAPH ?g { ?s >>>> ?p ?o } } ======== File: syntax-quad-construct-06.arq PREFIX : >>>> <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o } ?s ?p ?o . ?s ?p ?o . GRAPH ?g { ?s >>>> ?p ?o } ?s ?p ?o . ?s ?p ?o GRAPH ?g { ?s ?p ?o } } WHERE { GRAPH ?g >>>> { ?s ?p ?o } } ==== Output of qparse --file >>>> syntax-quad-construct-06.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o .} ?s ?p ?o . ?s ?p ?o . GRAPH ?g { >>>> ?s ?p ?o .} ?s ?p ?o . ?s ?p ?o . GRAPH ?g { ?s ?p ?o .} } WHERE { >>>> GRAPH ?g { ?s ?p ?o } } ======== File: >>>> syntax-quad-construct-07.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {:s :p :o .} } WHERE >>>> {} ==== Output of qparse --file syntax-quad-construct-07.arq PREFIX >>>> : <http://example/> >>>> >>>> CONSTRUCT { :s :p :o . } WHERE { } ======== File: >>>> syntax-quad-construct-08.arq PREFIX : <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o } GRAPH ?g1 { :s :p :o } } WHERE { } >>>> ==== Output of qparse --file syntax-quad-construct-08.arq PREFIX : >>>> <http://example/> >>>> >>>> CONSTRUCT { GRAPH ?g { :s :p :o .} GRAPH ?g1 { :s :p :o .} } WHERE { >>>> } >>>> >>>> On Sun, Aug 2, 2015 at 9:14 AM, Ying Jiang <jpz6311...@gmail.com> >>>> wrote: >>>>> >>>>> >>>>> Hi Qihong, >>>>> >>>>> I re-checked the code you commited. Most of the hashCode issues >>>>> for arq.qparse that Andy pointed out are due to the incorrect >>>>> serialization of the Template. The code can only deal with the >>>>> quads with the same graph node, for which it may not always be the >>>>> case in practcial terms. Please make sure each example syntax file >>>>> can pass the checking process of arq.qparse. >>>>> >>>>> It's August now. You'd better hurry up and make the project >>>>> completed on time in the remaining weeks. >>>>> >>>>> Best regards, Ying Jiang >>>>> >>>>> On Thu, Jul 30, 2015 at 6:03 AM, Andy Seaborne <a...@apache.org> >>>>> wrote: >>>>>> >>>>>> >>>>>> Output of * each examnple syntax file (the queries are nonsense >>>>>> in practcial terms!) * running arq.qparse on the file * notes on >>>>>> what seems to be going on >>>>>> >>>>>> Andy >>>>>> >>>>>> ======== File: syntax-quad-construct-01.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH :g { :s :p :o } } WHERE {} ==== Output of >>>>>> qparse --file syntax-quad-construct-01.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <http://example/g> {:s :p :o .} } WHERE { } >>>>>> ---- Issue: Minor: formatting of <http://example/g> should be :g >>>>>> >>>>>> ======== File: syntax-quad-construct-02.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g { ?s ?p ?o } } WHERE { ?s ?p ?o } ==== >>>>>> Output of qparse --file syntax-quad-construct-02.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {?s ?p ?o .} } WHERE { ?s ?p ?o } ---- OK >>>>>> >>>>>> ======== File: syntax-quad-construct-03.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { :s :p :o } WHERE {} ==== Output of qparse --file >>>>>> syntax-quad-construct-03.arq PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {:s :p :o .} } >>>>>> WHERE { } ---- Issue: Major: The output is contains "GRAPH >>>>>> <urn:x-arq:DefaultGraphNode>" >>>>>> >>>>>> Note: <urn:x-arq:DefaultGraphNode> is for internal use only. >>>>>> >>>>>> For syntax, that is a named graph just like <http://example/g> >>>>>> >>>>>> ======== File: syntax-quad-construct-04.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g { :s :p :o } ?s ?p ?o } WHERE { GRAPH ?g { >>>>>> ?s ?p ?o } } >>>>>> >>>>>> ==== Output of qparse --file syntax-quad-construct-04.arq >>>>>> >>>>>> **** Check failure: reparsed query hashCode does not equal parsed >>>>>> input query Query (hashCode: 1768688961)= PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o .} } WHERE { GRAPH ?g { >>>>>> ?s ?p ?o } } >>>>>> >>>>>> >>>>>> Query2 (hashCode: 1896249441)= PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o .} } WHERE { GRAPH ?g { >>>>>> ?s ?p ?o } } >>>>>> >>>>>> PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o .} } WHERE { GRAPH ?g { >>>>>> ?s ?p ?o } } ---- Issue: The output puts the following triple >>>>>> into the GRAPH. See also syntax-quad-construct-08.arq >>>>>> >>>>>> ======== File: syntax-quad-construct-05.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { ?s ?p ?o GRAPH ?g { :s :p :o } } WHERE { GRAPH ?g { >>>>>> ?s ?p ?o } } >>>>>> >>>>>> ==== Output of qparse --file syntax-quad-construct-05.arq >>>>>> >>>>>> **** Check failure: reparsed query hashCode does not equal parsed >>>>>> input query Query (hashCode: -262437683)= PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {?s ?p ?o . :s :p >>>>>> :o .} } WHERE { GRAPH ?g { ?s ?p ?o } } >>>>>> >>>>>> >>>>>> Query2 (hashCode: -399379987)= PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {?s ?p ?o . :s :p >>>>>> :o .} } WHERE { GRAPH ?g { ?s ?p ?o } } >>>>>> >>>>>> PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {?s ?p ?o . :s :p >>>>>> :o .} } WHERE { GRAPH ?g { ?s ?p ?o } } ---- Issue: Plain ?s ?p >>>>>> ?o has been put into a named graph Adjacent blocks have merged. >>>>>> >>>>>> ======== File: syntax-quad-construct-06.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g { :s :p :o } ?s ?p ?o . ?s ?p ?o . GRAPH ?g >>>>>> { ?s ?p ?o } ?s ?p ?o . ?s ?p ?o GRAPH ?g { ?s ?p ?o } } WHERE { >>>>>> GRAPH ?g { ?s ?p ?o } } >>>>>> >>>>>> ==== Output of qparse --file syntax-quad-construct-06.arq >>>>>> >>>>>> **** Check failure: reparsed query hashCode does not equal parsed >>>>>> input query Query (hashCode: -1800516808)= PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o >>>>>> . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o .} } WHERE { GRAPH ?g { ?s ?p >>>>>> ?o } } >>>>>> >>>>>> >>>>>> Query2 (hashCode: -129418312)= PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o >>>>>> . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o .} } WHERE { GRAPH ?g { ?s ?p >>>>>> ?o } } >>>>>> >>>>>> PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o >>>>>> . ?s ?p ?o . ?s ?p ?o . ?s ?p ?o .} } WHERE { GRAPH ?g { ?s ?p >>>>>> ?o } } ---- Issue: Same as previous. >>>>>> >>>>>> ======== File: syntax-quad-construct-07.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {:s :p :o .} } >>>>>> WHERE {} >>>>>> >>>>>> ==== Output of qparse --file syntax-quad-construct-07.arq PREFIX >>>>>> : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH <urn:x-arq:DefaultGraphNode> {:s :p :o .} } >>>>>> WHERE { } ---- Issue: Should be different. A named graph of >>>>>> GRAPH <urn:x-arq:DefaultGraphNode> is not the default graph. >>>>>> >>>>>> ======== File: syntax-quad-construct-08.arq PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g { :s :p :o } GRAPH ?g1 { :s :p :o } } WHERE >>>>>> { } >>>>>> >>>>>> ==== Output of qparse --file syntax-quad-construct-08.arq >>>>>> >>>>>> **** Check failure: reparsed query hashCode does not equal parsed >>>>>> input query Query (hashCode: 636900208)= PREFIX : >>>>>> <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . :s :p :o .} } WHERE { } >>>>>> >>>>>> >>>>>> Query2 (hashCode: 636999583)= PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . :s :p :o .} } WHERE { } >>>>>> >>>>>> PREFIX : <http://example/> >>>>>> >>>>>> CONSTRUCT { GRAPH ?g {:s :p :o . :s :p :o .} } WHERE { } ---- >>>>>> Issue: Adjacent GRAPH blocks have merged. >>>>>> >>> >