[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Modeling question: node structure

  • To: <xml-dev@lists.xml.org>
  • Subject: Modeling question: node structure
  • From: "Paul Wuethrich" <paul.wuethrich@eye-ris.com>
  • Date: Mon, 5 Apr 2004 08:06:02 -0600
  • Thread-index: AcQbFyDwlJEhIRXaQyi6lsNzvCQx9A==
  • Thread-topic: Modeling question: node structure

stylus modeling

Is there a “standard” way for modeling a node structure that can be constrained up to a specific depth whereby all nodes are the same type?

 

For example, the concept is a dimension which could be any hierarchical concept such as geography, or product, and is constrained to a maximum depth of 15.  In addition, the number of dimensions is constrained to a maximum of 50.  One approach to the metadata definition for geography is straightforward since I can define a dimension generically such that:

 

       <xs:element name="Dimension">

             <xs:annotation>

                    <xs:documentation>A Dimension is a user defined element such as 'Geography'.</xs:documentation>

             </xs:annotation>

             <xs:complexType>

                    <xs:sequence>

                           <xs:element name="Dimension_Member" maxOccurs="15">

                                 <xs:complexType>

                                        <xs:attribute name="Id" type="xs:ID" use="required"/>

                                        <xs:attribute name="Label" use="required">

                                        …

             </xs:complexType>

       </xs:element>

 

Note that the hierarchy can be defined using either a sequence number attribute of by assuming that the sequence itself defines the hierarchy.

 

The problem with this implementation is the duplication of element data and there will be thousands of “rows”.

 

<GEOGRAPHY>

<COUNTRY>USA</COUNTRY><STATE>CO</STATE><CITY>DENVER</CITY>

<COUNTRY>USA</COUNTRY><STATE>CO</STATE><CITY>ASPEN</CITY>

<COUNTRY>USA</COUNTRY><STATE>CO</STATE><CITY>VAIL</CITY>

<COUNTRY>USA</COUNTRY><STATE>CO</STATE><CITY>COLORADO SPRINGS</CITY>

<COUNTRY>CANADA</COUNTRY><STATE>QC</STATE><CITY>HULL</CITY>

<COUNTRY> CANADA </COUNTRY><STATE> QC </STATE><CITY>HUDSON</CITY>

<COUNTRY> CANADA </COUNTRY><STATE> QC </STATE><CITY>MONTREAL</CITY>

<COUNTRY> CANADA </COUNTRY><STATE> QC </STATE><CITY>HULL</CITY>

</GEOGRAPHY>

<PRODUCT>

Different hierarchy…

</PRODUCT>

<ANOTHER DIM>

Different hierarchy…

</ANOTHER DIM>

 

What I would like is a more generic way for defining dimensions such that I can model the hierarchy and avoid duplication.

 

<GEOGRAPHY>

            <COUNTRY>

                        <STATE>

                                    <COUNTY>

                                                <CITY></CITY>

                                    </COUNTY>

                        </STATE>

            </COUNTRY>

</GEOGRAPHY>

 

Since the maximum node depth is known I also took the following approach but it seems like there has to be a better way.

 

       <xs:element name="DimensionData">

             <xs:complexType>

                    <xs:sequence>

                           <xs:element name="Dim1" maxOccurs="unbounded">

                                 <xs:complexType>

                                        <xs:complexContent>

                                               <xs:extension base="DimensionMemberData">

                                                     <xs:sequence>

                                                            <xs:element name="Dim2" minOccurs="0" maxOccurs="unbounded">

                                                                   <xs:complexType>

                                                                         <xs:complexContent>

                                                                                <xs:extension base="DimensionMemberData">

                                                                                       <xs:sequence>

                                                                                             <xs:element name="Dim3" minOccurs="0" maxOccurs="unbounded">

                                                                                                    <xs:complexType>

                                                                                    …and so on til a depth of 15

 

Is the answer to use the anyType or something else?

 

Thanks in advance.

 

Paul

 

 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.