How to define a value space that is a cross-product of simpleType value spaces?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to define a value space that is a cross-product of simpleType value spaces?

Costello, Roger L.
Hi Folks,

Suppose this is the value space for "family name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

    <xs:simpleType name="Family-name">
        <xs:restriction base="xs:string">
            <xs:minLength value="1" />
            <xs:maxLength value="100" />
            <xs:pattern value="[a-zA-Z' \.-]+" />
        </xs:restriction>
    </xs:simpleType>


Suppose this is the value space for "middle initial" values:

length: 1 character
consists of the characters: A-Z

That value space is implemented using this simpleType:

    <xs:simpleType name="Middle-initial">
        <xs:restriction base="xs:string">
            <xs:length value="1" />
            <xs:pattern value="[A-Z]+" />
        </xs:restriction>
    </xs:simpleType>


Suppose this is the value space for "given name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

    <xs:simpleType name="Given-name">
        <xs:restriction base="xs:string">
            <xs:minLength value="1" />
            <xs:maxLength value="100" />
            <xs:pattern value="[a-zA-Z' \.-]+" />
        </xs:restriction>
    </xs:simpleType>


Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)

I would like to aggregate them to create a "person name" value space. This is the value space for person name:

Person-name is the cross product: G x M x F

Here is an example of a value in the Person-name value space:

("Roger", "L", "Costello")

How do I implement the Person-name value space?

/Roger

Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

xmlplus custodians
How about something like this for PersonName simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="3" />
           <xs:maxLength value="201" />
           <xs:pattern value="[a-zA-Z' \.\-]+\s+[A-Z]\s+[a-zA-Z' \.\-]+" />
       </xs:restriction>
   </xs:simpleType>

The length range [3-201] is reached using the addition of ranges of individual types : [1-100], [1-1], [1-100].
The pattern is almost an concatenation of the individual regexes that you are using for the 3 simpleTypes with following modifications ... the hyphen was not escaped in the regex, it should be, else it would signify range... added \s to allow for space(s) between middle name character and the either side of it.


On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]> wrote:
Hi Folks,

Suppose this is the value space for "family name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "middle initial" values:

length: 1 character
consists of the characters: A-Z

That value space is implemented using this simpleType:

   <xs:simpleType name="Middle-initial">
       <xs:restriction base="xs:string">
           <xs:length value="1" />
           <xs:pattern value="[A-Z]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "given name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Given-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)

I would like to aggregate them to create a "person name" value space. This is the value space for person name:

Person-name is the cross product: G x M x F

Here is an example of a value in the Person-name value space:

("Roger", "L", "Costello")

How do I implement the Person-name value space?

/Roger




--
Best Regards,
Satya Prakash Tripathi


Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

xmlplus custodians
Sorry, looks like you want to aggregate the types into a new type, is so one could use a complexType consisting of the simpleTypes from your example, like following:

<xs:complexType name="Person-name">
   <xs:sequence>
      <xs:element name="familyName" type="Family-name"/>
      <xs:element name="middleInitial" type="Middle-initial"/>
      <xs:element name="givenName" type="Given-name"/>
   </xs:sequence>
</xs:complexType>

The individual types viz. Family-name, Middle-initial and Given-name have their value-space already constrained in your example, so in that sense this new complexType also has it's value space constrained. 


On Thu, Feb 24, 2011 at 7:49 PM, xmlplus custodians <[hidden email]> wrote:
How about something like this for PersonName simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="3" />
           <xs:maxLength value="201" />
           <xs:pattern value="[a-zA-Z' \.\-]+\s+[A-Z]\s+[a-zA-Z' \.\-]+" />
       </xs:restriction>
   </xs:simpleType>

The length range [3-201] is reached using the addition of ranges of individual types : [1-100], [1-1], [1-100].
The pattern is almost an concatenation of the individual regexes that you are using for the 3 simpleTypes with following modifications ... the hyphen was not escaped in the regex, it should be, else it would signify range... added \s to allow for space(s) between middle name character and the either side of it.


On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]> wrote:
Hi Folks,

Suppose this is the value space for "family name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "middle initial" values:

length: 1 character
consists of the characters: A-Z

That value space is implemented using this simpleType:

   <xs:simpleType name="Middle-initial">
       <xs:restriction base="xs:string">
           <xs:length value="1" />
           <xs:pattern value="[A-Z]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "given name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Given-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)

I would like to aggregate them to create a "person name" value space. This is the value space for person name:

Person-name is the cross product: G x M x F

Here is an example of a value in the Person-name value space:

("Roger", "L", "Costello")

How do I implement the Person-name value space?

/Roger




--
Best Regards,
Satya Prakash Tripathi





--
Best Regards,
Satya Prakash Tripathi


Reply | Threaded
Open this post in threaded view
|

RE: How to define a value space that is a cross-product of simpleType value spaces?

Costello, Roger L.

Thanks. Good idea. However, that’s not quite what I am seeking.

 

The Family-name simpleType implements a value space. No labels are associated to it. Any number of labels could (later) be associated to it:

 

    <xs:element name="Family-name" type="Family-name" />

 

    <xs:element name="Surname" type="Family-name" />

 

    <xs:element name="Last-name" type="Family-name" />

 

I wish to proceed in a similar fashion with an aggregate value-space. That is, define the aggregate value space and then (later) associate any number of labels to it and to its component value spaces.

 

/Roger

 

From: xmlplus custodians [mailto:[hidden email]]
Sent: Thursday, February 24, 2011 9:38 AM
To: Costello, Roger L.
Cc: [hidden email]
Subject: Re: How to define a value space that is a cross-product of simpleType value spaces?

 

Sorry, looks like you want to aggregate the types into a new type, is so one could use a complexType consisting of the simpleTypes from your example, like following:

 

<xs:complexType name="Person-name">

   <xs:sequence>

      <xs:element name="familyName" type="Family-name"/>

      <xs:element name="middleInitial" type="Middle-initial"/>

      <xs:element name="givenName" type="Given-name"/>

   </xs:sequence>

</xs:complexType>

 

The individual types viz. Family-name, Middle-initial and Given-name have their value-space already constrained in your example, so in that sense this new complexType also has it's value space constrained. 

 

On Thu, Feb 24, 2011 at 7:49 PM, xmlplus custodians <[hidden email]> wrote:

How about something like this for PersonName simpleType:

 

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">

           <xs:minLength value="3" />
           <xs:maxLength value="201" />
           <xs:pattern value="[a-zA-Z' \.\-]+\s+[A-Z]\s+[a-zA-Z' \.\-]+" />
       </xs:restriction>
   </xs:simpleType>

The length range [3-201] is reached using the addition of ranges of individual types : [1-100], [1-1], [1-100].

The pattern is almost an concatenation of the individual regexes that you are using for the 3 simpleTypes with following modifications ... the hyphen was not escaped in the regex, it should be, else it would signify range... added \s to allow for space(s) between middle name character and the either side of it.

 

 

On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]> wrote:

Hi Folks,

Suppose this is the value space for "family name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "middle initial" values:

length: 1 character
consists of the characters: A-Z

That value space is implemented using this simpleType:

   <xs:simpleType name="Middle-initial">
       <xs:restriction base="xs:string">
           <xs:length value="1" />
           <xs:pattern value="[A-Z]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "given name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Given-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)

I would like to aggregate them to create a "person name" value space. This is the value space for person name:

Person-name is the cross product: G x M x F

Here is an example of a value in the Person-name value space:

("Roger", "L", "Costello")

How do I implement the Person-name value space?

/Roger



--
Best Regards,
Satya Prakash Tripathi





--
Best Regards,
Satya Prakash Tripathi


Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

Michael Kay

I think you're confusing people by your terminology. You don't want a "cross-product" or an "aggregate". I think you want the type whose value space is the set of strings that can be partitioned in one or more ways into three substrings that match the three given types. I don't believe there is an automated way of doing that except in special cases, like where each of the types is completely defined by a regular expression, in which case you can simply concatenate the regular expressions.

Incidentally, I just hate this "middle initial" notion. Perhaps it's true in America that 90% of people have names in this format, but it's horrible to impose it on everyone else.

Michael Kay
Saxonica


On 24/02/2011 14:44, Costello, Roger L. wrote:

Thanks. Good idea. However, that’s not quite what I am seeking.

 

The Family-name simpleType implements a value space. No labels are associated to it. Any number of labels could (later) be associated to it:

 

    <xs:element name="Family-name" type="Family-name" />

 

    <xs:element name="Surname" type="Family-name" />

 

    <xs:element name="Last-name" type="Family-name" />

 

I wish to proceed in a similar fashion with an aggregate value-space. That is, define the aggregate value space and then (later) associate any number of labels to it and to its component value spaces.

 

/Roger

 

From: xmlplus custodians [[hidden email]]
Sent: Thursday, February 24, 2011 9:38 AM
To: Costello, Roger L.
Cc: [hidden email]
Subject: Re: How to define a value space that is a cross-product of simpleType value spaces?

 

Sorry, looks like you want to aggregate the types into a new type, is so one could use a complexType consisting of the simpleTypes from your example, like following:

 

<xs:complexType name="Person-name">

   <xs:sequence>

      <xs:element name="familyName" type="Family-name"/>

      <xs:element name="middleInitial" type="Middle-initial"/>

      <xs:element name="givenName" type="Given-name"/>

   </xs:sequence>

</xs:complexType>

 

The individual types viz. Family-name, Middle-initial and Given-name have their value-space already constrained in your example, so in that sense this new complexType also has it's value space constrained. 

 

On Thu, Feb 24, 2011 at 7:49 PM, xmlplus custodians <[hidden email]> wrote:

How about something like this for PersonName simpleType:

 

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">

           <xs:minLength value="3" />
           <xs:maxLength value="201" />
           <xs:pattern value="[a-zA-Z' \.\-]+\s+[A-Z]\s+[a-zA-Z' \.\-]+" />
       </xs:restriction>
   </xs:simpleType>

The length range [3-201] is reached using the addition of ranges of individual types : [1-100], [1-1], [1-100].

The pattern is almost an concatenation of the individual regexes that you are using for the 3 simpleTypes with following modifications ... the hyphen was not escaped in the regex, it should be, else it would signify range... added \s to allow for space(s) between middle name character and the either side of it.

 

 

On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]> wrote:

Hi Folks,

Suppose this is the value space for "family name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Family-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "middle initial" values:

length: 1 character
consists of the characters: A-Z

That value space is implemented using this simpleType:

   <xs:simpleType name="Middle-initial">
       <xs:restriction base="xs:string">
           <xs:length value="1" />
           <xs:pattern value="[A-Z]+" />
       </xs:restriction>
   </xs:simpleType>


Suppose this is the value space for "given name" values:

length: 1 - 100 characters
consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe

That value space is implemented using this simpleType:

   <xs:simpleType name="Given-name">
       <xs:restriction base="xs:string">
           <xs:minLength value="1" />
           <xs:maxLength value="100" />
           <xs:pattern value="[a-zA-Z' \.-]+" />
       </xs:restriction>
   </xs:simpleType>


Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)

I would like to aggregate them to create a "person name" value space. This is the value space for person name:

Person-name is the cross product: G x M x F

Here is an example of a value in the Person-name value space:

("Roger", "L", "Costello")

How do I implement the Person-name value space?

/Roger



--
Best Regards,
Satya Prakash Tripathi





--
Best Regards,
Satya Prakash Tripathi



Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

Mukul Gandhi
In reply to this post by Costello, Roger L.
Hi Roger,
   This seems to be possible with XML Schema 1.1 assertions. Here's an
example please,

   <xs:simpleType name="Person-name">
        <xs:restriction base="xs:string">
              <xs:assertion test="(string-length(tokenize($value,'\s')[1]) =
(1 to 100)) and matches(tokenize($value,'\s')[1], 'REG-EX_1')" />
              <xs:assertion test="(string-length(tokenize($value,'\s')[2]) =
1) and matches(tokenize($value,'\s')[2], 'REG-EX_2')" />
              <xs:assertion test="(string-length(tokenize($value,'\s')[3]) =
(1 to 100)) and matches(tokenize($value,'\s')[3], 'REG-EX_3')" />
        </xs:restriction>
   </xs:simpleType>

On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]> wrote:

> Hi Folks,
>
> Suppose this is the value space for "family name" values:
>
> length: 1 - 100 characters
> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>
> That value space is implemented using this simpleType:
>
>    <xs:simpleType name="Family-name">
>        <xs:restriction base="xs:string">
>            <xs:minLength value="1" />
>            <xs:maxLength value="100" />
>            <xs:pattern value="[a-zA-Z' \.-]+" />
>        </xs:restriction>
>    </xs:simpleType>
>
>
> Suppose this is the value space for "middle initial" values:
>
> length: 1 character
> consists of the characters: A-Z
>
> That value space is implemented using this simpleType:
>
>    <xs:simpleType name="Middle-initial">
>        <xs:restriction base="xs:string">
>            <xs:length value="1" />
>            <xs:pattern value="[A-Z]+" />
>        </xs:restriction>
>    </xs:simpleType>
>
>
> Suppose this is the value space for "given name" values:
>
> length: 1 - 100 characters
> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>
> That value space is implemented using this simpleType:
>
>    <xs:simpleType name="Given-name">
>        <xs:restriction base="xs:string">
>            <xs:minLength value="1" />
>            <xs:maxLength value="100" />
>            <xs:pattern value="[a-zA-Z' \.-]+" />
>        </xs:restriction>
>    </xs:simpleType>
>
>
> Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)
>
> I would like to aggregate them to create a "person name" value space. This is the value space for person name:
>
> Person-name is the cross product: G x M x F
>
> Here is an example of a value in the Person-name value space:
>
> ("Roger", "L", "Costello")
>
> How do I implement the Person-name value space?
>
> /Roger




--
Regards,
Mukul Gandhi

Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

Noah Mendelsohn
In reply to this post by Michael Kay
Yes, I agree with Michael. Furthermore, while there are practical limits,
if you're that interested in the substructure of the name, might it not be
appropriate to mark up the bits separately, I.e. with tags for <givenName>
etc.? Not only is this more robust, if verbose, markup, it at least
provides a foundation for dealing with the wide range of naming customs
required to deal with a global user community.

(Having at one point worked for a company that built email, and thus
address book systems, I can assure you that building a model that handles
the full range of international naming conventions is very, very difficult,
but not trying can lead to truly embarrassing results in many locales.)

Noah

On 2/24/2011 10:10 AM, Michael Kay wrote:

>
> I think you're confusing people by your terminology. You don't want a
> "cross-product" or an "aggregate". I think you want the type whose value
> space is the set of strings that can be partitioned in one or more ways
> into three substrings that match the three given types. I don't believe
> there is an automated way of doing that except in special cases, like where
> each of the types is completely defined by a regular expression, in which
> case you can simply concatenate the regular expressions.
>
> Incidentally, I just hate this "middle initial" notion. Perhaps it's true
> in America that 90% of people have names in this format, but it's horrible
> to impose it on everyone else.
>
> Michael Kay
> Saxonica
>
>
> On 24/02/2011 14:44, Costello, Roger L. wrote:
>>
>> Thanks. Good idea. However, that’s not quite what I am seeking.
>>
>> The Family-name simpleType implements a value space. No labels are
>> associated to it. Any number of labels could (later) be associated to it:
>>
>> <xs:element name="Family-name" type="Family-name" />
>>
>> <xs:element name="Surname" type="Family-name" />
>>
>> <xs:element name="Last-name" type="Family-name" />
>>
>> I wish to proceed in a similar fashion with an aggregate value-space.
>> That is, define the aggregate value space and then (later) associate any
>> number of labels to it and to its component value spaces.
>>
>> /Roger
>>
>> *From:*xmlplus custodians [mailto:[hidden email]]
>> *Sent:* Thursday, February 24, 2011 9:38 AM
>> *To:* Costello, Roger L.
>> *Cc:* [hidden email]
>> *Subject:* Re: How to define a value space that is a cross-product of
>> simpleType value spaces?
>>
>> Sorry, looks like you want to aggregate the types into a new type, is so
>> one could use a complexType consisting of the simpleTypes from your
>> example, like following:
>>
>> <xs:complexType name="Person-name">
>>
>> <xs:sequence>
>>
>> <xs:element name="familyName" type="Family-name"/>
>>
>> <xs:element name="middleInitial" type="Middle-initial"/>
>>
>> <xs:element name="givenName" type="Given-name"/>
>>
>> </xs:sequence>
>>
>> </xs:complexType>
>>
>> The individual types viz. Family-name, Middle-initial and Given-name have
>> their value-space already constrained in your example, so in that sense
>> this new complexType also has it's value space constrained.
>>
>> On Thu, Feb 24, 2011 at 7:49 PM, xmlplus custodians
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>
>> How about something like this for PersonName simpleType:
>>
>> <xs:simpleType name="Family-name">
>> <xs:restriction base="xs:string">
>>
>> <xs:minLength value="3" />
>> <xs:maxLength value="201" />
>> <xs:pattern value="[a-zA-Z' \.\-]+\s+[A-Z]\s+[a-zA-Z' \.\-]+" />
>> </xs:restriction>
>> </xs:simpleType>
>>
>> The length range [3-201] is reached using the addition of ranges of
>> individual types : [1-100], [1-1], [1-100].
>>
>> The pattern is almost an concatenation of the individual regexes that you
>> are using for the 3 simpleTypes with following modifications ... the
>> hyphen was not escaped in the regex, it should be, else it would signify
>> range... added \s to allow for space(s) between middle name character and
>> the either side of it.
>>
>> On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Hi Folks,
>>
>> Suppose this is the value space for "family name" values:
>>
>> length: 1 - 100 characters
>> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>>
>> That value space is implemented using this simpleType:
>>
>> <xs:simpleType name="Family-name">
>> <xs:restriction base="xs:string">
>> <xs:minLength value="1" />
>> <xs:maxLength value="100" />
>> <xs:pattern value="[a-zA-Z' \.-]+" />
>> </xs:restriction>
>> </xs:simpleType>
>>
>>
>> Suppose this is the value space for "middle initial" values:
>>
>> length: 1 character
>> consists of the characters: A-Z
>>
>> That value space is implemented using this simpleType:
>>
>> <xs:simpleType name="Middle-initial">
>> <xs:restriction base="xs:string">
>> <xs:length value="1" />
>> <xs:pattern value="[A-Z]+" />
>> </xs:restriction>
>> </xs:simpleType>
>>
>>
>> Suppose this is the value space for "given name" values:
>>
>> length: 1 - 100 characters
>> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>>
>> That value space is implemented using this simpleType:
>>
>> <xs:simpleType name="Given-name">
>> <xs:restriction base="xs:string">
>> <xs:minLength value="1" />
>> <xs:maxLength value="100" />
>> <xs:pattern value="[a-zA-Z' \.-]+" />
>> </xs:restriction>
>> </xs:simpleType>
>>
>>
>> Now there are 3 user-defined value spaces. Let me denote them by F, M, G,
>> respectively. (F = Family, M = Middle, G = Given)
>>
>> I would like to aggregate them to create a "person name" value space.
>> This is the value space for person name:
>>
>> Person-name is the cross product: G x M x F
>>
>> Here is an example of a value in the Person-name value space:
>>
>> ("Roger", "L", "Costello")
>>
>> How do I implement the Person-name value space?
>>
>> /Roger
>>
>>
>>
>> --
>> Best Regards,
>> Satya Prakash Tripathi
>>
>>
>>
>>
>> --
>> Best Regards,
>> Satya Prakash Tripathi
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to define a value space that is a cross-product of simpleType value spaces?

C. M. Sperberg-McQueen-2
In reply to this post by Costello, Roger L.

On Feb 24, 2011, at 3:49 AM, Costello, Roger L. wrote:

> Hi Folks,
>
> Suppose this is the value space for "family name" values:
> ...
> Suppose this is the value space for "middle initial" values:
> ...
> Suppose this is the value space for "given name" values:
> ...
>
> Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)
>
> I would like to aggregate them to create a "person name" value space. This is the value space for person name:
>
> Person-name is the cross product: G x M x F
>
> Here is an example of a value in the Person-name value space:
>
> ("Roger", "L", "Costello")
>
> How do I implement the Person-name value space?

It appears that what you want is a triple of three unnamed
values whose first value is from G, whose second value
is from M, and whose third value is from F.  (If that's not
quite what you're after, what follows will be off the mark.
While I'm in disclaimer mode I'll also say that I'm assuming this
is a simple arbitrary example built to illustrate a general question,
and not a serious attempt to define rules for names of
persons.)

I don't know a simple way to do that in any existing schema
language.

In XSD, the basic design principle is that for structured values
it is better to use XML.  So the simplest approximation to
your goal in XSD is to define three attributes or elements,
associated respectively with your types F, M, and G.  The
XML serialization of a name might then be

  <name g="Roger" m="L" f="Costello"/>

This deviates from what I think you're looking for by assigning
names to the parts of the triple.  But as a general thing, I
think that this is almost always the right way to define
Cartesian products of simple value spaces.

In DTLL, it's possible (or was, last time someone explained the
then-current state of DTLL to me) to define value spaces of
triples, but the parts of the triple were given names in order that
the type designer could specify their properties.

A different approximation would include the strings which consist
of concatenations of strings from types G, M, and F in that order.
Since the value spaces of G, M, and F are each regular sets,
and concatenation preserves regularity, it is possible to define
a single type which matches just the concatenations you want,
and to express that type as an XSD simple type definition.  (You'd
need to move the length constraints into the regular expression
patterns, and then concatenate the patterns.)

A third approximation would be to define a value space
consisting of lists of length 3, where the first item in the list
is in value space G, the second in value space M, and the
third in value space F.  This would probably be a bit tedious,
but no part of the process is particularly difficult:  (1) define
a union type U of F, G, and M.  (2) Define a list type L0 whose
item type is U.  (3) Define a type L1 which restricts L0 to
lists of length 3.  (4) Using patterns or assertions, define
type L2 as a restriction of type L which constrains
the first token in a value to match the pattern for, or be
castable to, type G, the second token to be castable as M,
the third to be castable as F.

--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************