[Nml-wg] Review of the XSD schema
Roman Łapacz
romradz at man.poznan.pl
Wed Jan 16 05:57:33 EST 2013
W dniu 2012-12-28 02:34, Freek Dijkstra pisze:
>
> General questions and remarks:
> ------------------------------
>
> * Where does it specify that all NML descriptions should start with
> nml:Topology as the root element?
It's not specified. No need.
>
> * In the current schema, the order of child elements is very strict --
> it is a sequence of elements in particular order. For example, a
> relation element MUST occur before a Location element. If relation
> occurs after a Location, the document is invalid.
>
> Here is an excerpt for the schema:
>
>> <xs:complexType name="NetworkObject">
>> <xs:sequence>
>> <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
>> <xs:element name="relation" type="nml:RelationType" minOccurs="0" />
>> <xs:element name="Location" type="nml:LocationType" minOccurs="0" maxOccurs="1"/>
>> <xs:element name="parameter" type="nml:ParameterType" minOccurs="0"/>
>> <!-- .... -->
>> </xs:sequence>
>> <!-- .... -->
>> </xs:complexType>
> Instead, I would suggest to use xs:all:
>
>> <xs:complexType name="NetworkObject">
>> <xs:all>
>> <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
>> <xs:element name="relation" type="nml:RelationType" minOccurs="0" />
>> <xs:element name="Location" type="nml:LocationType" minOccurs="0" maxOccurs="1"/>
>> <xs:element name="parameter" type="nml:ParameterType" minOccurs="0"/>
>> <!-- .... -->
>> </xs:all>
>> <!-- .... -->
>> </xs:complexType>
In theory the use of xs:all is allowed inside xs.complexType but when I
run validation for it in this case (based on Xerces) it gets crazy:
Error at (file nmlbase.xsd, line 149, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 196, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 107, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 235, char 46): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 287, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 323, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 359, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 416, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 460, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 494, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file nmlbase.xsd, line 523, char 47): all compositor that is
part of a complex type definition must constitute the entire content of
the definition
Error at (file stdin, line 7, char 45): attribute 'id' is not declared
for element 'Topology'
Error at (file stdin, line 7, char 45): attribute 'version' is not
declared for element 'Topology'
Error at (file stdin, line 17, char 77): attribute 'id' is not declared
for element 'Link'
Error at (file stdin, line 17, char 77): attribute 'encoding' is not
declared for element 'Link'
Error at (file stdin, line 21, char 57): attribute 'id' is not declared
for element 'Node'
Error at (file stdin, line 37, char 69): attribute 'id' is not declared
for element 'Topology'
Error at (file stdin, line 39, char 77): attribute 'id' is not declared
for element 'BidirectionalPort'
Error at (file stdin, line 40, char 71): attribute 'id' is not declared
for element 'Port'
Error at (file stdin, line 41, char 70): attribute 'id' is not declared
for element 'Port'
It does not like the structure:
<xs:complexType name="...">
<xs:complexContent>
<xs:extension base="nml:NetworkObject">
Besides xs:all seems to be very limited. It can not contain xs:group,
xs:choice, xs:sequence.
> * I don't really understand how you are trying to deal with implicit and
> explicit relations.
> This seems at first very powerful (meaning: either use implicit or
> explicit):
>
>> <xs:choice>
>> <xs:element name="lifetime" type="nml:LifeTimeType" minOccurs="0" maxOccurs="1"/>
>> <xs:element name="existDuring" type="nml:ExistDuringType" minOccurs="0" maxOccurs="1"/>
>> </xs:choice>
> In fact there are four ways to represent implicit relations:
>
> 1.
>
> <nml:Node id="...">
> <nml:name>My Device</nml:name>
> <nml:Location>
> <nml:name>Somewhere</nml:name>
> </nml:Location>
> </nml:Node>
>
> 2.
>
> <nml:Node id="...">
> <nml:name>My Device</nml:name>
> <nml:Relation type="http:....nml/base#locatedAt">
> <nml:Location>
> <nml:name>Somewhere</nml:name>
> </nml:Location>
> </nml:Relation>
> </nml:Node>
>
> 3.
>
> <nml:Node id="...">
> <nml:name>My Device</nml:name>
> <nml:Location id="..." />
> </nml:Node>
> <nml:Location id="...">
> <nml:name>Somewhere</nml:name>
> </nml:Location>
>
> 4.
>
> <nml:Node id="...">
> <nml:name>My Device</nml:name>
> <nml:Relation type="http:....nml/base#locatedAt">
> <nml:Location id="..." />
> </nml:Relation>
> </nml:Node>
> <nml:Location id="...">
> <nml:name>Somewhere</nml:name>
> </nml:Location>
>
> Currently, for Location/locatedAt only the form 1 seems allowed.
> For LifeTime/existDuring only forms 1 and 3 seem allowed.
>
> Is this on purpose? (I presume it is on purpose that the explicit
> variants are not listed, but that the missing form #3 for Location is a
> omission.)
>
> * To iterate on existsDuring: It seems that the described form it even
> slightly different:
>
> <nml:Node id="...">
> <nml:name>My Device</nml:name>
> <nml:existDuring idRef="..." />
> </nml:Node>
>
> (thus without the <nml:LifeTime> wrapper)
I updated Relations. Now there is clear distinction between implicit and
explicit ones.
>
> Is that interpretation correct?
>
> * The RelationType lists all possible relation URIs as values for the
> type attribute. Is it permitted to use a URI not listed here? Thus, is
> is possible to define a new relation in nml-experimental, without
> changing nml-base?
Experimental relations I propose to put in a separate namespace. This
should work.
>
> Specific remarks:
> -----------------
>
>> <xs:attribute name="idRef" type="xs:anyURI" use="optional"/>
> Remove line 32, as idRef is no longer used:
I keep idRef as we agreed to still support it (as an option; correct me
if I'm wrong).
(updated version of the xsd schema is already uploaded in the repo)
Roman
More information about the nml-wg
mailing list