<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.ivoa.net/xml/DataModel/v1" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0" 
           xmlns:vodm="http://www.ivoa.net/xml/DataModel/v1" 
           xmlns:vm="http://www.ivoa.net/xml/VOMetadata/v0.1"
           elementFormDefault="unqualified" attributeFormDefault="unqualified"
           version="1.0" >

   <xs:annotation>
      <xs:appinfo>
        <vm:schemaName>DataModel</vm:schemaName>
        <vm:schemaPrefix>xs</vm:schemaPrefix>
        <vm:targetPrefix>vodm</vm:targetPrefix>
      </xs:appinfo>
      <xs:documentation>
        This schema defines a type for registering data models written
        in the VO-DML modelling language.
      </xs:documentation>
   </xs:annotation>

   <xs:import namespace="http://www.ivoa.net/xml/VOResource/v1.0" 
   	schemaLocation="http://docs.g-vo.org/schemata/VOResource.xsd"/>

   <xs:complexType name="DataModel">
      <xs:annotation>
         <xs:documentation>
           a VO-DML-based data model.
         </xs:documentation>
         <xs:documentation>
           In addition to usual resource metadata, this defines the prefix
           and the URI at which to retrieve the formal data model definition.

           DataModels should have IsSupplementTo relationships to their
           defining standard.
         </xs:documentation>
      </xs:annotation>

      <xs:complexContent>
         <xs:extension base="vr:Resource">
            <xs:sequence>

              <xs:element name="capability" type="vr:Capability" 
                          minOccurs="0" maxOccurs="unbounded">
                 <xs:annotation>
                    <xs:documentation>
                       a description of a capability in connection
                       with the data model.
                    </xs:documentation>
                    <xs:documentation>
                       This could include validators, online converters,
                       or similar facilities.
                    </xs:documentation>
                 </xs:annotation>
              </xs:element>

              <xs:element name="dm-prefix" type="xs:string" 
                  minOccurs="1" maxOccurs="1">
                <xs:annotation>
                   <xs:documentation>
                     the prefix clamined by the datamodel, including a
                     training colon.
                   </xs:documentation>
                   <xs:documentation>
                    Each data model can only claim one prefix.  Before
                    claiming a prefix, a search in the VO Registry must
                    ascertain that the prefix is not claimed by another
                    data model.
                   </xs:documentation>
                </xs:annotation>
              </xs:element>

              <xs:element name="dm-uri" type="xs:string"
                          minOccurs="1" maxOccurs="1">
                <xs:annotation>
                   <xs:documentation>
                     The URI of the VO-DML definition of the data model.
                   </xs:documentation>
                   <xs:documentation>
                     This URI should be constant by major version of the
                     standard; see the VO-DML REC for deployment advice.
                   </xs:documentation>
                </xs:annotation>
              </xs:element>

            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
</xs:schema>
