# Formal defintion of nested optionals

From: Jorge Pérez <jperez@utalca.cl>
Date: Fri, 31 Mar 2006 13:30:58 -0400
Message-ID: <1143826258.442d6752196f3@webmail.utalca.cl>

```
Hi!, I try but I cannot find an answer to my question in the mailing

The right answer for an optional pattern is very clear when there is no
nesting, i.e. when one can easily read the formal defintion "S is a
solution of OPT(A,B) if S is a...". I understand that OPT(A, B) refeers
to

{
A .
OPTIONAL { B }
}

But when there is a nested optional pattern it appears to be a confusion,
for:

{
A .
OPTIONAL {
B .
OPTIONAL { C }
}
}

What is the right answer? I think that there are at least two
posibilities:

1) one is to think in the composition of two binary operations, a
binary operation between B and C, and a binary operation between
A and the result of the previous operation, something like
OPT(A, OPT(B, C)). The formal defintion in this case is clear
followind the doc: S is a solution of OPT(A, OPT(B,C)) if S is a
solution of A and of OPT(B, C) otherwise if S is a solution to A
but not to A and OPT(B, C).

2) the other posibility is to think of the application of one single
ternary operation, i.e. somethign like OPT(A, B, C). The formal
definition here would be: S is a solution of OPT(A, B, C) if S is a
solution of A and B and C, otherwise if S is a solution of A and B but
not of C, otherwise if S is a solution to A but not to B.

In the last draft it seems that when defining formally the optional
matching the editors agree with 1) for nesting when thay say
"a combination of two patterns...". But when they are informally
reading the examples of nested optional patterns I think they agree
with 2). When looking in some implementations (SPARQLer for example)
they seems to use 2. for evaluation...

What is the right formal definition of nested patterns?
Thanks...

--------
Jorge Pérez R.
http://ing.utalca.cl/~jperez

-------------------------------------------------
Este mensaje fue enviado por: http://webmail.utalca.cl
```
Received on Sunday, 2 April 2006 02:20:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:50 GMT