W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2000

Re: Modelling enumeration of complex types and use of duplicated elements

From: Hoylen Sue <h.sue@dstc.edu.au>
Date: Thu, 14 Sep 2000 17:52:11 +1000 (EST)
Message-ID: <14784.33707.16401.444373@sunlight.dstc.edu.au>
To: www-xml-schema-comments@w3.org
Henry,

Thank you for the prompt reply.

 > Without look in great detail at your example, I think you can do what
 > you want with equivalence classes.  I'll give a general example, see
 > if it fits for your particular case.

Unfortunately, we have already considered this approach of using
equivalence classes, e.g.

  <element name="position" type="TERM_TEXT" abstract="true"/>
  
  <element name="lying_position" type="LyingTerm" equivClass="position"/>
  <complexType name="LyingTerm" base="G1_TERM_TEXT" derivedBy="restriction>
    <element name="value" type="string" fixed="lying"/>
  	  ... etc ...
  </complexType>
  (ditto for standing, sitting)

However, we found a number of tradeoffs which makes it an unsatisfactory
solution:

a. The element tags have been changed in the instances.  This would
   affect the importing of XML instances to applications which were
   expecting the generic form. The application would not know that they
   are reading in the 'position' field when the element tag is
   'lying_position'? You could do matching by the order that elements
   appear, e.g. the fourth element must be the 'position' field, but
   then you would have to be careful about not making surrounding
   elements optional.

b. You would have to know beforehand that you want to restrict a given
   base element, since it has to be set to abstract and made global.
   This makes it less satisfactory as a general solution for
   implementing an enumeration of complex types.

c. Also, equivalence classes have a global search and replace meaning,
   whereas the enumeration list would apply within a certain context.

   For example, there may be more than one 'position' element that
   occurs in the schema. The first 'position' field may stand for the
   body position in a medical test, the second 'position' field may be
   for a job title for the related health care professional. You would
   not want to mix the values of these two fields.  You could possibly
   rename these fields to go around the problem. However, it does solve
   the case you're referring to the same element. For example, there may
   be more than one medical test. In the first test, 'position' can be
   'sitting', 'standing' or 'lying, and in the second test, 'position'
   can only be 'sitting' or 'standing'. There's no way to distinguish
   the two lists using equivalence classes.

This has been a tricky problem for us.  Although there are serveral
approaches to the solution, the trade offs have been considerable.
Do you think there is a way to do this without such large tradeoffs?

Thanks.

Hoylen
-- 
__________________________________________________ Dr Hoylen Sue
h.sue@dstc.edu.au                        http://www.dstc.edu.au/
DSTC Pty Ltd --- Australian W3C Office           +61 7 3365 4310
Received on Thursday, 14 September 2000 03:52:31 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:53 UTC