<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema targetNamespace="http://www.cs.indiana.edu/dde/namespaces/2008/02/catalog/types"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:cat="http://www.cs.indiana.edu/dde/namespaces/2008/02/catalog/types"
            xml:lang="en"
            elementFormDefault="qualified" 
            attributeFormDefault="unqualified" >

	<xsd:annotation>
		<xsd:documentation>
			Copyright 2007 The Trustees of Indiana University

			Licensed under an Apache-style license  (the "License"); you may not use this file except 
			in compliance with the License.
			You may obtain a copy of the License at

			http://www.cs.indiana.edu/dde/LICENSE-myLEAD

			Unless required by applicable law or agreed to in writing, software distributed under the 
			License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
			either express or implied. See the License for the specific language governing permissions 
			and limitations under the License.

			Author: Scott Jensen, scjensen@cs.indiana.edu
			Version 1.0.8
		</xsd:documentation>
	</xsd:annotation>

	<!-- Imports and Includes-->
	<xsd:include schemaLocation="catalog_status.xsd"/>
	<xsd:include schemaLocation="domain_properties.xsd"/>

	<!-- ****************** -->
	<!-- Status Information -->
	<!-- ****************** -->
	<xsd:element name="catalogStat">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					The stats available regarding the service may grow or change 
					over time.  To avoid changes to the schema. each statistic 
					regarding the catalog service is returned as a catalogStat 
					element.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:simpleContent>
				<xsd:extension base="xsd:string">
					<xsd:attribute name="name" type="xsd:string" use="required"/>
				</xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="checkStatusRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="checkStatusResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogStat" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- **************** -->
	<!-- User Information -->
	<!-- **************** -->

	<xsd:complexType name="userAddrType">
		<xsd:sequence>
			<xsd:element name="addrType" type="xsd:string" minOccurs="0"/>
			<xsd:element name="addrStreet" type="xsd:string" minOccurs="0"/>
			<xsd:element name="addrCity" type="xsd:string" minOccurs="0"/>
			<xsd:element name="addrState" type="xsd:string" minOccurs="0"/>
			<xsd:element name="addrPostcode" type="xsd:string" minOccurs="0"/>
			<xsd:element name="addrCountry" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="userType">
		<xsd:annotation>
			<xsd:documentation>
				The fields in the user definition are based on the 
				FGDC schema's Contact schema definition.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="userId" nillable="false" type="xsd:string"/>
			<xsd:element name="userName" type="xsd:string" minOccurs="0"/>
			<xsd:element name="organization" type="xsd:string" minOccurs="0"/>
			<xsd:element name="position" type="xsd:string" minOccurs="0"/>
			<xsd:element name="address" type="cat:userAddrType" minOccurs="0"/>
			<xsd:element name="phone" type="xsd:string" minOccurs="0"/>
			<xsd:element name="ttdttyPhone" type="xsd:string" minOccurs="0"/>
			<xsd:element name="email" type="xsd:string" minOccurs="0"/>
			<xsd:element name="fax" type="xsd:string" minOccurs="0"/>
			<xsd:element name="url" type="xsd:string" minOccurs="0"/>
			<xsd:element name="hours" type="xsd:string" minOccurs="0"/>
			<xsd:element name="contactInstructions" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="catalogUser" type="cat:userType" nillable="false"/>

	<xsd:element name="createUserRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogUser" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="createUserResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="updateUserRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="userId" nillable="false" type="xsd:string"/>
				<xsd:element ref="cat:catalogUser" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="updateUserResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deleteUserRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="deletedUserId" nillable="false" type="xsd:string" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deleteUserResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<xsd:element name="queryUserRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="userId" nillable="false" type="xsd:string"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="queryUserResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:element ref="cat:catalogUser" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<xsd:element name="doesUserExistRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="doesUserExistResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:element name="userExists" type="xsd:boolean"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<!-- ********** -->
	<!-- Whiteboard -->
	<!-- ********** -->
	<xsd:element name="whiteboardIdRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="whiteboardIdResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:element name="objectId" type="xsd:string" nillable="true"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ************************* -->
	<!--      CatalogDataType      -->
	<!-- ************************* -->
	<xsd:complexType name="catalogDataType">
		<xsd:sequence>
			<xsd:group ref="cat:catalogObjectGroup" />
			<xsd:element name="catalogType" type="cat:catalogAggregationType" />
			<xsd:element name="parentId" type="xsd:string" minOccurs="0" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="catalogData" type="cat:catalogDataType" nillable="false"/>


	<!-- *************************** -->
	<!-- Create, Delete, Move Object -->
	<!-- *************************** -->
	<xsd:element name="createObjectRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogData" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="createObjectResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deleteObjectRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="objectId" type="xsd:string" nillable="false" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deleteObjectResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="moveObjectRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="objectId" type="xsd:string" nillable="false"/>
				<xsd:element name="parentId" type="xsd:string" nillable="false"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="moveObjectResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="objectExistsRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="objectId" type="xsd:string" nillable="false"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="objectExistsResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:element name="objectExists" type="xsd:boolean"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ************** -->
	<!-- Add Properties -->
	<!-- ************** -->
	<xsd:complexType name="catalogPropertyType">
		<xsd:sequence>
			<xsd:element name="objectId" type="xsd:string" nillable="false"/>
			<xsd:element ref="cat:catalogPropertyAdd" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="catalogProperty" type="cat:catalogPropertyType" nillable="false"/>

	<xsd:element name="addPropertyRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogProperty" maxOccurs="unbounded"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="addPropertyResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ***************** -->
	<!-- Update Properties -->
	<!-- ***************** -->
	<xsd:complexType name="updatePropertyType">
		<xsd:sequence>
			<xsd:element name="objectId" type="xsd:string" nillable="false"/>
			<xsd:element ref="cat:catalogPropertyUpdate"/>
			<xsd:element name="position" type="xsd:int" minOccurs="0"/>
			<xsd:element name="lastUpdate" type="xsd:long" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="updateProperty" nillable="false" type="cat:updatePropertyType"/>

	<xsd:element name="updatePropertyRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:updateProperty"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="updatePropertyResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ***************** -->
	<!-- Delete Properties -->
	<!-- ***************** -->
	<xsd:complexType name="deletePropertyRangeType">
		<xsd:sequence>
			<xsd:element name="first" type="xsd:int" />
			<xsd:element name="last" type="xsd:int" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="deletePropertyType">
		<xsd:sequence>
			<xsd:element name="objectId" type="xsd:string" nillable="false"/>
			<xsd:element name="propertyName" type="xsd:string"/>
			<xsd:element name="propertySource" type="xsd:string"/>
			<xsd:choice minOccurs="0">
				<xsd:element name="position" type="xsd:int" maxOccurs="unbounded"/>
				<xsd:element name="propertyRange" type="cat:deletePropertyRangeType"/>
			</xsd:choice>
			<xsd:element name="lastUpdate" type="xsd:long"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="deleteProperty" nillable="false" type="cat:deletePropertyType"/>

	<xsd:element name="deletePropertyRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:deleteProperty"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deletePropertyResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ************* -->
	<!--    Queries    -->
	<!-- ************* -->
	<!-- Query Hierarchy Filters -->

	<xsd:simpleType name="hierarchyFilterType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="TARGET"/>
			<xsd:enumeration value="SUBTREE"/>
			<xsd:enumeration value="CHILDREN"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:element name="hierarchyFilter" type="cat:hierarchyFilterType"/>

	<xsd:complexType name="parentChildFilterType">
		<xsd:sequence>
			<xsd:element name="distLimit" type="xsd:int"/>
			<xsd:element name="excluded" type="cat:catalogAggregationType" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="hierarchyFilterSetType">
		<xsd:annotation>
			<xsd:documentation>
				This filter is used to determine what objects other than the target
				should be included in the result.  If neither the parentFilter
				or the childFilter is included, then this is the same as the
				TARGET hierarchy filter.
				If either the parent or child filter has a distance limit of 0,
				then all of the parents or children respectively are included.
				If parents or children should be excluded by type, then each 
				type to be excluded should be an excluded element in the 
				respective filter.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="parentFilter" type="cat:parentChildFilterType" minOccurs="0"/>
			<xsd:element name="childFilter" type="cat:parentChildFilterType" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="hierarchyFilterSet" type="cat:hierarchyFilterSetType"/>


	<!-- Query Content Filters -->

	<xsd:simpleType name="contentFilterType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="ID_ONLY"/>
			<xsd:enumeration value="FULL_SCHEMA"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:element name="contentFilter" type="cat:contentFilterType"/>

	<xsd:complexType name="propertyFilterType">
		<xsd:sequence>
			<xsd:element name="propertyName" type="xsd:string" />
			<xsd:element name="propertySource" type="xsd:string" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="propertyFilter" type="cat:propertyFilterType" />

	<xsd:complexType name="elementFilterType">
		<xsd:sequence>
			<xsd:element name="propertyName" type="xsd:string" />
			<xsd:element name="propertySource" type="xsd:string" />
			<xsd:element name="elementName" type="xsd:string" />
			<xsd:element name="elementSource" type="xsd:string" />
			<xsd:element name="elementFilter" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="elementFilter" type="cat:elementFilterType"/>

	<xsd:complexType name="propertyExclusionType">
		<xsd:sequence>
			<xsd:element name="propertyName" type="xsd:string" />
			<xsd:element name="propertySource" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="propertyExclusion" type="cat:propertyExclusionType"/>


	<!-- Query Targets and Context Queries -->

	<xsd:simpleType name="comparisonType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="EQ"/>
			<xsd:enumeration value="NE"/>
			<xsd:enumeration value="GT"/>
			<xsd:enumeration value="GTE"/>
			<xsd:enumeration value="LT"/>
			<xsd:enumeration value="LTE"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="spatialComparisonType">
		<xsd:restriction base="xsd:string">
		<xsd:enumeration value="EQ"/>
		<xsd:enumeration value="CONTAINS"/>
		<xsd:enumeration value="WITHIN"/>
		<xsd:enumeration value="INTERSECTS"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="textComparisonType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="EXACT"/>
			<xsd:enumeration value="STARTSWITH"/>
			<xsd:enumeration value="CONTAINS"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:complexType name="queryXyPointType">
		<xsd:sequence>
			<xsd:element name="xPos" type="xsd:decimal" />
			<xsd:element name="yPos" type="xsd:decimal" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="queryTextElementType">
		<xsd:sequence>
			<xsd:element name="value" type="xsd:string" />
			<xsd:element name="compare" type="cat:textComparisonType"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryTextElement" type="cat:queryTextElementType"/>

	<xsd:complexType name="queryValueElementType">
		<xsd:annotation>
			<xsd:documentation>
				The value type can be used to query for any metadata element
				that is numeric(int or float) , date, time, or datetime.
				The range parameters are strings and are converted in the
				server to the appropriate data type based on the definition for
				the specified metadata element.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="value" type="xsd:string" />
			<xsd:element name="comparison" type="cat:comparisonType" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryValueElement" type="cat:queryValueElementType"/>


	<xsd:complexType name="queryRangeElementType">
		<xsd:annotation>
			<xsd:documentation>
				The range type can be used to query for any metadata element
				that is numeric(int or float) , date, time, or datetime.
				The range parameters are strings and are converted in the
				server to the appropriate data type based on the definition for
				the specified metadata element.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="start" type="xsd:string" />
			<xsd:element name="end" type="xsd:string" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryRangeElement" type="cat:queryRangeElementType"/>

	<xsd:complexType name="queryPointElementType">
		<xsd:annotation>
			<xsd:documentation>
				This type is used to provide queries with the ability to check the relationship
				of a spatial metadata element with a single x,y coordinate.  The only valid
				comparisons for a point are whether the spatial element is equal to or contains
				that point.  The spatial comparison type also allows for within and intersects.
				For point comparisons, within is the same as equals and intersects is the same as
				contains.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="xyPoint" type="cat:queryXyPointType" />
			<xsd:element name="spatialComparison" type="cat:spatialComparisonType" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryPointElement" type="cat:queryPointElementType"/>

	<xsd:complexType name="queryPolygonElementType">
		<xsd:annotation>
			<xsd:documentation>
				The polygon spatial type must consist of at least four points, and the 
				first and last point must be the same coordinate.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="xyPoint" type="cat:queryXyPointType" minOccurs="4" maxOccurs="unbounded" />
			<xsd:element name="spatialComparison" type="cat:spatialComparisonType" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryPolygonElement" type="cat:queryPolygonElementType"/>

	<xsd:complexType name="queryElementType">
		<xsd:annotation>
			<xsd:documentation>
				Metadata is stored in the catalog as metadata properties which in turn 
				contain metadata elements. The actual metadata values are stored in 
				the metadata elements. The query element types are not based strictly
				on data types, but also what type of relation the user is looking for.
				For text elements the user is looking for exact matches, contains, or 
				possibly starts with.
				For numeric or date elements the user is either comparing to a single
				value (greater, lesser, equal) or is looking within a range.  All numeric
				date, and time elements can be specified using value or range query
				elements.  The element definition in the catalog knows if the value should
				be an int, float (double), date, time, or datetime element.
				The point and polygon query elements are used to specify spacial queries.
				If no comparison is specified, then checks only for existence of the 
				element, not the value.
				The optional parameterize and description attributes only apply when 
				the query being constructed is saved.  The parameterize atttribute
				allows the user to specify if the value specified as the criteria should be 
				saved in the definition or whether this should be made a parameter the
				user, or another user for public template queries, would need to fill
				in each time.  If true, then this is treated as a parameter in the saved
				definition.
				The description element allows the user to add annotatins as to the purpose
				of the element in the query.  Generally it will probably be obvious as to why
				an element is in a query, but particularly for public queries, this allows 
				annotations as to how the element should be used.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="name" type="xsd:string" />
			<xsd:element name="source" type="xsd:string" />
			<xsd:choice minOccurs="0">
				<xsd:element ref="cat:queryTextElement"/>
				<xsd:element ref="cat:queryValueElement"/>
				<xsd:element ref="cat:queryRangeElement"/>
				<xsd:element ref="cat:queryPointElement"/>
				<xsd:element ref="cat:queryPolygonElement"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="parameterize" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryElement" type="cat:queryElementType"/>

	<xsd:complexType name="queryElementOrSetType">
		<xsd:annotation>
			<xsd:documentation>
				Within a metadata property criteria in a query, a user can specify criteria
				for metadata elements within that property.  This type allows a user to 
				specify that if any of the AND sets or queryElement criteria within this
				OR set match, then that metadata property matches this criteria.
				This is NOT an exclusive OR.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryElementAndSet"/>
				<xsd:element ref="cat:queryElement"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryElementOrSet" type="cat:queryElementOrSetType"/>

	<xsd:complexType name="queryElementAndSetType">
		<xsd:annotation>
			<xsd:documentation>
				Within a metadata property criteria in a query, a user can specify criteria
				for metadata elements within that property.  This type allows a user to 
				specify that if ALL of the OR sets and queryElement criteria within this
				AND set must match for a metadata property to match this criteria.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryElementOrSet"/>
				<xsd:element ref="cat:queryElement"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryElementAndSet" type="cat:queryElementAndSetType"/>

	<xsd:complexType name="queryPropertyType">
		<xsd:annotation>
			<xsd:documentation>
				Metadata is stored in the catalog as metadata properties which in turn 
				contain metadata elements and possibly nested metadata properties 
				know as sub-properties. The actual metadata values are stored in 
				the metadata elements. The metadata properties are used to provide
				structure so complex concepts can be modeled as metadata properties.
				The query criteria for a metadata property can contain zero or more 
				element criteria.  These can be multiple instances of queryElement
				or queryElementOrSet, and there is an implicit AND of these instances.
				The same appraoch is used for queryPropertyOrSet and queryProperty.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="name" type="xsd:string" />
			<xsd:element name="source" type="xsd:string" />
			<xsd:choice minOccurs="0" maxOccurs="unbounded">
				<xsd:element ref="cat:queryElementOrSet"/>
				<xsd:element ref="cat:queryElement"/>
			</xsd:choice>
			<xsd:choice minOccurs="0" maxOccurs="unbounded">
				<xsd:element ref="cat:queryPropertyOrSet"/>
				<xsd:element ref="cat:queryProperty"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryProperty" type="cat:queryPropertyType"/>

	<xsd:complexType name="queryPropertyOrSetType">
		<xsd:annotation>
			<xsd:documentation>
				This type can be included in an object or as a sub-property of another property.
				The OR type can contain any number of queryProperty or a queryPropertyAndSet 
				of properties.  In a query, if any of the properties or AND sets match for an object,
				then this OR set will be considered a match.  It is NOT an exclusive OR.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryPropertyAndSet"/>
				<xsd:element ref="cat:queryProperty"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryPropertyOrSet" type="cat:queryPropertyOrSetType"/>

	<xsd:complexType name="queryPropertyAndSetType">
		<xsd:annotation>
			<xsd:documentation>
				This type can be included in an object or as a sub-property of another property.
				The AND type can contain any number of queryProperty or a queryPropertyOrSet 
				of properties.  In a query, ALL of the properties and OR sets must match for an 
				object to be considered a match for this AND set.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryPropertyOrSet"/>
				<xsd:element ref="cat:queryProperty"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryPropertyAndSet" type="cat:queryPropertyAndSetType"/>

	<xsd:complexType name="queryObjectType">
		<xsd:annotation>
			<xsd:documentation>
				Each catalog query has a particular target - such as a file or collection 
				that a user is searching for. The target may also need to contained 
				in and/or contain a hierarchy of collections or files.
				The target may also have specific properties, or possibly just a type
				The queryObjectType is used both for targets and is extended for
				objects used to define the context of the target in a query.
				There is an implicit AND of the queryProperty and queryPropertyOrSet
				included in an object.
				The optional description attribute is only applicable when a query definition
				is being saved - see discussion in queryElementType.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="aggrType" type="cat:catalogAggregationType" />
			<xsd:element name="objectId" type="xsd:string" minOccurs="0" />
			<xsd:element name="createDateStart" type="xsd:dateTime" minOccurs="0" />
			<xsd:element name="createDateEnd" type="xsd:dateTime" minOccurs="0" />
			<xsd:choice minOccurs="0" maxOccurs="unbounded">
				<xsd:element ref="cat:queryPropertyOrSet"/>
				<xsd:element ref="cat:queryProperty"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
		<xsd:attribute name="description" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryTarget" type="cat:queryObjectType"/>

	<xsd:complexType name="queryComponentType">
		<xsd:annotation>
			<xsd:documentation>
				Queries consist of a target and optionally a context for the query
				The context consists of other objects (collections and files) that
				the target either contains or is contained within.  The objects 
				used to specify the query context are similar to the target, but
				also need to specify relationships (parent or child) and contain 
				additional hierarchy.  This type is used for the objects in the 
				query context and it extends the type used for the target.
				The queryOrSet and context instances are an implicit 
				AND.  If the context should be an OR, then the context should start
				with a single queryOrSet.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexContent>
			<xsd:extension base="cat:queryObjectType">
				<xsd:sequence>
					<xsd:element name="relation" type="cat:contextType"/>
					<xsd:choice minOccurs="0" maxOccurs="unbounded">
						<xsd:element ref="cat:queryOrSet"/>
						<xsd:element ref="cat:queryComponent"/>
					</xsd:choice>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>

	<xsd:element name="queryComponent" type="cat:queryComponentType"/>


	<!-- ********************************************** -->
	<!--              Context Query Types               -->
	<!-- ********************************************** -->
	<xsd:simpleType name="contextType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="PARENT"/>
			<xsd:enumeration value="DIRECT_PARENT"/>
			<xsd:enumeration value="CHILD"/>
			<xsd:enumeration value="DIRECT_CHILD"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:complexType name="queryOrSetType">
		<xsd:annotation>
			<xsd:documentation>
				This set is a disjunctive "OR" of two or more components
				or nested AND types.
				A disjunctive (OR) set cannot be nested here.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryAndSet" />
				<xsd:element ref="cat:queryComponent"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryOrSet" type="cat:queryOrSetType"/>

	<xsd:complexType name="queryAndSetType">
		<xsd:annotation>
			<xsd:documentation>
				This set is a conjunctive "AND" of two or more components
				or nested OR types.
				A conjunctive (AND) set cannot be nested here.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryOrSet"/>
				<xsd:element ref="cat:queryComponent"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="queryAndSet" type="cat:queryAndSetType"/>

	<xsd:complexType name="contextQueryType">
		<xsd:annotation>
			<xsd:documentation>
				The context query determines the context of the target
				and starts with one or more queryOrSets and/or 
				queryComponents.  Each component specifies its
				relationship to the target.  
				There is an implicit AND of the sets and components 
				in the context.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="cat:queryOrSet"/>
				<xsd:element ref="cat:queryComponent"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="negate" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="contextQuery" type="cat:contextQueryType"/>


	<!-- Query Result Format -->

	<xsd:simpleType name="catalogDeliveryType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="NONE"/>
			<xsd:enumeration value="DIRECT"/>
			<xsd:enumeration value="STREAMING"/>
		</xsd:restriction>
	</xsd:simpleType>


	<xsd:complexType name="queryResultFormatType">
		<xsd:annotation>
			<xsd:documentation>
				The result format specifies filters used to format the content
				of the query result as well as the delivery method.
				The hierarchy filters determine what objects in addition to the
				objects matching the target should be returned.  For example, if
				the query targets collections containing certain files as the context,
				they may want the result to be those collections and their parent 
				experiment.
				The content filters determine the extent of the metadata returned for 
				each object in the result.
				the property exclusion allows the user to filter out certain 
				properties to be excluded from the result.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="offset" type="xsd:int"/>
			<xsd:element name="count" type="xsd:int"/>
			<xsd:choice>
				<xsd:element ref="cat:hierarchyFilter" />
				<xsd:element ref="cat:hierarchyFilterSet" />
			</xsd:choice>
			<xsd:choice>
				<xsd:element ref="cat:contentFilter"/>
				<xsd:element ref="cat:propertyFilter" maxOccurs="unbounded"/>
				<xsd:element ref="cat:elementFilter" maxOccurs="unbounded"/>
			</xsd:choice>
			<xsd:element ref="cat:propertyExclusion" maxOccurs="unbounded" minOccurs="0"/>
                        <xsd:element name="showHasChildren" type="xsd:boolean" minOccurs="0"/>
			<xsd:element name="resultDeliveryMethod" type="cat:catalogDeliveryType"/>
			<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryResultFormat" type="cat:queryResultFormatType"/>



	<!-- QUERY RESPONSE -->
	<xsd:element name="objectSetResponse">
		<xsd:annotation>
			<xsd:documentation>
				The object set type is used to return a set of instances of 
				schema-valid instances as defined by the members of the 
				catalog object group.  The objects must indicate their
				relationships within the object instances themselves if the
				parent - child relationships are relevant.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence maxOccurs="unbounded">
				<xsd:group ref="cat:catalogObjectGroup"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<xsd:complexType name="guidResponseType">
		<xsd:sequence>
			<xsd:element ref="cat:guidResponse" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="objectClass" type="cat:catalogAggregationType" use="required"/>
		<xsd:attribute name="objectId" type="xsd:string" use="required"/>
                <xsd:attribute name="hasChildren" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="guidResponse" type="cat:guidResponseType"/>


	<xsd:complexType name="objectResponseType">
		<xsd:sequence>
			<xsd:group ref="cat:catalogObjectGroup"/>
			<xsd:element ref="cat:objectResponse" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="objectClass" type="cat:catalogAggregationType" use="required"/>
		<xsd:attribute name="objectId" type="xsd:string" use="required"/>
		<xsd:attribute name="hasChildren" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="objectResponse" type="cat:objectResponseType"/>


	<xsd:complexType name="propertyResponseType">
		<xsd:sequence>
			<xsd:group ref="cat:propertyFilterGroup"/>
			<xsd:element ref="cat:propertyResponse" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="objectClass" type="cat:catalogAggregationType" use="required"/>
		<xsd:attribute name="objectId" type="xsd:string" use="required"/>
		<xsd:attribute name="hasChildren" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="propertyResponse" type="cat:propertyResponseType"/>


	<xsd:element name="metadataElement">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					All of the query response object types based on one or 
					more element filters use this type.  This is a name/value
					pair with the value as a simple type and the name as an 
					XML attribute.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:simpleContent>
				<xsd:extension base="xsd:string">
					<xsd:attribute name="name" type="xsd:string" use="required"/>
				</xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="elementResponseType">
		<xsd:annotation>
			<xsd:documentation>
				Each object included in a query response based on element filters is encapsulated
				in an instance of this type.  The globally unique ID of the object is a required
				attribute for response elements of this type. Each element included in the filter
				is an instance of the metadataElement.  If this object has any child objects
				(e.g., an experiment containing files) then those children can be nested as 
				instance of the elementResponse element.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element ref="cat:metadataElement" maxOccurs="unbounded"/>
			<xsd:element ref="cat:elementResponse" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="objectClass" type="cat:catalogAggregationType" use="required"/>
		<xsd:attribute name="objectId" type="xsd:string" use="required"/>
		<xsd:attribute name="hasChildren" type="xsd:boolean" default="false" use="optional"/>
	</xsd:complexType>

	<xsd:element name="elementResponse" type="cat:elementResponseType"/>


	<xsd:complexType name="queryResponseSetType">
		<xsd:annotation>
			<xsd:documentation>
				A query response can be empty, so the minOccurs
				for all response types is set to zero.
				Although not enforced by the schema, all objects 
				in a response will use the same hierarchy filter, 
				so if the SUBTREE filter is specified in the query, 
				then the full subtree will be included for all 
				objects in the query response.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice>
				<xsd:element ref="cat:objectSetResponse" minOccurs="0"/>
				<xsd:element ref="cat:guidResponse" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="cat:objectResponse" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="cat:propertyResponse" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="cat:elementResponse" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:choice>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryResponseSet" type="cat:queryResponseSetType" nillable="true"/>

	<xsd:complexType name="queryResponseType">
		<xsd:annotation>
			<xsd:documentation>
				Each of the query methods can return either directly in the response or indirectly
				by returning a URL which can then be accessed as a stream.  The choice between
				these two options is contained in this element.
				The context query, query by ID, and workspace query all use the query response element.
				If the results are passed back as a stream, the contents at the URL is the queryResponseSet
				that would have been passed if the direct method had been used.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element ref="cat:catalogOperationStatus"/>
			<xsd:choice>
				<xsd:element name="resultStreamUrl" type="xsd:anyURI" nillable="true"/>
				<xsd:element ref="cat:queryResponseSet"/>
			</xsd:choice>
		</xsd:sequence>
		<xsd:attribute name="timestamp" type="xsd:long" use="required"/>
	</xsd:complexType>

	<xsd:element name="queryResponse" type="cat:queryResponseType"/>


	<!-- Context Query -->
	<xsd:element name="contextQueryRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:queryTarget"/>
				<xsd:element ref="cat:contextQuery" minOccurs="0"/>
				<xsd:element ref="cat:queryResultFormat"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- Query By Id Operation -->
	<xsd:element name="objectIdQueryRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="objectId" type="xsd:string" maxOccurs="unbounded"/>
				<xsd:element ref="cat:queryResultFormat"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- Query All Workspace Operation -->
	<xsd:element name="allWorkspaceQueryRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:queryResultFormat" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ************************************ -->
	<!-- Query Property Definitions Operation -->
	<!-- ************************************ -->
	<xsd:element name="queryPropertyDefinitionsRequest">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="resultDeliveryMethod" type="cat:catalogDeliveryType"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="metadataElementDefType">
		<xsd:sequence>
			<xsd:element name="elementId" type="xsd:int"/>
			<xsd:element name="elementName" type="xsd:string"/>
			<xsd:element name="elementSource" type="xsd:string"/>
			<xsd:element name="elementDesc" type="xsd:string"/>
			<xsd:element name="elementShortDesc" type="xsd:string"/>
			<xsd:element name="elementType" type="xsd:int"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="metadataPropertyDefType">
		<xsd:sequence>
			<xsd:element name="propertyId" type="xsd:int"/>
			<xsd:element name="propertyName" type="xsd:string"/>
			<xsd:element name="propertySource" type="xsd:string"/>
			<xsd:element name="propertyDesc" type="xsd:string"/>
			<xsd:element name="propertyShortDesc" type="xsd:string"/>
			<xsd:element name="metadataElementDef" type="cat:metadataElementDefType" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element ref="cat:metadataPropertyDef" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="metadataPropertyDef" type="cat:metadataPropertyDefType"/>

	<xsd:complexType name="metadataCategoryDefType">
		<xsd:sequence>
			<xsd:element name="categoryId" type="xsd:int"/>
			<xsd:element name="categoryName" type="xsd:string"/>
			<xsd:element ref="cat:metadataPropertyDef" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="metadataDefinitionType">
		<xsd:annotation>
			<xsd:documentation>
				The metadata stored in the catalog is divided into broad categories, and then 
				metadata properties are defined for each category.  The metadata properties all
				have a name and source of the definition (defines what the name means).  Each
				metadata property also has a human readable description and short description.
				Metadata elements are then defined within each property and the values are
				stored as elements in the catalog.  A category can have multiple properties 
				and a property can contain multiple metadata elements.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="metadataCategoryDef" type="cat:metadataCategoryDefType" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="metadataDefinition" type="cat:metadataDefinitionType" nillable="true"/>


	<xsd:element name="queryPropertyDefinitionsResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:choice>
					<xsd:element ref="cat:metadataDefinition" />
					<xsd:element name="resultStreamUrl" type="xsd:anyURI" nillable="true"/>
				</xsd:choice>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<!-- ************************************ -->
	<!-- Get All Query Descriptions Operation -->
	<!-- ************************************ -->
	<xsd:element name="getAllQueryDescriptionsRequest">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This operation is used to get the global ID and description
					of every public template query and every query defined by
					the user making the request.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element name="resultDeliveryMethod" type="cat:catalogDeliveryType"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="queryDescriptionType">
		<xsd:sequence>
			<xsd:element name="queryId" type="xsd:string" nillable="false"/>
			<xsd:element name="name" type="xsd:string" nillable="false"/>
			<xsd:element name="description" type="xsd:string" nillable="false"/>
		</xsd:sequence>
	</xsd:complexType>


	<xsd:complexType name="queryDescriptionSetType">
		<xsd:sequence>
			<xsd:element name="templateQuery" type="cat:queryDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element name="privateQuery" type="cat:queryDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryDescriptionSet" type="cat:queryDescriptionSetType"/>


	<xsd:element name="getAllQueryDescriptionsResponse">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This response provides the global ID and description of every
					public template query definition (which is available to any user)
					and those query definitions previouly saved by the user who made 
					the request.  The public and private query definitions are returned
					as separate elements.  If there are no public templates and the user
					has not saved any query definitions, the queryDescriptionSet or 
					resultStreamUrl will be excluded.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:choice minOccurs="0">
					<xsd:element ref="cat:queryDescriptionSet" />
					<xsd:element name="resultStreamUrl" type="xsd:anyURI" nillable="true"/>
				</xsd:choice>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<!-- ****************************** -->
	<!-- Get Query Definition Operation -->
	<!-- ****************************** -->
	<xsd:element name="getQueryDefinitionRequest">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This method is called to get the definition for a specific 
					existing query that is either a public template query
					available to all users, or a query definition owned by
					the user making the request.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element name="queryId" type="xsd:string" nillable="false"/>
				<xsd:element name="resultDeliveryMethod" type="cat:catalogDeliveryType"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="queryDefinitionType">
		<xsd:sequence>
			<xsd:element ref="cat:queryTarget"/>
			<xsd:element ref="cat:contextQuery" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="queryDefinition" type="cat:queryDefinitionType"/>

	<xsd:element name="getQueryDefinitionResponse">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This response returns the target and context component of 
					the query specified in the request.  Since queries are not
					required to have a context, the context component is 
					optional.
					If the query ID specified in the request is not valid or
					not available to the user making the request, this will
					be reflected in the status and the choice for the queryDefinition 
					element or the resultStreamUrl will be excluded.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
				<xsd:choice minOccurs="0">
					<xsd:element ref="cat:queryDefinition" />
					<xsd:element name="resultStreamUrl" type="xsd:anyURI" nillable="true"/>
				</xsd:choice>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<!-- ****************************************** -->
	<!-- Save and Delete Query Definition Operation -->
	<!-- ****************************************** -->
	<xsd:element name="saveQueryDefinitionRequest">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This method can be called with a query definition to be saved
					in the metadata catalog so it can be reused. The public attribute
					allows the user to specify if the query definition should be saved 
					as a public query template available to other users.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element name="title" type="xsd:string" nillable="false"/>
				<xsd:element name="description" type="xsd:string" nillable="false"/>
                                <xsd:element name="queryId" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="cat:queryDefinition"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
			<xsd:attribute name="public" type="xsd:boolean" default="false" use="optional"/>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="saveQueryDefinitionResponse">
		<xsd:complexType>
			<xsd:sequence>
                                <xsd:element name="queryId" type="xsd:string" nillable="true"/>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


	<xsd:element name="deleteQueryDefinitionRequest">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					This method can be called to delete a saved query definition
					that is private to the user making the request.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:sequence>
				<xsd:element name="queryId" type="xsd:string" nillable="false"/>
				<xsd:element name="errorDeliveryMethod" type="cat:catalogDeliveryType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="deleteQueryDefinitionResponse">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="cat:catalogOperationStatus"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>


</xsd:schema>