[Bug 4639] Allow cycle checking on element graphs as well as document graphs


------- Comment #13 from virginia.smith@hp.com  2007-11-14 03:24 -------
It is easy to tell what node an SML reference points to (the reference target).
But, after discussions with Sandy, I don't think that this proposal is adequate
in identifying with certainty what node the reference comes from (the reference
source). It has to be an ancestor of the reference element but which one? I
still think that proposals 2 and 3 in the working document are too complex (and
unnecessarily so) and I still like proposal 4 as implemented in comment #11 but
I propose to amend it in one of the following 2 ways. (I'm still deciding which
one I prefer and I have not updated the working document yet.)

1 - add an attribute to the sml reference that locates it's source element. 
<Prerequisite sml:ref="true" sml:acyclic="true"

- This keeps all information required to specify the sml reference on the
reference itself.

- In the case where a global reference type is used to define a relationship
among different element types, the refSource attribute content cannot be
specified in the schema but must be added (repeatedly) by the instance document
author *each time* the reference is used in the xml since the name of the
element representing the reference source may be different. 
- This model requires "looking up" the hierarchy of the document which is not
normally the case. 

2 - Use the annotation as specified in proposal 1. The annotation specified the
element as the reference source. 
<xs:complexType name="CourseType">
      <sml:acyclic ref=".//Prerequisite"/>

- This model requires "looking down" the hierarchy which may feel more natural. 
- The specification of the reference source can be made once for each reference
source type, that is, in the complexType definition of the source element type.
This works even in the case where there are different element types
participating as nodes in the cycle.
- Keeps the specification of the reference source in the schema which is also
where the acyclic specification will likely be. (although on a different

- The reference information (acyclic and refSource) is split into 2 locations. 
- Requires annotation inheritance to be supported by the SML validator.

Received on Wednesday, 14 November 2007 03:25:00 UTC