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

Sandy,
 
Very clearly stated. If we all agree that this is the scenario we are
trying to restrict with "acyclic", than we just need to agree on how it
should be represented in SML. 
 
Thanks for catching this.
 
J

________________________________

From: public-sml-request@w3.org [mailto:public-sml-request@w3.org] On
Behalf Of Sandy Gao
Sent: Thursday, September 06, 2007 10:50 AM
To: Smith, Virginia (HP Software)
Cc: public-sml@w3.org
Subject: Re: [w3c sml] [4639] Reference cycles - document-based vs.
element-based



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"> 
      ... 
      <annotation> 
        <appinfo> 
          <sml:acyclic ref="./Prerequisite"/> 
        </appinfo> 
      </annotation> 
    </complexType> 

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
constraints. 

Thanks,
Sandy Gao
XML Technologies, IBM Canada
Editor, W3C XML Schema WG <http://www.w3.org/XML/Schema/> 
Member, W3C SML WG <http://www.w3.org/XML/SML/> 
(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 

To
<public-sml@w3.org> 
cc
Subject
[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.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4639

--
ginny


---------------------
Virginia Smith
HP Software / BTO R&D
916-785-9940
8000 Foothills Blvd | Roseville | CA 95747
www.hp.com/software 


#### CyclesInSMLModels.doc.pdf has been removed from this note on
September 06 2007 by Sandy Gao 

Received on Thursday, 6 September 2007 14:59:12 UTC