<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            elementFormDefault="qualified">
   <xsd:annotation>
      <xsd:documentation>
        Version 0.02
      </xsd:documentation>
      <xsd:documentation>
      	Implementation of an XML Schema describing a resource to 
      	be used in the Virtual Observatory Project.  Based on "Resource 
      	and Service Metadata for the Virtual Observatory", Version 6, 
      	February 2002 by Bob Hanisch et al.
      </xsd:documentation>
   </xsd:annotation>

   <!-- Define new datatypes     -->

   <xsd:complexType name="genericResource">
     <xsd:annotation>
       <xsd:documentation>
         This is a base type for defining specific kinds of resources
         (e.g. service, data collection, etc.).  See Resource for a
	 generic definition of a resource.
       </xsd:documentation>
     </xsd:annotation>

     <xsd:sequence>
       	<xsd:element ref="Title"/>
       	<xsd:element ref="Identifier"/>
        <xsd:element ref="Curation"/>
       	<xsd:element ref="Coverage"/>
     </xsd:sequence>

     <xsd:attribute name="ref" type="xsd:anyURI">
       <xsd:annotation>
     	 <xsd:documentation>
     	   The resource indicated by this element is the one referred
	   to by the given URI.  This attribute should be ignored unless
	   the element's content is empty.  
     	 </xsd:documentation>
       </xsd:annotation>
     </xsd:attribute>

     <xsd:attribute name="managedBy" type="xsd:anyURI">
       <xsd:annotation>
     	 <xsd:documentation>
     	   The URI for another resource that is responsible for maintaining
	   this resource.
     	 </xsd:documentation>
       </xsd:annotation>
     </xsd:attribute>
   </xsd:complexType>

   <xsd:complexType name="nameList">
      <xsd:sequence>
         <xsd:element name="Item" type="xsd:string" minOccurs="1" 
		      maxOccurs="unbounded">
            <xsd:annotation>
               <xsd:documentation>
	         Member of an itemized list
	       </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="dateType">
      <xsd:sequence>
         <xsd:element name="Begin" type="xsd:decimal" minOccurs="1" 
                      maxOccurs="unbounded">
            <xsd:annotation>
               <xsd:documentation>
	         Begin date in decimal years
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="End" type="xsd:decimal" minOccurs="0" 
		      maxOccurs="unbounded">
            <xsd:annotation>
               <xsd:documentation>
	         End date in decimal years (optional)
	       </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="ServiceInterface">
     <xsd:complexContent>
       <xsd:extension base="xsd:anyType">
     	 <xsd:attribute ref="defaultTo"/>
     	 
     	 <xsd:attribute name="class">
     	   <xsd:annotation>
     	     <xsd:documentation>
     	       the catagory of service that this service belongs to
     	     </xsd:documentation>
     	   </xsd:annotation>
  
     	   <xsd:simpleType>
     	     <xsd:restriction base="xsd:string">
     	       <xsd:enumeration value="VO-SIA">
     		 <xsd:annotation>
     		   <xsd:documentation>
     		       The standard VO Simple Image Access Protocol Interface
     		   </xsd:documentation>
     		 </xsd:annotation>
     	       </xsd:enumeration>
     	 
     	       <xsd:enumeration value="VO-Cone">
     		 <xsd:annotation>
     		   <xsd:documentation>
     		       The standard VO Cone Search Interface
     		   </xsd:documentation>
     		 </xsd:annotation>
     	       </xsd:enumeration>
     	 
     	       <xsd:enumeration value="HTTP-Form">
     		 <xsd:annotation>
     		   <xsd:documentation>
     		       A form interface that is intended to be used
     		       interactively only via a Web Browser
     		   </xsd:documentation>
     		 </xsd:annotation>
     	       </xsd:enumeration>
     	 
     	       <xsd:enumeration value="HTTP-Get">
     		 <xsd:annotation>
     		   <xsd:documentation>
     		       An HTTP service accessible via a HTTP GET query
     		       following a well-defined syntax.
     		   </xsd:documentation>
     		 </xsd:annotation>
     	       </xsd:enumeration>
     	 
     	       <xsd:enumeration value="WebService">
     		 <xsd:annotation>
     		   <xsd:documentation>
     		       A generic Web Service described by a WSDL document
     		   </xsd:documentation>
     		 </xsd:annotation>
     	       </xsd:enumeration>
     	 
     	     </xsd:restriction>
     	   </xsd:simpleType>
     	 </xsd:attribute>
       </xsd:extension>
     </xsd:complexContent>
   </xsd:complexType>

   <!-- End of special definitions -->

   <!-- reusable attributes -->

   <xsd:attribute name="defaultTo" type="xsd:anyURI">
     <xsd:annotation>
   	 <xsd:documentation>
   	   If provided, then any data not provided by the content of
   	   this element should default to the corresponding data found 
   	   in the resource description pointed to by the given URI.  
   	 </xsd:documentation>
   	 <xsd:documentation>
           The URI should, therefore, refer to a Resource Description.
   	   This URI is expected to be resolved by a VO registry.
   	 </xsd:documentation>
   	 <xsd:documentation>
   	   Example:  if a Curation element uses this attribute, the 
   	   default values for the curation data should be drawn from 
   	   the Curation element of the referred Resource description.
   	 </xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>

   <!-- End of reusable attributes -->

   <!-- reusable elements -->

   <xsd:element name="VODescription">
      <xsd:annotation>
         <xsd:documentation>
	   A description of one or more VO Resources
	 </xsd:documentation>
	 <xsd:documentation>
	   This element is used as a general container for multiple resource
	   descriptions and is intended to be used as a root element.
	 </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="Resource" maxOccurs="unbounded"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <xsd:element name="Resource" type="genericResource">
     <xsd:annotation>
       <xsd:documentation>
          Any entity that is curated by an organization and is
	  identifiable by a URI 
       </xsd:documentation>
     </xsd:annotation>
   </xsd:element>

   <xsd:element name="Curation">
     <xsd:annotation>
       <xsd:documentation>
         Information regarding the general curation of the resource
       </xsd:documentation>
     </xsd:annotation>

     <xsd:complexType>
       <xsd:attribute ref="defaultTo">
         <xsd:annotation>
       	 <xsd:documentation>
       	   This will often be set to the URI given in the Resource's 
       	   "managedBy" attribute.
       	 </xsd:documentation>
         </xsd:annotation>
       </xsd:attribute>
       
       <xsd:sequence>
       	 <xsd:element ref="Publisher" minOccurs="0"/>
       	 <xsd:element ref="Creator" minOccurs="0"/>
       	 <xsd:element ref="Subject" minOccurs="0"/>
       	 <xsd:element ref="Description" minOccurs="0"/>
       	 <xsd:element ref="Contributor" minOccurs="0"/>
       	 <xsd:element ref="Date" minOccurs="0"/>
       	 <xsd:element ref="Version" minOccurs="0"/>
       	 <xsd:element ref="ReferenceURL" minOccurs="0"/>
       	 <xsd:element ref="ServiceURL" minOccurs="0"/>
       	 <xsd:element ref="Contact" minOccurs="0"/>
       	 <xsd:element ref="Type" minOccurs="0"/>
       	 <xsd:element ref="ContentLevel" minOccurs="0"/>
       	 <xsd:element ref="Facility" minOccurs="0"/>
       	 <xsd:element ref="Instrument" minOccurs="0"/>
       	 <xsd:element ref="Format" minOccurs="0"/>
       	 <xsd:element ref="Rights" minOccurs="0"/>
       </xsd:sequence>
     </xsd:complexType>
   </xsd:element>

   <xsd:element name="Title">
      <xsd:annotation>
         <xsd:documentation>Name Given to the Resource</xsd:documentation>
      </xsd:annotation>

      <xsd:complexType>
        <xsd:complexContent>
	  <xsd:extension base="xsd:string">
            <xsd:attribute ref="defaultTo"/>
	  </xsd:extension>
        </xsd:complexContent>
      </xsd:complexType>

   </xsd:element>

   <xsd:element name="Publisher" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   Entity responsible for making the resource available
         </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Creator">
      <xsd:annotation>
         <xsd:documentation>
	   Block describing the entity primarily responsible for
	   making the content of the resource
         </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="CreatorName" minOccurs="0"/>
            <xsd:element ref="Logo" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <xsd:element name="CreatorName" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   Name of Entity primarily responsible for making the content 
	   of the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Logo" type="xsd:anyURI">
      <xsd:annotation>
         <xsd:documentation>
	   URL pointing to a graphical logo, which may be used to help 
	   identify the information source
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Subject" type="nameList">
      <xsd:annotation>
         <xsd:documentation>
	   List of topics, object types, or other descriptive keywords 
	   about the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Description" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   An account of the content of the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Contributor" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   Entity responsible for contributions to the content of 
	   the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Date" type="xsd:date">
      <xsd:annotation>
         <xsd:documentation>
	   Date associated with an event in the life cycle of the
	   resource (YYYY-MM-DD)
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Version" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   Label associated with creation or availablilty
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Identifier" type="xsd:anyURI">
      <xsd:annotation>
         <xsd:documentation>
	   Unambiguous reference to the resource within a given context
         </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="ReferenceURL" type="xsd:anyURI">
      <xsd:annotation>
         <xsd:documentation>
	   URL pointing to further information about the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="ServiceURL" type="xsd:anyURI">
      <xsd:annotation>
         <xsd:documentation>
	   URL pointing to further information about the service
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Contact">
      <xsd:annotation>
         <xsd:documentation>
	   Block describing contact persons responsible for the resource
         </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="Name" minOccurs="0"/>
            <xsd:element ref="Email" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <xsd:element name="Name" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   Name of contact persons responsible for the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Email" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>
	   E-mail address for contacting the persons responsible for 
	   the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Type" type="nameList">
      <xsd:annotation>
         <xsd:documentation>
	   Nature or genre of the content of the resource
	 </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Coverage">
      <xsd:annotation>
         <xsd:documentation>
	   Extent of the scope of the content of the resource
	 </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
         <xsd:attribute ref="defaultTo"/>

         <xsd:sequence>
            <xsd:element ref="Spatial" minOccurs="0"/>
            <xsd:element ref="Spectral" minOccurs="0"/>
            <xsd:element ref="Temporal" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <xsd:element name="Spatial" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>Sky coverage of the resource</xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Spectral">
      <xsd:annotation>
         <xsd:documentation>
	   Spectral coverage of the resource
	 </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="SpecDesc" minOccurs="0"/>
            <xsd:element ref="Bandpass" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
   <xsd:element name="SpecDesc" type="nameList">
      <xsd:annotation>
         <xsd:documentation>Specific Spectral Coverage 
Description</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="Bandpass" type="nameList">
      <xsd:annotation>
         <xsd:documentation>Specific Bandpass Coverage 
Specification</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="Temporal" type="dateType">
      <xsd:annotation>
         <xsd:documentation>Temporal coverage of the resource. Separate begin 
and end dates in decimal years (YYYY.DD)</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="ContentLevel" type="nameList">
      <xsd:annotation>
         <xsd:documentation>Description of the content level, or intended 
audience</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="Facility" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>Observatory or facility where the data was 
obtained</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="Instrument" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>Instrument used to collect the 
data</xsd:documentation>
      </xsd:annotation>
   </xsd:element>
   <xsd:element name="Format" type="nameList">
      <xsd:annotation>
         <xsd:documentation>Encoding format of data provided by the 
resource</xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Rights" type="xsd:string">
      <xsd:annotation>
         <xsd:documentation>Information about rights held in and over the 
resource</xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <xsd:element name="Organization" type="genericResource" 
		substitutionGroup="Resource">
     <xsd:annotation>
       <xsd:documentation>
          A group or person that manages data or services for VO applications
       </xsd:documentation>
     </xsd:annotation>
   </xsd:element>

   <xsd:element name="Project" type="genericResource" 
		substitutionGroup="Resource">
     <xsd:annotation>
       <xsd:documentation>
          An organization with a focused set of data and services that
          it maintains.
       </xsd:documentation>
     </xsd:annotation>
   </xsd:element>

   <xsd:element name="Service" substitutionGroup="Resource">
     <xsd:annotation>
       <xsd:documentation>
          A resource that provides an interface for executing some
	  operation or retrieving data.
       </xsd:documentation>
     </xsd:annotation>

     <xsd:complexType>
       <xsd:complexContent>
         <xsd:extension base="genericResource">
	   <xsd:sequence>
	     <xsd:element ref="Interface"/>
	   </xsd:sequence>
         </xsd:extension>
       </xsd:complexContent>
     </xsd:complexType>
   </xsd:element>

   <xsd:element name="Interface" type="ServiceInterface">
     <xsd:annotation>
       <xsd:documentation>
          A resource that provides an interface for executing some
	  operation or retrieving data.
       </xsd:documentation>
     </xsd:annotation>
   </xsd:element>

</xsd:schema>
