org.eclipse.cosmos/tests/resource-modeling/org.eclipse.cosmos.rm.validation.tests/src/test-resources/identity/InValidDuplicateKeyConstraintName.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Mon Aug 18 17:12:58 2008 UTC (17 months, 3 weeks ago) by amehregani
Branch: MAIN
CVS Tags: v1_0_0_i13, COSMOS_1_0_0
Branch point for: COSMOS-1_0_0
Changes since 1.1: +8 -7 lines
https://bugs.eclipse.org/bugs/show_bug.cgi?id=237921
<?xml version="1.0" encoding="utf-8"?>
<!--
/*******************************************************************************
 * Copyright (c) 2008 IBM Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
 -->
<model xmlns="http://www.w3.org/2008/09/sml-if" schemaComplete="true">
  <identity>
    <name>InvalidDuplicateConstraintName1</name>
    <baseURI>
		http://interop.serviceml.org
	</baseURI>
    <description>
    	A model is invalid if two constraint names under the same element have
    	the same name   
    </description>
    
  </identity>
  <definitions>
    <document>
      <data> 
        <xs:schema 
          targetNamespace="urn:university"
          elementFormDefault="qualified"
          xmlns:tns="urn:university"
          xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:sml="http://www.w3.org/2008/09/sml"
          xmlns:smlfn=
                "http://www.w3.org/2008/09/sml-function">

          <xs:element name="EnrolledStudent"/>
          <xs:element name="Student" type="tns:StudentType"/>
                      
          <xs:element name="University" type="tns:UniversityType">
            <xs:annotation>
              <xs:appinfo>
                <sml:key name="StudentConstraint">
                  <sml:selector xpath=
                  "smlfn:deref(tns:EnrolledStudents/tns:EnrolledStudent)"/>
                  <sml:field xpath="tns:ID"/>
                </sml:key>
              
				<!-- Error;  name conflict. StudentConstraint name already used on another constraint --> 
				<!-- defined on the same element -->                
                <sml:key name="tns:StudentConstraint">
					<sml:selector xpath="smlfn:deref(tns:EnrolledStudents/tns:EnrolledStudent)"/>
                  	<sml:field xpath="tns:ID"/>
				</sml:key>
                
              </xs:appinfo>
            </xs:annotation>
          </xs:element>          

          <xs:complexType name="StudentType">
            <xs:sequence>
              <xs:element name="ID" type="xs:string"/>
              <xs:element name="Name" type="xs:string"/>
            </xs:sequence>
            <xs:attribute name="SSN" type="xs:string" 
                          use="optional"/>
          </xs:complexType>

          <xs:complexType name="UniversityType">
            <xs:sequence>
              <xs:element name="Name" type="xs:string"/>
              <xs:element name="EnrolledStudents" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element ref="tns:EnrolledStudent" 
                                maxOccurs="unbounded"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:schema>
      </data>
    </document>
  </definitions>
</model>