<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.2 U (http://www.xmlspy.com) by Markus Doering (BGBM, FU-Berlin) -->
<!-- Setup schema for BioCASE providers -->
<!-- Authors: M.Doering, A.Guentsch, A.Hahn -->
<!-- Botanic Museum and Botanical Garden Berlin-Dahlem -->
<xs:schema targetNamespace="http://www.biocase.org/schemas/providersetup/1.2" xmlns="http://www.biocase.org/schemas/providersetup/1.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Provider">
		<xs:annotation>
			<xs:documentation>Providers Host Configuration</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Host">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="User" type="xs:string"/>
							<xs:element name="Password" type="xs:string"/>
							<xs:element name="Datasource" type="xs:string"/>
							<xs:element name="IP" type="xs:anyURI"/>
							<xs:element name="DBMS">
								<xs:annotation>
									<xs:documentation>kind (brand) of DBMS used. will be a  controlled vocabulary.</xs:documentation>
								</xs:annotation>
								<xs:simpleType>
									<xs:restriction base="xs:token">
										<xs:enumeration value="odbc"/>
										<xs:enumeration value="odbc_tsql"/>
										<xs:enumeration value="postgres"/>
										<xs:enumeration value="oracle"/>
										<xs:enumeration value="mysql"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="TextEncoding">
								<xs:annotation>
									<xs:documentation>text encoding as found in the python libraries .\lib\encodings. see also http://www.biocase.org/dev/providerconf/encodings.shtml</xs:documentation>
								</xs:annotation>
								<xs:simpleType>
									<xs:restriction base="xs:string"/>
								</xs:simpleType>
							</xs:element>
							<xs:element name="YourServerIP" type="xs:string" minOccurs="0">
								<xs:annotation>
									<xs:documentation>if left out it is determined dynamically through server environment variables.</xs:documentation>
								</xs:annotation>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="DB">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="TableAlias" maxOccurs="unbounded">
								<xs:annotation>
									<xs:documentation>A list of aliases for tables and their keys representing the DB structure. All aliases have to be unique and no circular relation is allowed.</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:complexContent>
										<xs:extension base="TableType"/>
									</xs:complexContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="SupportedSchemas">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Schema" minOccurs="0" maxOccurs="unbounded">
								<xs:annotation>
									<xs:documentation>holds the filepath to one DBmapping file.</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:simpleContent>
										<xs:extension base="xs:string">
											<xs:attribute name="namespace" type="xs:string" use="required"/>
											<xs:attribute name="request" type="xs:boolean" use="required"/>
											<xs:attribute name="response" type="xs:boolean" use="required"/>
										</xs:extension>
									</xs:simpleContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="WrapperBehavior">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Logging" minOccurs="0">
								<xs:annotation>
									<xs:documentation>Logging information. If left out the default is daily simple logging.</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:attribute name="rate" use="required">
										<xs:simpleType>
											<xs:restriction base="xs:token">
												<xs:enumeration value="daily"/>
												<xs:enumeration value="weekly"/>
												<xs:enumeration value="monthly"/>
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="state" use="required">
										<xs:simpleType>
											<xs:restriction base="xs:token">
												<xs:enumeration value="off"/>
												<xs:enumeration value="simple"/>
												<xs:enumeration value="detailed"/>
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
								</xs:complexType>
							</xs:element>
							<xs:element name="RecordResultLimit" type="xs:integer" minOccurs="0">
								<xs:annotation>
									<xs:documentation>Limits the maximum of records returned for a query.</xs:documentation>
								</xs:annotation>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="TableType">
		<xs:sequence>
			<xs:element name="PrimaryKey">
				<xs:annotation>
					<xs:documentation>The primary key(s) of the table.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Attribute" maxOccurs="unbounded">
							<xs:annotation>
								<xs:documentation>Attribute(s) that are the primary keys. If no dbType is given, it is assumed to be a string.</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:simpleContent>
									<xs:extension base="xs:string">
										<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:restriction>
											</xs:simpleType>
										</xs:attribute>
									</xs:extension>
								</xs:simpleContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="ForeignKey" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>for every foreign key in the table, the targeted alias of a table is given as a attribute.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Attribute" maxOccurs="unbounded">
							<xs:annotation>
								<xs:documentation>Attribute(s) that are the foreign keys. Have to be in the same order as the primary keys of the table they are pointing to. If no dbType is given, it is assumed to be a string.</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:simpleContent>
									<xs:extension base="xs:string">
										<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:restriction>
											</xs:simpleType>
										</xs:attribute>
									</xs:extension>
								</xs:simpleContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:attribute name="target" type="xs:string" use="required"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="alias" type="xs:string" use="required"/>
		<xs:attribute name="tablename" type="xs:string" use="required"/>
	</xs:complexType>
</xs:schema>
