org.eclipse.cosmos/tests/resource-modeling/org.eclipse.cosmos.rm.validation.tests/src/test-resources/deref/InValidUnrecognizedScheme.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Tue Aug 19 18:02:49 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.2: +7 -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>SingleRef</name>
    <baseURI>
		http://interop.serviceml.org
	</baseURI>
    <description>
      Verify a schematron test using a deref function to resolve an
      unrecognized reference scheme will fail
    </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>
              <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
                <sch:ns prefix="u" uri="urn:university" />
                <sch:ns prefix="smlfn"   
                        uri="http://www.w3.org/2008/09/sml-function"/>
                <sch:pattern id="StudentPattern">
                  <sch:rule context="/u:University">
                    <sch:assert test="count(smlfn:deref(u:EnrolledStudents/u:EnrolledStudent))=1">
                      The university is expected to only have one enrolled student
                    </sch:assert>
                  </sch:rule>
                </sch:pattern>
              </sch:schema>
            </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:element name="customReferenceScheme" type="xs:anyURI"/>        
      </xs:schema>
      </data>
    </document>
  </definitions>
  <instances>
    <document>
      <docinfo>
        <aliases>
          <alias>Student1</alias>
        </aliases>
      </docinfo>
      <data>
        <Student xmlns="urn:university"
                 SSN="123-22-4444">
          <ID>1000</ID>
          <Name>John</Name>
        </Student>
      </data>
    </document>
    <document>
      <data>
        <University xmlns="urn:university"
         xmlns:sml="http://www.w3.org/2008/09/sml">
          <Name>MIT</Name>
          <EnrolledStudents>
            <EnrolledStudent sml:ref="true">                            
              <customReferenceScheme>
                Student1
              </customReferenceScheme>
            </EnrolledStudent>
          </EnrolledStudents>
        </University>
      </data>
    </document>
  </instances>
</model>