Dear Andy,

Thank you for your time. Very appreciated.
Some comments follow in lines.

> On 2 Feb 2016, at 09:36, Andy Seaborne <a...@apache.org> wrote:
>
>
>> 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).
>
I see. To avoid this I am going to apply a ElementTransformCleanGroupsOfOne as 
you suggested.


> Now you have to look at all the elements that have a group in ElementUnion, 
> ElementOptional, ElementMinus, …
Yes, I need to cover all the SPARQL language from the “public Element 
transform(ElementGroup arg0, List<Element> arg1)” call.
At least this is my understanding so far.


>
> 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.
>
Thanks for the detailed clarifications. Indeed, I will consider them.

Many Thanks,
Best Regards,
Carlo



>    Andy
>
>
>
>
>

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England & Wales and a charity registered in Scotland (SC 038302). 
The Open University is authorised and regulated by the Financial Conduct 
Authority.

Reply via email to