That is what I thought the answer might be. Thanks for the clarification. I can now move forward with the fix to querybuilder.
On Wed, Sep 23, 2015 at 2:42 PM, Rob Vesse <[email protected]> wrote: > ElementTriplesBlock is only triple patterns > > ElementPathBlock is a mix of triple patterns and property paths > > In SPARQL 1.1 mode ElementPathBlock is always used, ElementTriplesBlock > primarily exists from SPARQL 1.0 days and is kept for backwards > compatibility > > Generally it is better to use ElementPathBlock because it is more flexible > and an ElementPathBlock with only triple patterns is equivalent to a > ElementTriplesBlock with the same triple patterns once we compile to > algebra anyway > > Rob > > On 23/09/2015 14:03, "Claude Warren" <[email protected]> wrote: > > >I have a fix for he missing operation using a pattern already found > >elsewhere (basically queryBuilder.addOptional( queryBuilder )) but I was > >working on the testing and thought I would try the suggestion to clean up > >the querybuilder tests by running the same query through the standard > >queryFactory.create( string ) method. > > > >The textual output of the 2 looked the same but the equality failed > >because > >the querybuilder used an ElementTriplesBlock and the queryFactory used an > >ElementPathBlock. > > > >So my questions are: > > > >What is the difference between the ElementTripleBlock and the > >ElementPathBlock? > > > >When should one be used over the other? > > > >Thx, > >Claude > > > >On Mon, Sep 21, 2015 at 5:55 PM, Andy Seaborne <[email protected]> wrote: > > > >> On 20/09/15 11:18, Claude Warren wrote: > >> > >>> Andy, > >>> > >>> I started to work on a solution which was fairly simple until I > >>>started to > >>> run the test. I tried creating a query with the same optional block. > >>> However, while they both looked like: > >>> {noformat} > >>> > >>> OPTIONAL > >>> { ?s <urn:q> "123"^^<http://www.w3.org/2001/XMLSchema#int> ; > >>> <urn:v> ?x > >>> FILTER ( ?x > 56 ) > >>> } > >>> > >>> {noformat} > >>> > >>> the one built by querybuilder is using an ElementTriplesBlock for the: > >>> {noformat} > >>> > >>> ?s <urn:q> "123"^^<http://www.w3.org/2001/XMLSchema#int> ; > >>> <urn:v> ?x > >>> > >>> {noformat} > >>> > >>> while the queryFactory version uses an ElementPathBlock. > >>> > >>> I suspect this is as defect in the querybuilder but can you explain the > >>> difference and when one or the other should be used? > >>> > >> > >> ElementGroup > >> > >> This is unit for OPTIONAL and other compound structures. It can hold > >> several ElementPathBlock, ElementFilter, ElementOptional. Indeed, it > >>can > >> hold other ElementGroup. > >> > >> Do not confuse with GROUP BY - unrelated. ElementGroup is SPARQL 1.0 and > >> then the term "group" was free. > >> > >> WhereHandler, other than it's name, looks (by inspection) to be close in > >> concept. > >> > >> It needs "addPattern(WhereHandler)" which is why the name looks odd to > >>me. > >> > >> This gives the inner {} in: > >> { ?s1 ?p1 ?o1 > >> { ?s ?p ?o } > >> ?s2 ?p2 ?o2 > >> } > >> > >> so maybe: untested: > >> > >> WhereHandler -> PatternHandler > >> without setVars > >> ?? addAll(PatternHandler) > >> > >> WhereHandler becomes subclass of PatternHandler. > >> with setVars - the only action that only applies to WHERE > >> > >> WhereHandler::addAll looks odd - only considers ElementTriplesBlock in > >> some cases. > >> > >> Andy > >> > >> > >>> Claude > >>> > >>> On Sun, Sep 20, 2015 at 10:19 AM, Claude Warren <[email protected]> > >>>wrote: > >>> > >>> No there isn't. It is an oversight. Looks like QueryBuilder needs to > >>>> have a group pattern. I think that this could be done by using a > >>>> SelectBuilder as a container the group pattern as we can get a > >>>> WhereHandler > >>>> from it and that seems to have all the bits that are needed. > >>>> > >>>> Claude > >>>> > >>>> On Sat, Sep 19, 2015 at 3:10 PM, Andy Seaborne <[email protected]> > >>>>wrote: > >>>> > >>>> how do I add > >>>>> > >>>>> OPTIONAL { > >>>>> ?s <q> 123 . > >>>>> ?s <v> ?x . > >>>>> FILTER(?x>56) > >>>>> } > >>>>> > >>>>> i.e a compound OPTIONAL pattern? > >>>>> > >>>>> There seems to be no concept of a group pattern (do not confuse with > >>>>> GROUP BY). > >>>>> > >>>>> (This applies all places group patterns occur, which is quite a few > >>>>>in > >>>>> SPARQL) > >>>>> > >>>>> Andy > >>>>> > >>>>> > >>>> > >>>> > >>>> -- > >>>> 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
