[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: What exactly is prohibited by the constraint of RELAX NG?
James Clark wrote: > I've mean struggling over the weekend to find a way to express our good > constraints. The best way I've found so far is to transform into the normal > form described at: Thank you very much. I am sorry for not being able to write mine. I am afraid that I lost the draft. Here are my understanding and comments. 1. #string >string ::= > <text/> > | <data ...>...</data> > | <value .../> Let Atm be a finite set of <text/>, <data ...>...</data>, and <value>...</value>. This set is finite, but we can always assume that all <data ..>..</data>, or <value>...</value> in a given grammar is contained by Atm. Atm stands for atomic. Any #string str represents an element of Atm. Conversely, any element of Atm can be represented by some #string str. 2. #tokens Sequences of <text/>, <data...>..</data>, or <value .../> matches a #tokens. As far as >tokens ::= > string > | <oneOrMore> tokens </oneOrMore> > | <group> tokens tokens </group> > | <interleave> tokens tokens </interleave> > | <choice> tokens tokens </group> > | <choice> <empty/> tokens </group> Any #tokens tks represents a regular language over Atm. Conversely, any regular language over Atm can be represented by some #tokens tks. Q0: Why do we need <empty/> here? 3. #value <text/>, <data...>..</data>, <value .../>, and <list>...</list> maches a #value. (We could disallow <text/>.) >value ::= > string > | <list> tokens </list> > | <list> <empty/> </list> > | <choice> value value </choice> > | <choice> <empty/> value </choice> Let Domain be the union of (a) the power set of Atm and (b) the class of regular languages over Atm. Every d in Domain is captured by some value v. Conversely, any value v represents some d in Domain. Q1: Why do we need <list> <empty/> </list>? Q2: <choice> <list> tokens1 </list> <list> tokens2 </list> </choice> can always be captured by <list> <choice>tokens1 tokens2 </choice> </list>, should we prohibit the former? (Probably not) 4. #mixed A sequence of non-terminals and <text/> matches a #mixed. >mixed ::= > <ref name="name"/> > | <text/> > | <group> mixed mixed </group> > | <interleave> mixed mixed </interleave> > | <choice> mixed mixed </choice> > | <choice> <empty/> mixed </choice> > | <oneOrMore> mixed </oneOrMore> A #mixed m represents a content model. Note that <data ...>...</data> and <value .../> are disallowed. <oneOrMore><text/></oneOrMore> is allowed. Let Nt be a set of non-terminals. This set is finite, but we can always assume that all non-terminals in a given grammar are cotained by Nt. Nt stand for Non-terminals. Any regular set over the union of {<text/>} and Nt is represented by some mixed m. Conversely, mixed m represents some regular set over the union of {<text/>} and Nt. 5. singleAttributeGroup ::= An attribute (e.g., foo="") matches a #singleAttributeGroup. A sequence of more than one attribute does not. >singleAttributeGroup ::= > <attribute> nc value </attribute> > | <attribute> nc <empty/> </attribute> > | <choice> <empty/> singleAttributeGroup </choice> Note: the end tag is fixed > | <choice> singleAttributeGroup singleAttributeGroup </choice> Note: the end tag is fixed Let NC be a set of URI+localNames, and let Att be the product of NC and Domain. A name class nc represents a subset of NC, but some subsets of NC are not captured by any name classes. A singleAttributeGroup sap represents a subset of the union of Att and {<empty/>}. Note that <attribute>nc <empty/> </attribute> is required, since value cannot represent the empty string or sequence. Q3: I do not understand why we need <choice> <empty/> singleAttributeGroup </choice>. If we did not have that, singleAttributeGroup capture a subset of Att. 6. attributeGroup A collection of attributes matches an #attributeGroup. >attributeGroup ::= > singleAttributeGroup > | <oneOrMore> singleAttributeGroup </oneOrMore> > | <group> attributeGroup attributeGroup </group> > | <interleave> attributeGroup attributeGroup </interleave> > | <choice> attributeGroup attributeGroup </choice> > | <choice> <empty/> attributeGroup </choice> Q4: Can we simply allow <empty/> as attributeGroup? Then, we do not need <choice> <empty/> attributeGroup </choice>. Q5: Or, can we simply disallow <empty/> here? An attributeGroup ag represents a mapping from some finite subset of NC to Domain. 7. repeatable Either a collection of attributes or a sequence of non-terminals and <text/> matches a #repeatable. In my understanding, the only reason we need #repeatable is that we allow <oneOrMore> to have both mixed content models and <attribute> at the same time. Having seen this comlexity, I would propose to disallow such <oneOrMore>. >repeatable ::= > mixed > | singleAttributeGroup > | <choice> repeatable repeatable </choice> > | <choice> <empty/> repeatable </choice> > | <oneOrMore> repeatable </oneOrMore> 8. pattern >pattern ::= > attributeGroup > | value > | repeatable > | <choice> pattern pattern </choice> > | <choice> <empty/> pattern </choice> > | <group> attributeGroup pattern </group> > | <group> pattern attributeGroup </group> //This disallows <group>value1 value2</group> > | <interleave> attributeGroup pattern </interleave> > | <interleave> pattern attributeGroup </interleave> //This disallows <interleave>value1 value2</interleave> Here is my counter proposal. pattern ::= attributeGroup | value | mixed | <choice> pattern pattern </choice> | <choice> <empty/> pattern </choice> | <group> attributeGroup pattern </group> | <group> pattern attributeGroup </group> | <interleave> attributeGroup pattern </interleave> | <interleave> pattern attributeGroup </interleave> Cheers, Makoto
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC