OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Type-assignment (was Re: Are we losing out because of grammars?)



James Clark wrote:

> I think closure is not just of theoretical importance.  This is one
> reason why I want to keep type-assignment and validation separate: it's
> useful to have the validation be closed under
> union/intersection/difference, even if type-assignment isn't.  

Nice to hear that.  We are in the same camp.

>I think I
> can live with fairly trivial type-assignment (as in W3C's XML Schemas),
> which allows type assignment to be done in a single, streaming pass, but
> I want to have more sophisticated validation (which can also be done in
> a single, streaming pass).

But XML Schema is not closed under union or difference. Consider two modules 
written in RELAX Core as below:

 module 1

<module ...>
  <interface><ref label="doc"/></interface>
  <elementRule role="doc">
    <sequence>
      <ref label="foo1"/>
      <ref label="bar1"/>
    </sequence>
  </elementRule>
  <elementRule role="foo" label="foo1">
    <empty/>
  </elementRule>
  <elementRule role="bar" label="bar1" type="integer"/>
    <empty/>
  </elementRule>
  <tag name="foo"/>
  <tag name="bar"/>
</module>

module 2

<module ...>
  <interface><ref label="doc"/></interface>

  <elementRule role="doc">
    <sequence>
      <ref label="foo2"/>
      <ref label="bar2"/>
    </sequence>
  </elementRule>
  <tag name="foo"/>
  <elementRule role="foo" label="foo2">
    <ref label="hoge"/>
  </elementRule>
  <elementRule role="bar" label="bar2" type="integer"/>
    <ref label="hoge"/>
  </elementRule>
  <tag name="foo"/>
  <tag name="bar"/>
  <elementRule role="hoge" type="string"/>
  <tag name="hoge"/>
</module>

Its union is:

<module ...>
  <interface><ref label="doc"/></interface>
  <elementRule role="doc">
  <choice>
    <sequence>
      <ref label="foo1"/>
      <ref label="bar1"/>
    </sequence>
    <sequence>
      <ref label="foo2"/>
      <ref label="bar2"/>
    </sequence>
  </choice>
  </elementRule>

  <elementRule role="foo" label="foo1">
    <empty/>
  </elementRule>

  <elementRule role="bar" label="bar1">
    <empty/>
  </elementRule>

  <elementRule role="foo" label="foo2">
    <ref label="hoge"/>
  </elementRule>

  <elementRule role="bar" label="bar2">
    <ref label="hoge"/>
  </elementRule>

  <elementRule role="hoge" type="string"/>

  <tag name="foo"/>
  <tag name="bar"/>
  <tag name="hoge"/>

</module>

This cannot be captured by XML Schema, because of the single-type 
constraint.

RELAX Core does not impose special restrictions (except some 
restrictions on ID/IDREF/IDREFS), but conformance section of RELAX Core 
allows implementations to give up when "semi-deterministic top-down 
with one lookahead" is not possible (e.g., the union example shown above).

Cheers,

Makoto