[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: Multiple key/key symbol spaces
> What I don't understand now is how you refer to scoped keys. > > If the department is unique only within a company, can it be referenced? > Or Isn't it something to be referenced? This is the big problem with scoped keys. XML Schema cannot handle hierarchical references well (at all really). Let's take a concrete example. <element name="vehicleRegistrationDatabase"> <element name="vehicles> <zeroOrMore> <element name="state"> <attribute name="stateCode"/> <zeroOrMore> <element name="vehicle"> <element name="owner.ssn"><anyString/></element> <element name="regno"><anyString/></element> </element> </zeroOrMore> </element> </zeroOrMore> </element> <element name="persons"> <zeroOrMore> <element name="person"> <attribute name="ssn"/> <zeroOrMore> <element name="ownedVehicle"> <attribute name="stateCode"/> <attribute name="regno"/> </element> </zeroOrMore> </element> </zeroOrMore> </element> </element> For such a schema, we might have a hierarchical IDREF constraint as follows. So for every vehicleRegistrationDatabase $x, for every $x/persons/person/ownedVehicle $v, there must be a $x/vehicles/state $s such that - $s/@stateCode = $v/@stateCode and - there is a $s/vehicle $w such that $w/regno = $v/@regno. One could imagine encoding this by modifying the pattern for vehicleRegistrationDatabase along the following lines: <element name="vehicleRegistrationDatabase"> <keyRef> <selector>persons/person/ownedVehicle</selector> <ref> <from>@stateCode</from> <to> <selector>vehicles/state</selector> <field>@stateCode</field> <ref> <from>@regno</from> <to> <selector>vehicle</selector> <field>regno</field> </to> </ref> </to> </ref> </keyRef> <element name="vehicles"> ... </element> James
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC