W3C home > Mailing lists > Public > public-sml@w3.org > September 2007

Re: [w3c sml] [4639] Reference cycles - document-based vs. element-based

From: Sandy Gao <sandygao@ca.ibm.com>
Date: Thu, 6 Sep 2007 10:49:49 -0400
To: "Smith, Virginia (HP Software)" <virginia.smith@hp.com>
Cc: public-sml@w3.org
Message-ID: <OFF623D0F0.0B096475-ON8525734E.004E8776-8525734E.005176D9@ca.ibm.com>
Haven't read this in detail; just want to throw something into the mix.

When we were talking about "acyclic" at the F2F, a question was raised 
about how likely can cycles be formed. That is, it feels very unlikely for 
a reference to point to another reference element. For example, in section 
2.1 of Ginny's document, "Prerequisite" points to "Course" elements, which 
are not reference elements themselves. That is, "Prerequisite" never forms 
a cycle, because every reference stops after just one step.

If we want to make sure "acyclic" detects the above as an error, then in 
"sml:acyclic", we must be able to say, in Object terms, "recursively 
following O.R will not lead back to O".

One possible solution I suggested during the F2F is like the following (I 
was using the "host" example used at the F2F; changing it to match the 
"Course/Prerequisite" example):

    <complexType name="CourseType"> 
          <sml:acyclic ref="./Prerequisite"/>

The meaning of the above type is:
For any element information item E of type "CourseType" or a type derived 
from it, let R be its "./Prerequisite" (a restricted XPath; similar to 
that for "selector")
1. If R doesn't exist or R is not a reference element or R is a null 
reference, OK. (Stop if there is no Prerequisite course)
2. Otherwise deref() R to T (find the Prerequisite course)
2.1 If T is absent, OK. ("Prerequisite" is unresolved)
2.2 If T is the same as E, then error (a cycle is detected)
2.3 If T is of type "CourseType" or a type derived from it, then let R be 
T's "./Prerequisite" and repeat these steps.
2.4 Otherwise, OK.  (T is of a different type)

This should cover inter- or intra-document element-based acyclic 

Sandy Gao
XML Technologies, IBM Canada
Editor, W3C XML Schema WG
Member, W3C SML WG
(1-905) 413-3255 T/L 969-3255

"Smith, Virginia (HP Software)" <virginia.smith@hp.com> 
Sent by: public-sml-request@w3.org
2007-09-06 03:34 AM


[w3c sml] [4639] Reference cycles - document-based vs. element-based

Attached is a document that discusses element-based cycles vs.
document-based cycles. I thought it might be useful prior to further
discussion on this bug.



Virginia Smith
HP Software / BTO R&D
8000 Foothills Blvd | Roseville | CA 95747

#### CyclesInSMLModels.doc.pdf has been removed from this note on 
September 06 2007 by Sandy Gao
Received on Thursday, 6 September 2007 14:50:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:24:21 UTC