precedence

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

precedence

Alan Ruttenberg-2
the expression: a and b or c and d is parsed as (a and (b or c) and d)

Is that right?

http://www.w3.org/TR/owl2-manchester-syntax/#Descriptions

says:

The infix notation for descriptions is ambiguous as stated. This
ambiguity is resolved in the usual way, with later productions in the
description grammar below binding more tightly, so, for example,

description ::= conjunction 'or' conjunction { 'or' conjunction }
         | conjunction
conjunction ::= classIRI 'that' [ 'not' ] restriction { 'and' [ 'not'
] restriction }
         | primary 'and' primary { 'and' primary }
         | primary
primary ::= [ 'not' ] ( restriction | atomic )
....

-Alan
_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: precedence

Timothy Redmond

I believe you are right.  I set up a gforge for it here:

  https://sourceforge.net/tracker/?func=detail&aid=2946372&group_id=90989&atid=595534 
 

-Timothy

Alan Ruttenberg wrote:

> the expression: a and b or c and d is parsed as (a and (b or c) and d)
>
> Is that right?
>
> http://www.w3.org/TR/owl2-manchester-syntax/#Descriptions
>
> says:
>
> The infix notation for descriptions is ambiguous as stated. This
> ambiguity is resolved in the usual way, with later productions in the
> description grammar below binding more tightly, so, for example,
>
> description ::= conjunction 'or' conjunction { 'or' conjunction }
>          | conjunction
> conjunction ::= classIRI 'that' [ 'not' ] restriction { 'and' [ 'not'
> ] restriction }
>          | primary 'and' primary { 'and' primary }
>          | primary
> primary ::= [ 'not' ] ( restriction | atomic )
> ....
>
> -Alan
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>  

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: precedence

Jonathan Rees-3
In reply to this post by Alan Ruttenberg-2
There may be other ambiguities in the grammar, but I don't see one in this case.

atomic ::= 'a'    (etc.)
conjunction ::= 'a' 'and' 'b'
conjunction ::= 'c' 'and' 'd'
description ::= {'a' 'and' 'b'} 'or' {'c' 'and' 'd'}

Do you see a derivation I don't?

Jonathan

On Thu, Feb 4, 2010 at 10:34 PM, Alan Ruttenberg
<[hidden email]> wrote:

> the expression: a and b or c and d is parsed as (a and (b or c) and d)
>
> Is that right?
>
> http://www.w3.org/TR/owl2-manchester-syntax/#Descriptions
>
> says:
>
> The infix notation for descriptions is ambiguous as stated. This
> ambiguity is resolved in the usual way, with later productions in the
> description grammar below binding more tightly, so, for example,
>
> description ::= conjunction 'or' conjunction { 'or' conjunction }
>         | conjunction
> conjunction ::= classIRI 'that' [ 'not' ] restriction { 'and' [ 'not'
> ] restriction }
>         | primary 'and' primary { 'and' primary }
>         | primary
> primary ::= [ 'not' ] ( restriction | atomic )
> ....
>
> -Alan
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>
_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: precedence

Thomas Schneider-5
Hi Jonathan,

On 5 Feb 2010, at 12:24, Jonathan Rees wrote:

> There may be other ambiguities in the grammar, but I don't see one  
> in this case.
>
> atomic ::= 'a'    (etc.)
> conjunction ::= 'a' 'and' 'b'
> conjunction ::= 'c' 'and' 'd'
> description ::= {'a' 'and' 'b'} 'or' {'c' 'and' 'd'}
>
> Do you see a derivation I don't?

I think I understood that the grammar is unambiguous in this respect,  
but the class expression is parsed differently. The easiest way to  
test this is by adding four classes A,B,C,D and making D a subclass of  
"A and B or C". It will immediately be shown as a subclass of D  
although, according to the spec, it shouldn't.

For the Protégé team: I believe I've seen the convention "'and' binds  
more tightly than 'or'" elsewhere in logic, outside OWL, too.  
Therefore I would make a case for keeping the spec, changing the  
parsing, and either disambiguating the display or making it clear in  
the doc of P4 that 'A and B' is always in invisible brackets.

Cheers

Thomas

>
> Jonathan
>
> On Thu, Feb 4, 2010 at 10:34 PM, Alan Ruttenberg
> <[hidden email]> wrote:
>> the expression: a and b or c and d is parsed as (a and (b or c) and  
>> d)
>>
>> Is that right?
>>
>> http://www.w3.org/TR/owl2-manchester-syntax/#Descriptions
>>
>> says:
>>
>> The infix notation for descriptions is ambiguous as stated. This
>> ambiguity is resolved in the usual way, with later productions in the
>> description grammar below binding more tightly, so, for example,
>>
>> description ::= conjunction 'or' conjunction { 'or' conjunction }
>>         | conjunction
>> conjunction ::= classIRI 'that' [ 'not' ] restriction { 'and' [ 'not'
>> ] restriction }
>>         | primary 'and' primary { 'and' primary }
>>         | primary
>> primary ::= [ 'not' ] ( restriction | atomic )
>> ....
>>
>> -Alan
>> _______________________________________________
>> p4-feedback mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>>
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
+----------------------------------------------------------------------+
|  Dr Thomas Schneider                    schneider (at) cs.man.ac.uk  |
|  School of Computer Science       http://www.cs.man.ac.uk/~schneidt  |
|  Kilburn Building, Room 2.114                 phone +44 161 2756136  |
|  University of Manchester                                            |
|  Oxford Road                                             _///_       |
|  Manchester M13 9PL                                      (o~o)       |
+-----------------------------------------------------oOOO--(_)--OOOo--+

Dinder (vb.)
   To nod thoughtfully while someone gives you a long and complex set of
   directions which you know you're never going to remember.

                   Douglas Adams, John Lloyd: The Deeper Meaning of Liff







_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback

PGP.sig (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: precedence

Jonathan Rees-3
On Fri, Feb 5, 2010 at 7:43 AM, Thomas Schneider <[hidden email]> wrote:

> Hi Jonathan,
>
> On 5 Feb 2010, at 12:24, Jonathan Rees wrote:
>
>> There may be other ambiguities in the grammar, but I don't see one in this
>> case.
>>
>> atomic ::= 'a'    (etc.)
>> conjunction ::= 'a' 'and' 'b'
>> conjunction ::= 'c' 'and' 'd'
>> description ::= {'a' 'and' 'b'} 'or' {'c' 'and' 'd'}
>>
>> Do you see a derivation I don't?
>
> I think I understood that the grammar is unambiguous in this respect, but
> the class expression is parsed differently.

OK, I see, sorry I misunderstood

> The easiest way to test this is
> by adding four classes A,B,C,D and making D a subclass of "A and B or C". It
> will immediately be shown as a subclass of D although, according to the
> spec, it shouldn't.
>
> For the Protégé team: I believe I've seen the convention "'and' binds more
> tightly than 'or'" elsewhere in logic, outside OWL, too.

I think it goes back at least to the 1950s.  E.g. see
http://www.masswerk.at/algol60/report.htm  (also FORTRAN I believe).
But expecting a general reader encountering a boolean expression to
know this convention is a fantasy.
-Jonathan

> Therefore I would
> make a case for keeping the spec, changing the parsing, and either
> disambiguating the display or making it clear in the doc of P4 that 'A and
> B' is always in invisible brackets.
>
> Cheers
>
> Thomas
>
>>
>> Jonathan
>>
>> On Thu, Feb 4, 2010 at 10:34 PM, Alan Ruttenberg
>> <[hidden email]> wrote:
>>>
>>> the expression: a and b or c and d is parsed as (a and (b or c) and d)
>>>
>>> Is that right?
>>>
>>> http://www.w3.org/TR/owl2-manchester-syntax/#Descriptions
>>>
>>> says:
>>>
>>> The infix notation for descriptions is ambiguous as stated. This
>>> ambiguity is resolved in the usual way, with later productions in the
>>> description grammar below binding more tightly, so, for example,
>>>
>>> description ::= conjunction 'or' conjunction { 'or' conjunction }
>>>        | conjunction
>>> conjunction ::= classIRI 'that' [ 'not' ] restriction { 'and' [ 'not'
>>> ] restriction }
>>>        | primary 'and' primary { 'and' primary }
>>>        | primary
>>> primary ::= [ 'not' ] ( restriction | atomic )
>>> ....
>>>
>>> -Alan
>>> _______________________________________________
>>> p4-feedback mailing list
>>> [hidden email]
>>> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>>>
>> _______________________________________________
>> p4-feedback mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>
> +----------------------------------------------------------------------+
> |  Dr Thomas Schneider                    schneider (at) cs.man.ac.uk  |
> |  School of Computer Science       http://www.cs.man.ac.uk/~schneidt  |
> |  Kilburn Building, Room 2.114                 phone +44 161 2756136  |
> |  University of Manchester                                            |
> |  Oxford Road                                             _///_       |
> |  Manchester M13 9PL                                      (o~o)       |
> +-----------------------------------------------------oOOO--(_)--OOOo--+
>
> Dinder (vb.)
>  To nod thoughtfully while someone gives you a long and complex set of
>  directions which you know you're never going to remember.
>
>                  Douglas Adams, John Lloyd: The Deeper Meaning of Liff
>
>
>
>
>
>
>
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>
>
_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback