<?xml version = "1.0" encoding = "UTF-8"?>
<!--
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #
    # Copyright (C) 2003-2011 Open Microscopy Environment
    #       Massachusetts Institute of Technology,
    #       National Institutes of Health,
    #       University of Dundee,
    #       University of Wisconsin at Madison
    #
    # This work is licensed under the
    #       Creative Commons Attribution 3.0 Unported License.
    # To view a copy of this license, visit
    #       http://creativecommons.org/licenses/by/3.0/
    # or send a letter to
    #       Creative Commons, 444 Castro Street, Suite 900,
    #       Mountain View, California, 94041, USA.
    # For attribution instructions, visit
    #       http://www.openmicroscopy.org/info/attribution
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Written by: Ilya G. Goldberg, Josiah Johnston, Andrew J Patterson 
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
	targetNamespace = "http://www.openmicroscopy.org/Schemas/STD/2008-09"
	xmlns:STD = "http://www.openmicroscopy.org/Schemas/STD/2008-09"
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	version = "1"
	elementFormDefault = "qualified">
	<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
	<xsd:element name = "Element"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Describes a field of a SemanticType</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "STD:Label" minOccurs = "0" maxOccurs = "unbounded"/>
				<xsd:element ref = "STD:Description" minOccurs = "0" maxOccurs = "unbounded"/>
			</xsd:sequence>
			<xsd:attribute name = "Name" use = "required">
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:maxLength value = "64"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name = "DBLocation" use = "optional" type = "xsd:string"/>
			<xsd:attribute name = "DataType" use = "required">
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:enumeration value = "bigint"/>
						<xsd:enumeration value = "integer"/>
						<xsd:enumeration value = "smallint"/>
						<xsd:enumeration value = "double"/>
						<xsd:enumeration value = "float"/>
						<xsd:enumeration value = "boolean"/>
						<xsd:enumeration value = "string"/>
						<xsd:enumeration value = "reference"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name = "RefersTo" use="optional" type = "xsd:string"/>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "SemanticType"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>
				Defines a semantic type.
				Notes:
				Granularity of SemanticType is infered from the granularity of the record it derives from. In a record, this granularity is specified by the AppliesTo attribute.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "STD:Label" minOccurs = "0" maxOccurs = "unbounded"/>
				<xsd:element ref = "STD:Description" minOccurs = "0" maxOccurs = "unbounded"/>
				<xsd:element ref = "STD:Element" maxOccurs = "unbounded"/>
			</xsd:sequence>
			<xsd:attribute name = "Name" use = "required">
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:maxLength value = "64"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name = "Parent" use = "optional">
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:maxLength value = "64"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name = "AppliesTo" use = "required">
				<xsd:annotation>
					<xsd:documentation>This specifies what this record is an attribute of. The options are Global, Dataset, Image, or Region (was called Feature hence letter F).
					</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:enumeration value = "G"/>
						<xsd:enumeration value = "D"/>
						<xsd:enumeration value = "I"/>
						<xsd:enumeration value = "F"/>
						<xsd:length value = "1"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
		<xsd:unique name = "SemanticElement">
			<xsd:selector xpath = "STD:SemanticElement"/>
			<xsd:field xpath = "@Name"/>
		</xsd:unique>
	</xsd:element>
	<xsd:element name = "SemanticTypeDefinitions"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Describes semantic types that can be derived from custom attributes. </xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "STD:SemanticType" minOccurs="1" maxOccurs = "unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
		<xsd:unique name = "SemanticTypeName">
			<xsd:selector xpath = "STD:SemanticType"/>
			<xsd:field xpath = "@SemanticTypeName"/>
		</xsd:unique>
	</xsd:element>
	<xsd:attribute name = "SemanticTypeName"> <!-- top level definition -->
		<xsd:simpleType>
			<xsd:restriction base = "xsd:string">
				<xsd:maxLength value = "64"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:attribute>
	<xsd:element name = "Description"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>
				Just some human-readable text to serve as documentation.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:simpleContent>
				<xsd:extension base = "xsd:string">
					<xsd:attribute ref = "xml:lang" default = "en" use="optional"/>
				</xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "Label"> <!-- top level definition -->
		<xsd:complexType>
			<xsd:simpleContent>
				<xsd:extension base = "xsd:string">
					<xsd:attribute ref = "xml:lang" default = "en" use="optional"/>
				</xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>
