[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Schemas: Different Strokes From Different Folks
Hi, To combine two schemas in Relax NG to form a union one will use a choice of two externalRef patterns, each pointing to a schema. The externalRef basically creates a new context and pattern Y from one schema is different from pattern Y from the other, thus the union in your example will generate only {a z, b}. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 19/01/17 19:28, Henry S. Thompson wrote: John Cowan <johnwcowan@gmail.com> writes:On Wed, Jan 18, 2017 at 4:17 PM, Henry S. Thompson <ht@markup.co.uk> wrote: I understood Murata to have proved for RELAX NG that given two XMLlanguages, each (weakly) generated by a RELAX NG schema, the union _of the languages_ would be generated by the union of the schemata.Indeed, the proof is trivial. Let a be the root pattern of schema A, and b be the root pattern of schema B. Then <choice><ref name="a"/><ref name="b"/></choice> matches any document that matches either a or b or both. And since there are no constraints on the subpatterns of a choice pattern other than those inherited from the context of the choice pattern (which here is null), all such patterns are valid.<academicInterestOnly> Consider the following two CF-PSGs: 1) S -> X X -> Y z Y -> a 2) S -> Y Y -> b (1) generates L1={a z} (2) generates L2=(b} (1) U (2) generates {a z, b, b z}, which is a proper superset of L1 U L2. It is straightforward to port this example to RELAX NG: 1) start = X X = element x { Y , element z { empty } } Y = element { element a { empty } } 2) start = Y Y = element b { empty } with a parallel effect. So what you've offered above doesn't constitute the desired proof. The proof that context-free _languages_ are closed under union (see for example (first one Google offered me) [1]) involves a relabelling step for non-terminal symbols, precisely to avoid this 'capture' problem. A similar step would obviously be possible for RELAX NG. So the class of RELAX NG _languages_ is closed under union, but it probably doesn't really make sense to say the _formalism_ is closed under union. </academicInterestOnly> ht
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|