<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:swe="http://www.opengis.net/swe/1.0" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:om="http://www.opengis.net/om/0.0" xmlns:sa="http://www.opengis.net/sampling/0.0" xmlns:gml="http://www.opengis.net/gml" xmlns:adx="http://www.seegrid.csiro.au/xml/adx/3" targetNamespace="http://www.seegrid.csiro.au/xml/adx/3" elementFormDefault="qualified" attributeFormDefault="unqualified" version="3.0">
	<!-- ==================================================== -->
	<annotation>
		<documentation>Description of assay 'specimens' and the processing chain which leads to them. For now, keeping as close as possible to the original adxSpecimen. 
    
2006-03-09

Copyright (c) 2006 CSIRO - see https://www.seegrid.csiro.au/twiki/bin/view/Xmml/LegalNotices#Software_Notice</documentation>
	</annotation>
	<!-- ==================================================== -->
	<!-- ==================================================== -->
	<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
	<import namespace="http://www.opengis.net/swe/1.0" schemaLocation="../../sweCommon/trunk/swe.xsd"/>
	<import namespace="http://www.seegrid.csiro.au/xml/sampling" schemaLocation="http://www.seegrid.csiro.au/xsd/sampling/0.1.0/sampling.xsd"/>
	<import namespace="http://www.opengis.net/om/0.0" schemaLocation="../../om/trunk/om.xsd"/>
	<import namespace="http://www.isotc211.org/2005/gmd" schemaLocation="../../../../gml/trunk/gml/3.1.1/gmd/gmd.xsd"/>
	<!-- ==================================================== -->
	<include schemaLocation="./adxBase.xsd"/>
	<!-- ==================================================== -->
	<!-- ==================================================== -->
	<group name="ProtoEventOptionalProperties">
		<sequence>
			<element name="time" type="om:TimeObjectPropertyType" minOccurs="0">
				<annotation>
					<documentation>Matches the om:time in om:ProcedureEventType</documentation>
				</annotation>
			</element>
			<element name="responsible" type="gmd:CI_ResponsibleParty_PropertyType" minOccurs="0">
				<annotation>
					<documentation>matches the om:responsible in om:EventType
							
							Person or organisation responsible for the event, if applicable. 
					The nature of the responsibility (i.e. the role of the party with respect to the event) may be indicated using the xlink:arcrole attribute. 
					Examples of roles are operator, sponsor, requestor, provider, processor, etc.</documentation>
				</annotation>
			</element>
			<element name="measureParameter" type="swe:TypedMeasureType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Stands in for om:measureParameter in Events. For standardised chains, put the params in the ProtoEvent instances. When params vary, override with measureParameter properties added to the ProtoParam instances inside the ProcessingHistory.</documentation>
				</annotation>
			</element>
		</sequence>
	</group>
	<complexType name="ProtoEventType" abstract="true">
		<annotation>
			<documentation>Description of event in the prototypical histories. 
			Can be directly converted into an Event of some kind, with additional data from a ProtoParams subtype.</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:DefinitionType">
				<group ref="adx:ProtoEventOptionalProperties"/>
			</extension>
		</complexContent>
	</complexType>
	<!-- ......................... -->
	<element name="ProtoEvent" type="adx:ProtoEventType" substitutionGroup="gml:Definition"/>
	<!-- ......................... -->
	<complexType name="ProtoEventPropertyType">
		<sequence minOccurs="0">
			<element ref="adx:ProtoEvent"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<!-- ==================================================== -->
	<!-- ==================================================== -->
	<complexType name="ProtoHistoryType">
		<annotation>
			<documentation>sequence of ProtoEvents. Their sequence here is used as an ordinal sequence indexed by ProtoParams so it can be easily mapped by some post-processing XSLT etc.
			</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:DefinitionType">
				<sequence>
					<choice maxOccurs="unbounded">
						<element name="protoEvent" type="adx:ProtoEventPropertyType" minOccurs="0" maxOccurs="unbounded"/>
						<element name="event" type="om:EventPropertyType" minOccurs="0" maxOccurs="unbounded"/>
					</choice>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<!-- ......................... -->
	<element name="ProtoHistory" type="adx:ProtoHistoryType" substitutionGroup="gml:Definition"/>
	<!-- ...................... -->
	<complexType name="ProtoHistoryPropertyType">
		<sequence minOccurs="0">
			<element ref="adx:ProtoHistory"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<!-- ==================================================== -->
	<!-- ==================================================== -->
	<complexType name="ProtoParamType" abstract="true">
		<annotation>
			<documentation>Adds parameters to a ProtoEvent. Create subclasses for each subclass of ProtoEvent that needs values.</documentation>
		</annotation>
		<sequence>
			<element name="fills" type="gml:ReferenceType">
				<annotation>
					<documentation>link to matching ProtoEvent</documentation>
				</annotation>
			</element>
			<group ref="adx:ProtoEventOptionalProperties"/>
		</sequence>
		<attribute ref="gml:id" use="optional"/>
	</complexType>
	<!-- ......................... -->
	<element name="ProtoParam" type="adx:ProtoParamType"/>
	<!-- ...................... -->
	<complexType name="ProtoParamPropertyType">
		<sequence minOccurs="0" maxOccurs="unbounded">
			<element ref="adx:ProtoParam"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<!-- ==================================================== -->
	<!-- ==================================================== -->
	<complexType name="ProcessingHistoryType">
		<annotation>
			<documentation>Description of assay specimen, including chain-of-custody if required.</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:AbstractFeatureType">
				<sequence>
					<element name="preservative" type="string" minOccurs="0">
						<annotation>
							<documentation>This preservative code is required to indicate the exact preservative used to maintain stability of the specimen.</documentation>
						</annotation>
					</element>
					<element name="matrix" type="string" minOccurs="0">
						<annotation>
							<documentation>The specimen matrix information is required to provide the USA EPA with environmental reference material from compliant laboratories</documentation>
						</annotation>
					</element>
					<element name="media" type="string" minOccurs="0">
						<annotation>
							<documentation>The specimen media information is required to provide the USA EPA with environmental reference material from compliant laboratories</documentation>
						</annotation>
					</element>
					<element name="status" type="adx:specimenStatusCode">
						<annotation>
							<documentation>The current status of the specimen.  
          If the custody chain is complete, then this will reflect the outcome of the most recent custody operation.</documentation>
						</annotation>
					</element>
					<element name="comment" type="string" minOccurs="0"/>
					<element name="protoEvents" type="adx:ProtoHistoryPropertyType"/>
					<element name="param" type="adx:ProtoParamPropertyType" minOccurs="0" maxOccurs="unbounded">
						<!--	<complexType>
							<annotation>
								<documentation>Added values that are applied, if need to add data to our ProtoHistory</documentation>
							</annotation>
							<sequence>
								<element ref="adx:ProtoParam" minOccurs="0" maxOccurs="unbounded"/>
							</sequence>
						</complexType>
-->
					</element>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<!-- ......................... -->
	<element name="ProcessingHistory" type="adx:ProcessingHistoryType" substitutionGroup="gml:_Feature"/>
	<!-- ...................... -->
	<complexType name="ProcessingHistoryPropertyType">
		<sequence minOccurs="0">
			<element ref="adx:ProcessingHistory"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<!-- ==================================================== -->
	<!-- ================================================================== -->
	<simpleType name="specimenStatusCode">
		<annotation>
			<documentation>Current status of specimen</documentation>
		</annotation>
		<union>
			<simpleType>
				<restriction base="string">
					<enumeration value="EMT">
						<annotation>
							<documentation>Empty container – no specimen</documentation>
						</annotation>
					</enumeration>
					<enumeration value="ISF">
						<annotation>
							<documentation>Insufficient specimen provided</documentation>
						</annotation>
					</enumeration>
					<enumeration value="SNF">
						<annotation>
							<documentation>Specimen not found - Missing or Lost</documentation>
						</annotation>
					</enumeration>
					<enumeration value="SNR">
						<annotation>
							<documentation>Specimen Not Received</documentation>
						</annotation>
					</enumeration>
					<enumeration value="DSA">
						<annotation>
							<documentation>Specimen destroyed in Analysis</documentation>
						</annotation>
					</enumeration>
					<enumeration value="DSP">
						<annotation>
							<documentation>Specimen destroyed in preparation</documentation>
						</annotation>
					</enumeration>
					<enumeration value="Returned">
						<annotation>
							<documentation>Specimen returned to requestor</documentation>
						</annotation>
					</enumeration>
					<enumeration value="Stored">
						<annotation>
							<documentation>Specimen stored by provider</documentation>
						</annotation>
					</enumeration>
					<enumeration value="Unknown">
						<annotation>
							<documentation>Current status unknown</documentation>
						</annotation>
					</enumeration>
				</restriction>
			</simpleType>
			<simpleType>
				<annotation>
					<documentation>As specified by provider</documentation>
				</annotation>
				<restriction base="adx:other"/>
			</simpleType>
		</union>
	</simpleType>
	<!-- ================================================================== -->
	<!-- ==================================================== -->
</schema>

