<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Markus Doering (BGBM) -->
<!-- edited with XML Spy v4.2 U (http://www.xmlspy.com) by Markus Doering (BGBM, FU-Berlin) -->
<!-- A schema to create configuration files for database providers to link their arbitrary database to the generic unit-wrapper of BioCASE -->
<!-- Authors: M.Doering, A.Guentsch, A.Hahn -->
<!-- Botanic Museum and Botanical Garden Berlin-Dahlem -->
<xs:schema targetNamespace="http://www.biocase.org/schemas/conceptmapping/1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.biocase.org/schemas/conceptmapping/1.4" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="conceptMapping">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="schemaNamespace" type="urlType">
					<xs:annotation>
						<xs:documentation>the Namespace of the described/configured Schema. Should include the version of the schema eg http://www.bgbm.org/tdwg/abcd/1.2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="rootTableAlias" type="xs:string">
					<xs:annotation>
						<xs:documentation>The table-alias in your DB as given in the ProviderConfig preferences that acts as a "root" table for all records. This table needs to have one unique identifier (primary key). Important to build dynamic SQL and count records.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="staticTableAlias" minOccurs="0" maxOccurs="unbounded">
					<xs:annotation>
						<xs:documentation>A table-alias that is always included in the output via a FULL OUTER JOIN. Dont enter more than 1 record, as this will blow up your resulting XML.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string"/>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
				<xs:element name="recordIdentifier" type="pathType" maxOccurs="unbounded">
					<xs:annotation>
						<xs:documentation>The xpath to an element used as the Identifier for the basic record of the concept. E.g Units for ABCD, or maybe names for other concepts. Important for the count method. Maybe several xpaths for schemas without a single root records element.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="dataElement" type="elementType">
					<xs:annotation>
						<xs:documentation>An element (inherits attribute properties)</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="attributeType">
		<xs:sequence>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="w3cType" type="xs:string" minOccurs="0"/>
			<xs:element name="vocabulary" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="term" maxOccurs="unbounded">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="schemaTerm" type="xs:string"/>
									<xs:element name="dbTerm" type="xs:string" minOccurs="0"/>
								</xs:sequence>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="repMin" type="xs:integer"/>
			<xs:element name="annot" type="xs:string" minOccurs="0"/>
			<xs:element name="dbAttribute" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Set this element for every attribute in your database that should be mapped to an XML element. The type of the attribute in the DB must be given if it differs from "string". If you dont want to allow searches on this attribute (or your DB cannot search on it as with MEMO fields in Access), set the flag "dbNoSearch" to 1 or TRUE.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="dbTable" type="xs:string" use="required"/>
							<xs:attribute name="dbType" use="optional" default="string">
								<xs:simpleType>
									<xs:restriction base="xs:token">
										<xs:enumeration value="int"/>
										<xs:enumeration value="float"/>
										<xs:enumeration value="date"/>
										<xs:enumeration value="string"/>
										<xs:enumeration value="unicode"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
							<xs:attribute name="dbNoSearch" type="xs:boolean" use="optional"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="path" type="xs:string" use="required"/>
	</xs:complexType>
	<xs:complexType name="elementType">
		<xs:complexContent>
			<xs:extension base="attributeType">
				<xs:sequence>
					<xs:element name="repMax" type="xs:string"/>
					<xs:element name="choiceNodeId" type="xs:integer" minOccurs="0"/>
					<xs:element name="choiceElemId" minOccurs="0">
						<xs:complexType>
							<xs:simpleContent>
								<xs:extension base="xs:integer">
									<xs:attribute name="preferred" type="xs:boolean" use="optional"/>
								</xs:extension>
							</xs:simpleContent>
						</xs:complexType>
					</xs:element>
					<xs:element name="dontRepeat" type="xs:boolean" minOccurs="0"/>
					<xs:element name="attributes" minOccurs="0">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="attr" type="attributeType" maxOccurs="unbounded"/>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
					<xs:element name="childElements" minOccurs="0">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="dataElement" type="elementType" maxOccurs="unbounded"/>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:simpleType name="urlType">
		<xs:annotation>
			<xs:documentation>A simpleType to represent a URL that does a pattern match to verify a full URL without whitespace.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="http://[^ ]*[^., \n\t>&quot;]"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="pathType">
		<xs:annotation>
			<xs:documentation>A simpleType to represent an xpath-type used for querying.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="(/[a-zA-Z0-9_\-]+)+(\[@[a-zA-Z0-9_\-]+\])?"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
