- From: Brian H. Dunford-Shore <brian@gpc.ibc.wustl.edu>
- Date: Wed, 12 May 1999 16:12:36 -0500
- To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Here are some suggestions for additions to the XML Schema Part 1: Structures working draft. They deal with primary key elements, searchable elements, and element relationships (primary/foreign key relationships ala relational databases). It would be very desirable if it could be indicated in an XML Schema which elements within an element comprise a unique identifier for the element (a unique or primary key). Also perhaps desirable would be to be able to indicate which elements comprise a good set for searching. An attribute for this might indicate what type of search this is good for (unique hash, keyword, etc.). Relationships between elements (primary/foreign key relationships) can be implemented by assuming that if an elementType definition appears within the definition of another elementType definition, then it is the primary key element, otherwise, the new 'primary' attribute of elementTypeRef records this information. Primary key relationships are cumulative, such that a new element added to the primary key makes the element which contains it the parent element. (In the example below, element table1 is the parent of element table2 and element table2 is the parent of element table3). Proposed definition changes and an example follow my signature. Thank you for your work--it is a good start. Brian H. Dunford-Shore ________________________________________________________________________ | Brian H. Dunford-Shore | Campus Box 8036 | | Institute for Biomedical Computing | Phone: (314) 362-2944 | | Washington University in St. Louis | Fax: (314) 362-0234 | | 700 South Euclid Avenue | Email: brian@ibc.wustl.edu.us | | Saint Louis, Missouri 63110 | | ====================================================== Definition (change): [36] compositor ::= sequence key? search? | choice | all key? search? key ::= listField listField? search ::= searchField searchField? Here is the XML Schema definition (with changes to elementTypeRef and compositor): <!-- elementTypeRef element type --> <elementType name="elementTypeRef"> <archetypeRef name="reference"/> <attrGroupRef name="occurrence"/> <attrDecl name="primary"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> </elementType> <archetype name="compositor"> <elementTypeRef name="key" minOccur="0"/> <elementTypeRef name="search" minOccur="0"/> <choice minOccur="2" maxOccur="*"> <modelGroupRef name="modelElt"/> <elementTypeRef name="elementType"/> </choice> <attrGroupRef name="occurrence"/> </archetype> <archetype name="tuple"> <elementTypeRef name="elementTypeRef" maxOccur="*"/> </archetype> <elementType name="key"> <archetypeRef name="tuple"/> </elementType> <elementType name="search"> <archetypeRef name="tuple"/> </elementType> Example: <elementType name="table1"> <sequence> <key name="table1Primary"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> </key> <search type="unique"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> </search> <elementType name="field1"> <datatypeRef name='dt:numeric'> <precision>8</precision> <scale>2</scale> </datatypeRef> </elementType> <elementTypeRef name="field2" primary="true"/> </sequence> </elementType> <elementType name="field2"> <datatypeRef name='dt:dateTime'/> </elementType> <elementType name="table2"> <sequence> <key name="table2Primary"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementTypeRef name="field3"/> </key> <search type="unique"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementTypeRef name="field3"/> </search> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementType name="field3"> <datatypeRef name='dt:string'> <length>10</length> </datatypeRef> </elementType> </sequence> </elementType> <elementType name="table3"> <sequence> <key name="table2Primary"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementTypeRef name="field3"/> </key> <search type="unique"> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementTypeRef name="field3"/> </search> <elementTypeRef name="field1"/> <elementTypeRef name="field2"/> <elementTypeRef name="field3"/> <elementTypeRef name="field4"> <datatypeRef name='dt:string'> <length>10</length> </datatypeRef> </elementType> </sequence> </elementType>
Received on Wednesday, 12 May 1999 17:12:31 UTC