W3C home > Mailing lists > Public > public-xsd-databinding@w3.org > March 2007

ISSUE-103: Cyclic References

From: Databinding Issue Tracker <dean+cgi@w3.org>
Date: Thu, 8 Mar 2007 18:13:16 +0000 (UTC)
To: public-xsd-databinding@w3.org
Message-Id: <20070308181316.2DA4013AB5@seamus.w3.org>


ISSUE-103: Cyclic References

http://www.w3.org/2005/06/tracker/databinding/issues/103

Raised by: Jonathan Calladine
On product: Advanced

As discussed on the last call we have recently had toolkit problems with a 
wsdl that exhibited a cyclic reference. Said COTS toolkit decides this must be 
a mistake and so refuses to generate code. This issue is to capture this as a 
possible set of advanced patterns.

The options we have are to make an assertion that cyclic references are not 
permitted or to detect them as advanced patterns.

Cyclic references can be optional or mandatory (ie an unbroken chain of 
minOccurs=1 to get you back to the start of the cycle). The toolkit in 
question actually detected an optional cyclic reference and still bailed 
out... although this is probably a bug I have split the patterns up along 
these lines just in case.

I have covered just the standard type reference in these 4 schema however if 
we decide to go further with this the same needs to be done for element 
reference and extension patterns. I have broken the optional and mandatory 
patterns into 2 again to reflect that that circular references can be indirect 
and perhaps spread across multiple schema.

I will do the same for the other possibilities of cyclic reference if we 
decide not to go down the assertion route.



1a) Optional Direct reference

<xs:element name="optionalCyclicReferenceDirect" 
type="ex:OptionalCyclicReferenceDirect"/>

<xs:complexType name="OptionalCyclicReferenceDirect"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="optionalCyclicReferenceDirect" 
type="ex:OptionalCyclicReferenceDirect" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 

1b) Optional IndirectReference
<xs:element name="optionalCyclicReferenceIndirect" 
type="ex:OptionalCyclicReferenceIndirect"/>

<xs:complexType name="OptionalCyclicReferenceIndirect"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="optionalCyclicReferenceIndirect" 
type="ex:OptionalCyclicReferenceIndirect2" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 


<xs:complexType name="OptionalCyclicReferenceIndirect2"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="optionalCyclicReferenceIndirect" 
type="ex:OptionalCyclicReferenceIndirect" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 



2a) Mandatory Direct reference

<xs:element name="mandatoryCyclicReferenceDirect" 
type="ex:MandatoryCyclicReferenceDirect"/>

<xs:complexType name="MandatoryCyclicReferenceDirect"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="mandatoryCyclicReferenceDirect" 
type="ex:MandatoryCyclicReferenceDirect" minOccurs="1"/> 
</xs:sequence> 
</xs:complexType> 

2b) Mandatory IndirectReference
<xs:element name="mandatoryCyclicReferenceIndirect" 
type="ex:MandatoryCyclicReferenceIndirect"/>

<xs:complexType name="MandatoryCyclicReferenceIndirect"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="mandatoryCyclicReferenceIndirect" 
type="ex:MandatoryCyclicReferenceIndirect2" minOccurs="1"/> 
</xs:sequence> 
</xs:complexType> 


<xs:complexType name="MandatoryCyclicReferenceIndirect2"> 
<xs:sequence> 
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1"/> 
<xs:element name="mandatoryCyclicReferenceIndirect" 
type="ex:MandatoryCyclicReferenceIndirect" minOccurs="1"/> 
</xs:sequence> 
</xs:complexType> 



Instance Document

The instance document for these would be

1a)

<optionalCyclicReferenceDirect>
	<elementMinOccurs1item>Data</elementMinOccurs1item>
	<optionalCyclicReferenceDirect>
		<elementMinOccurs1item>Data</elementMinOccurs1item>
		<optionalCyclicReferenceDirect>
			<elementMinOccurs1item>Data</elementMinOccurs1item>
		</optionalCyclicReferenceDirect>
	</optionalCyclicReferenceDirect>
</optionalCyclicReferenceDirect>

1b)
<optionalCyclicReferenceIndirect>
	<elementMinOccurs1item>Data</elementMinOccurs1item>
	<optionalCyclicReferenceIndirect>
		<elementMinOccurs1item>Data</elementMinOccurs1item>
		<optionalCyclicReferenceIndirect>
			<elementMinOccurs1item>Data</elementMinOccurs1item>
		</optionalCyclicReferenceIndirect>
	</optionalCyclicReferenceIndirect>
</optionalCyclicReferenceIndirect>


2a) N.B. This will not validate because of the minOccurs<0

<mandatoryCyclicReferenceDirect>
	<elementMinOccurs1item>Data</elementMinOccurs1item>
	<mandatoryCyclicReferenceDirect>
		<elementMinOccurs1item>Data</elementMinOccurs1item>
		<mandatoryCyclicReferenceDirect>
			<elementMinOccurs1item>Data</elementMinOccurs1item>
		</mandatoryCyclicReferenceDirect>
	</mandatoryCyclicReferenceDirect>
</mandatoryCyclicReferenceDirect>

2b) N.B. This will not validate because of the minOccurs<0
<mandatoryCyclicReferenceIndirect>
	<elementMinOccurs1item>Data</elementMinOccurs1item>
	<mandatoryCyclicReferenceIndirect>
		<elementMinOccurs1item>Data</elementMinOccurs1item>
		<mandatoryCyclicReferenceIndirect>
			<elementMinOccurs1item>Data</elementMinOccurs1item>
		</mandatoryCyclicReferenceIndirect>
	</mandatoryCyclicReferenceIndirect>
</mandatoryCyclicReferenceIndirect>

Jon Calladine
Matrix Engineering
OneIT Platform Design and Build
BT Exact
Received on Thursday, 8 March 2007 18:13:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 18:20:37 GMT