when removing the triple (?boss ex:isBossOf ?ind .”), I get

SELECT DISTINCT  ?ind ?boss ?g
WHERE
   {   { ?ind  rdf:type  ?z }
     UNION
       {   { ?boss  ex:isBossOf1  ?ind }
         UNION
           { # Empty BGP

           }
       }
   }

which is OK.
I just need to find out how to remove an ElementGroup which contains only one 
element which is the EMPTY one.
Of course, I need to do the same for the other case, e.g. OPTION, SUBquery, etc.

Do note that evaluating {} (empty syntax group) yields one row of zero columns - it contributes to the overall results (it's the join identity).

Now you have to look at all the elements that have a group in ElementUnion, ElementOptional, ElementMinus, ...

That is what ElementTransformCleanGroupsOfOne does, except it looks for "groups of one"

..  UNION { { stuff } }

and isn't to fussy about finding them all (it's an optimization, more a tidying of the tree, not a change in the effect of a query which is what removing triple patterns is).

And of course changes from the bottom could potentially cause change all the way up to the top of the syntax tree.

also: they maybe be original, legal empty groups in the tree.

    Andy





Reply via email to