# RE: Algorithm for merging the pattern facets in a base simpleType with a subtype?

From: Costello, Roger L. <costello@mitre.org>
Date: Fri, 22 Apr 2011 11:16:37 -0400

Message-ID: <9E51F88D5247B648908850C35A3BBB500538DD8244@IMCMBX3.MITRE.ORG>
```Hi Michael,

> What does this algorithm sketch do if there are three patterns
> on each declaration (call them A1, A2, A3, B1, B2, B3, ..., D3)?
> Are B1 through D3 all ORed together?

Yes.

A1, A2, A3 is converted to A1|A2|A3
B1, B2, B3 is converted to B1|B2|B3
C1, C2, C3 is converted to C1|C2|C3
D1, D2, D3 is converted to D1|D2|D3

The single, consolidated (merged) simpleType is:

<simpleType name="...">
<restriction base="...">
<pattern value="A1|A2|A3" />
<pattern value="B1|B2|B3" />
<pattern value="C1|C2|C3" />
<pattern value="D1|D2|D3" />
</restriction>
</simpleType>

The disadvantage is that the semantics of this consolidated simpleType is a bit different: the patterns are ANDed together.

/Roger

-----Original Message-----
From: C. M. Sperberg-McQueen [mailto:cmsmcq@blackmesatech.com]
Sent: Friday, April 22, 2011 11:04 AM
To: Costello, Roger L.
Cc: C. M. Sperberg-McQueen; xmlschema-dev@w3.org
Subject: Re: Algorithm for merging the pattern facets in a base simpleType with a subtype?

On Apr 20, 2011, at 3:49 AM, Costello, Roger L. wrote:

> ...
>
> Let me denote this simpleType dependency chain like this:
>
>     list = [A, B, C, D]
>
> Problem: what are the pattern facet constraints on simpleType A?
>
>
> Algorithm:
>
> Pattern-Facet-Constraints (list) {
>
>     ("or" the patterns in list[1]) "and" (Pattern-Facet-Constraints (list[position() gt 1])
>
> }
>
> In words: The patterns that apply to the first simpleType in "list" is the Boolean "or" of the patterns in the first simpleType, then Boolean "and" them with the patterns that apply to the simpleTypes in the remainder of the list.

What does this algorithm sketch do if there are three patterns
on each declaration (call them A1, A2, A3, B1, B2, B3, ..., D3)?
Are B1 through D3 all ORed together?

--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
```
Received on Friday, 22 April 2011 15:17:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:19 UTC