W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2011

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

From: Costello, Roger L. <costello@mitre.org>
Date: Thu, 24 Feb 2011 09:44:34 -0500
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB50052E53092F@IMCMBX3.MITRE.ORG>
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:xmlplus.custodians@gmail.com]
Sent: Thursday, February 24, 2011 9:38 AM
To: Costello, Roger L.
Cc: xmlschema-dev@w3.org
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 <xmlplus.custodians@gmail.com<mailto:xmlplus.custodians@gmail.com>> 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. <costello@mitre.org<mailto:costello@mitre.org>> 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
Received on Thursday, 24 February 2011 14:45:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 24 February 2011 14:45:30 GMT