W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2004

RE: b*c*b*c* vs. (b*c*)^2,2

From: Michael Kay <mhk@mhk.me.uk>
Date: Thu, 12 Feb 2004 10:47:56 -0000
To: "'Torsten Grust'" <Torsten.Grust@uni-konstanz.de>, <xmlschema-dev@w3.org>
Message-ID: <000701c3f155$ad923420$6401a8c0@pcukmka>

I think the confusion is due to the technical use of the term
"ambiguity". 

In popular language, it's completely clear which set of strings the
expression b*c*b*c* matches. The "ambiguity" is because the system
(unlike the user) doesn't just want to know whether a string matches the
sequence, it wants to know which particle each of the input elements
matches, and there are two (or three?) possible different ways of
matching the input bc.

When you write it as (b*c*) there are only two particles and so the
system knows which particle matches each input element.

An interesting example, though!

Michael Kay

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Torsten Grust
> Sent: 12 February 2004 09:40
> To: xmlschema-dev@w3.org
> Subject: b*c*b*c* vs. (b*c*)^2,2
> 
> 
> 
> G'day all,
> 
>   I would be very grateful if anybode could enlighten me on 
> the following ambiguity issue.
> 
> The following declaration for element a is clearly ambigious 
> (and XSV 2.6-2 complains accordingly):
> 
>   <xs:element name="a">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="b" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>         <xs:element name="c" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>         <xs:element name="b" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>         <xs:element name="c" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> 
> The content model for element a essentially is b*c*b*c*.
> 
> If I rephrase the schema as follows, the content model 
> language for element a does not change and---surprisingly to 
> me---there is no ambiguity issue anymore according to XSV:
> 
>   <xs:element name="a">
>     <xs:complexType>
>       <xs:sequence minOccurs="2" maxOccurs="2">
>         <xs:element name="b" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>         <xs:element name="c" type="xs:integer"
>                     minOccurs="0" maxOccurs="unbounded"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> 
> The content model now is (b*c*)^2,2 (where r^n,m represents 
> an n-fold minimum and m-fold maximum occurence of r).
> 
> I fail to see how this reformulation resolves the ambiguity.  
> I would greatly appreciate any insight on this.
> 
> Best wishes and thank you,
>    --Torsten
> 
> --
>   | Dr. Torsten Grust                          
> Torsten.Grust@uni-konstanz.de |
>   |                                   
> http://www.inf.uni-konstanz.de/~grust/ |
>   | Database 
> Research Group, University of Konstanz (Lake Constance/Germany) |
>   |             (Please avoid sending me MS Word or 
> PowerPoint attachments.) |
> 
Received on Thursday, 12 February 2004 05:47:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:41 GMT