# RE: Refining Optionals

```> -----Original Message-----
> From: Seaborne, Andy [mailto:andy.seaborne@hp.com]
> Sent: Monday, June 27, 2005 8:14 AM
> To: RDF Data Access Working Group; Geoff Chappell
> Subject: Refining Optionals
>
[...]

> == Outline
>
> This is an informal description of definitions : it will need formalizing.
>
> We also require that in a group:
>
> ?x = "junk"
> For this, we require that if ?x is not mentioned in BP then ?x solves the
> pattern of one of Opt1, Opt2 so writing Opt1 = OPTIONAL(P1) then ?x is a
> solution of some Pi.
>
> ?x = unbound
> If ?x occurs in some Pi and BP.Pi has a solution, then a solution with ?x
> unbound is not considered a solution of the group.
>
> This looks as if it can be combined in to a condition for a group solution
> S
> involving ?x, where ?x is mentioned in some optional Opt(Pi), then ?x is a
> solution BP.Pi or no BP.Pj has a solution and ?x is unbound.  This is now
> defining optional as a "solution extension" to solutions of the basic
> pattern in
> the group.
>
> Details still need to be worked out but I'd appreciate comments and
> feedback on
> the approach.

So by this approach, given data:

:x1 :p1 :v1
:x1 :p2 :v2

This query:

optional {?s :p1 ?o1} optional (?s :p2 ?o2}

would yield:

?s=:x1 ?o1=:v1 ?o2=:v2

and not (e.g.):

?s=:x1, ?o2=:v2
or
?s=:x1, ?o1=:v2, ?o2=:v2

since ?o1 is bound in at least one of the optional patterns?

But then why not apply that same logic to unions? e.g

{{?s :p1 ?o1} union {?s :p2 ?o2}}

Would you expect the answer to be:

(?s=:x1, ?o1=:v1), (?s=:x1, ?o2=:v2)

or

(?s=:x1, ?o1=:v1, ?o2=:v2)

The unwanted results in the optional cases stem from the implied disjunction
in optional (A or not A), so it might seem inconsistent to treat them
differently than unions. But that seems a bit bizarre - i.e. why is:

(?s=:x1, ?o1=:v1, ?o2=:v2)

any more of a solution than:

(?s=:x1, ?o1=:v2, ?o2=:v2)

??

BTW, do you have an example of how nested optionals would be treated by this
approach?

-Geoff
```

Received on Tuesday, 28 June 2005 14:44:53 UTC