W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

Schema Information Set Contribution: Identity-constraint Table

From: Mary F. Fernandez <mff@research.att.com>
Date: Wed, 15 Mar 2000 19:50:26 +0000
Message-ID: <38CFE982.41B0CA99@research.att.com>
To: www-xml-schema-comments@w3.org
Cc: xmlquery <w3c-xml-query-wg@w3.org>

I am writing as a representative of the XML Query working group.
Currently,
we are specifying the data model for XML Query.  Part of that exercise
requires
specifying formally the mapping from an instance of the PSV Infoset to
an
instance of the Query data model.

This message regards the definition of the Schema Infoset Contribution
for
Identity-constraint tables described in :
http://www.w3.org/TR/xmlschema-1/#Identity-constraint_Definition_details.

This message has 2 parts:

Part 1.
=====
A request to review the example in the attached text file.
Please confirm that this example is correct w.r.t. the definition above.

If not, please explain how we misinterpreted the definition.

The attached example contains an abbreviated version of the
<purchaseReport>
example by David Fallside in :
http://www.w3.org/XML/Group/xmlschema-current/new-design/exposition.html

For the given example, we define a fragement of the corresponding
PSV Infoset instance,
which contains the Identity-constraint table for the <purchaseReport>
element item.

We use the following notation :
    is:  denotes the namespace for information set items
   psvis: denotes the namespace for Schema contributions to Infoset

Here's a DTD for an identity-constraint table that I inferred from the
XML Schema document :

<!ELEMENT psvis:identityConstraintTable    (psvis:identityConstraint,
psvis:nodeTable)*>
<!ELEMENT psvis:identityConstraint    is:ref>
<!ELEMENT psvis:nodeTable    (psvis:keySequence, psv:qualifiedNode)*>
<!ELEMENT psvis:keySequence    (is:ref)*>
<!ELEMENT psvis:qualifiedNode    is:ref>
<!ELEMENT is:ref    EMPTY>
<!ATTLIST    is:ref    idref >

Part 2
=====
A question and a suggestion follow.

In the subsection "Schema Information Set Contribution:
Identity-constraint Table",
I believe "key sequence k"  should be changed to "key sequence b".  If
not, then please
explain the relationship between the b & k key sequences.

Part of the difficulty in understanding the definition of the
Identity-Constraint table
is that the document tries to describe in prose both *what* the table is

and *how* to construct it at the same time.   I tried to translate the
prose into
a pseudo-code specification (see below).   If we assume that a node
table is
is a table of (key-sequence, qualified-node) pairs and is keyed on
key-sequence,
we can compute a new node table for element E, eligible constraint C as
follows:

fun nodeTable(E, C) {
  let /* compute node table for element E & constraint C */
        table = UNION(forall (keyseq, qualnode) in eligibleConstraint(E,
C))
        /* inherit non-conflicting constraints from children */
        kidsTable  = UNION(forall K in children(E), nodeTable(K, C))
        inheritTable = kidsTable - table
  in table UNION inheritTable
}
// inheritTable is really a project on key-sequence, difference of the
// two tables and then a join with kidsTable to reconstruct the
inherited table.

You might not want to present the definition in such a form, but for
anyone who
must implement or use the Schema definition (such as the Query working
group),
this is precisely what must be inferred.

Thanks,
Mary Fernandez



A. Abbreviated Example Data (same Schema as in full example)

<purchaseReport>
  <regions>
    <zip code="95819"> 
      <part number="872-AA"/> 
      <part number="455-BX"/>  
   </zip>
    <zip code="63143"> 
      <part number="455-BX"/> 
   </zip>
 </regions>
  <parts>
    <part number="872-AA">Lawnmower</part>  
    <part number="455-BX">Sturdy Shelves</part> 
  </parts>
</purchaseReport>

B. Information-Set Instance for Example Data in A.
This is an XML serialization of the infoset instance. 

<is:Document id="document#0">
  <is:children>
    <is:ref idref="element#0"/>
    <!-- reference to infoset item for schema -->
    <psvis:schema idref="schema#0"/>
  </is:children>
</is:Document>

<is:Element is:id="element#0">
  <is:localName>purchaseReport</is:localName>
  <is:children>
    <is:ref idref="element#1">
    <is:ref idref="element#7">
  </is:children>

  <psvis:identityConstraintTable>
    <!-- Skip <unique> constraint -->

    <!-- Constraint : <key name="pNumKey">  --> 
    <psvis:identityConstraint>
      <!-- reference to infoset item for 
       <key name="pNumKey"> -->
      <is:ref idref="identityConstraint#0"/>
    </psvis:identityConstraint>
    <psvis:nodeTable>
      <psvis:keySequence>
        <!-- number="872-AAA" -->
        <is:ref idref="attribute#5"/>
      </psvis:keySequence>
      <psvis:qualifiedNode>
        <is:ref idref="element#8"/>
      </psvis:qualifiedNode>

      <psvis:keySequence>
        <!-- number="455-BX" -->
        <is:ref idref="attribute#6"/>
      </psvis:keySequence>
      <psvis:qualifiedNode>
        <is:ref idref="element#9"/
      </psvis:qualifiedNode>
    </psvis:nodeTable>

    <!-- Constarint : <keyref refer="pNumKey"> --> 
    <psvis:identityConstraint>
      <!-- reference to infoset item for
       <keyref refer="pNumKey">...</key> -->
      <is:ref idref="identityConstraint#1"/>
    </psvis:identityConstraint>
    <psvis:nodeTable>
      <psvis:keySequence>
        <!-- number="872-AAA" -->
        <is:ref idref="attribute#1"/>
      </psvis:keySequence>
      <psvis:qualifiedNode>
        <is:ref idref="element#8"/>
      </psvis:qualifiedNode>

      <psvis:keySequence>
        <!-- number="455-BX" -->
        <is:ref idref="attribute#2"/>
      </psvis:keySequence>
      <psvis:qualifiedNode>
        <is:ref idref="element#9"/
      </psvis:qualifiedNode>

      <psvis:keySequence>
        <!-- number="455-BX" -->
        <is:ref idref="attribute#4"/>
      </psvis:keySequence>
      <psvis:qualifiedNode>
        <is:ref idref="element#9"/
      </psvis:qualifiedNode>
    </psvis:nodeTable>
  </psvis:identityConstraintTable>
</is:Element>

<is:Element is:id="element#1">
  <is:localName>regions</is:localName>
  <is:children>
    <is:ref idref="element#2"/>
    <is:ref idref="element#5"/>
  </is:children>
</is:Element>

<is:Element is:id="element#2">
  <is:localName>zip</is:localName>
  <is:attributes>
    <is:ref idref="attribute#0"/>
  </is:attributes>
  <is:children>
    <is:ref idref="element#3"/>
    <is:ref idref="element#4"/>
  </is:children>
</is:Element>

<is:Element is:id="element#3">
  <is:localName>part</is:localName> 
  <is:attributes>
    <is:ref idref="attribute#1/>
  </is:attributes>
</is:Element>

<is:Element is:id="element#4">
  <is:localName>part</is:localName> 
  <is:attributes>
    <is:ref idref="attribute#2/>
  </is:attributes>
</is:Element>

<is:Element is:id="element#5">
  <is:localName>zip</is:localName>
  <is:attributes>
    <is:ref idref="attribute#3"/>
  </is:attributes>
  <is:children>
    <is:ref idref="element#6"/>
  </is:children>
</is:Element>

<is:Element is:id="element#6">
  <is:localName>part</is:localName> 
  <is:attributes>
    <is:ref idref="attribute#4/>
  </is:attributes>
</is:Element>

<is:Element is:id="element#7">
  <is:localName>parts</is:localName> 
  <is:children>
    <is:ref idref="element#8"/>
    <is:ref idref="element#9"/>
  </is:children>
</is:Element>

<is:Element is:id="element#8">
  <is:localName>part</is:localName> 
  <is:attributes>
    <is:ref idref="attribute#5/>
  </is:attributes>
  <is:children>
    <!-- references to CDATAItems for "Lawnmower" -->
  </is:children>
</is:Element>

<is:Element is:id="element#9">
  <is:localName>part</is:localName> 
  <is:attributes>
    <is:ref idref="attribute#6/>
  </is:attributes>
  <is:children>
    <!-- references to CDATAItems for "Sturdy Shelves" -->
  </is:children>
</is:Element>

<is:Attribute is:id="attribute#0">
  <is:localName>code</is:localName>
  <value>95819</value>
</is:Attribute>

<is:Attribute is:id="attribute#1">
  <is:localName>number</is:localName>
  <value>872-AA</value>
</is:Attribute>

<is:Attribute is:id="attribute#2">
  <is:localName>number</is:localName>
  <value>455-BX</value>
</is:Attribute>

<is:Attribute is:id="attribute#3">
  <is:localName>number</is:localName>
  <value>872-AA</value>
</is:Attribute>

<is:Attribute is:id="attribute#4">
  <is:localName>number</is:localName>
  <value>455-BX</value>
</is:Attribute>


Received on Wednesday, 15 March 2000 14:50:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT