W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: pair interactions in XML schema

From: Bob Schloss <rschloss@us.ibm.com>
Date: Sun, 16 Jun 2002 08:01:59 -0400
To: Jos van den Oever <oever@fenk.wau.nl>, xmlschema-dev@w3.org
Message-ID: <OF97D7C690.AD57DD3E-ON85256BDA.0040C86E@us.ibm.com>


You can get close to this with 2 different <unique> identity-definition

The first one, which will be part of the definition of element
acquaintance, will specify that all the fields person/@name within 1
acquaintance must have unique values.

The second one, which will be part of the definition of the element which
contains all the acquaintance elements (and possibly all the person
elements also),  will say that the concatenation of all fields person/@name
within selector acquaintance must be unique.  (I'm not 100% certain that
naming a single field when that element/particle (person) is declared
minOccurs="2" maxOccurs="2" actually does this.).

However, this second <unique) will not enforce your condition *unless* your
documents always specify the two child elements of acquaintance in some
fixed order, such as the person whose name is lowest in alphabetical order
always comes first, or the person which appears in the person elements
order comes first.  (And there's no way to tell a validator to check that).

There are supplements to the W3C XML Schema language, such as Schematron,
that give richer language for specifying cross-element content relationship
constraints.  They have not been endorsed by the W3C.  The possibility of
enriching the W3C XML Schema language in a future version comes up for
discussion from time to time.

Bob Schloss
IBM Watson Research Center
Hawthorne, NY, USA

Jos van den Oever <oever@fenk.wau.nl>@w3.org on 06/15/2002 01:28:30 PM

Sent by:    xmlschema-dev-request@w3.org

To:    xmlschema-dev@w3.org
Subject:    pair interactions in XML schema

Hi all,

For the description of pair interactions I'd like to be able to make an XML
file like this (items renamed for convenience):

<person name='Jack'>...</person>
<person name='Jane'>...</person>
<person name='Pete'>...</person>

<acquaintance years='9'><person name='Jack'><person
<acquaintance years='1'><person name='Pete'><person
<acquaintance years='3'><person name='Jack'><person

Of course, each acquaintance between two persons can only be defined once.
the acquaintance of one person with the same person cannot be defined

Is it possible to enforce these rules with Schema?
It seems I cannot use complexTypes as keys, which would solve the problem.

Best regards, Jos
Received on Sunday, 16 June 2002 08:03:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC