<?xml version = "1.0" encoding = "UTF-8"?>
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	#
	# Copyright (C) 2003-2008 Open Microscopy Environment
	#       Massachusetts Institute of Technology,
	#       National Institutes of Health,
	#       University of Dundee,
	#       University of Wisconsin at Madison
	#
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Written by: Ilya G. Goldberg, Josiah Johnston, Andrew J Patterson 
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
	targetNamespace = "http://www.openmicroscopy.org/Schemas/STD/2008-02"
	xmlns:STD = "http://www.openmicroscopy.org/Schemas/STD/2008-02"
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	version = "1"
	elementFormDefault = "qualified">
	<import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
	<element name = "Element">
		<annotation>
			<documentation>Describes a field of a SemanticType</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "STD:Label" minOccurs = "0" maxOccurs = "unbounded"/>
				<element ref = "STD:Description" minOccurs = "0" maxOccurs = "unbounded"/>
			</sequence>
			<attribute name = "Name" use = "required">
				<simpleType>
					<restriction base = "string">
						<maxLength value = "64"/>
					</restriction>
				</simpleType>
			</attribute>
			<attribute name = "DBLocation" use = "optional" type = "string"/>
			<attribute name = "DataType" use = "required">
				<simpleType>
					<restriction base = "string">
						<enumeration value = "bigint"/>
						<enumeration value = "integer"/>
						<enumeration value = "smallint"/>
						<enumeration value = "double"/>
						<enumeration value = "float"/>
						<enumeration value = "boolean"/>
						<enumeration value = "string"/>
						<enumeration value = "reference"/>
					</restriction>
				</simpleType>
			</attribute>
			<attribute name = "RefersTo" type = "string"/>
		</complexType>
	</element>
	<element name = "SemanticType">
		<annotation>
			<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.
			</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "STD:Label" minOccurs = "0" maxOccurs = "unbounded"/>
				<element ref = "STD:Description" minOccurs = "0" maxOccurs = "unbounded"/>
				<element ref = "STD:Element" maxOccurs = "unbounded"/>
			</sequence>
			<attribute name = "Name" use = "required">
				<simpleType>
					<restriction base = "string">
						<maxLength value = "64"/>
					</restriction>
				</simpleType>
			</attribute>
			<attribute name = "Parent" use = "optional">
				<simpleType>
					<restriction base = "string">
						<maxLength value = "64"/>
					</restriction>
				</simpleType>
			</attribute>
			<attribute name = "AppliesTo" use = "required">
				<annotation>
					<documentation>This specifies what this record is an attribute of. The options are Global, Dataset, Image, or Region.
					</documentation>
				</annotation>
				<simpleType>
					<restriction base = "string">
						<enumeration value = "G"/>
						<enumeration value = "D"/>
						<enumeration value = "I"/>
						<enumeration value = "F"/>
						<length value = "1"/>
					</restriction>
				</simpleType>
			</attribute>
		</complexType>
		<unique name = "SemanticElement">
			<selector xpath = "STD:SemanticElement"/>
			<field xpath = "@Name"/>
		</unique>
	</element>
	<element name = "SemanticTypeDefinitions">
		<annotation>
			<documentation>Describes semantic types that can be derived from custom attributes. </documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "STD:SemanticType" maxOccurs = "unbounded"/>
			</sequence>
		</complexType>
		<unique name = "SemanticTypeName">
			<selector xpath = "STD:SemanticType"/>
			<field xpath = "@SemanticTypeName"/>
		</unique>
	</element>
	<attribute name = "SemanticTypeName">
		<simpleType>
			<restriction base = "string">
				<maxLength value = "64"/>
			</restriction>
		</simpleType>
	</attribute>
	<element name = "Description">
		<annotation>
			<documentation>
				Just some human-readable text to serve as documentation.
			</documentation>
		</annotation>
		<complexType>
			<simpleContent>
				<extension base = "string">
					<attribute ref = "xml:lang" default = "en"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
	<element name = "Label">
		<complexType>
			<simpleContent>
				<extension base = "string">
					<attribute ref = "xml:lang" default = "en"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
</schema>