<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2014 (x64) (http://www.altova.com) by Dan Smith (Apelon, Inc.) -->
<!-- Copyright (c) 1997 - 2014 Apelon, Inc. All rights reserved. -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:annotation>
		<xs:documentation> Describes a 'namespace' data format suitable for import into a Thesaurus Namespace by the DTS Import Wizard plug-in. 
			Defines all Attribute Types, Terms, Concepts and non-Term/Concept Attributes.  Author: jbowie, Apelon, Inc. 
		</xs:documentation>
	</xs:annotation>
	<!--===============================================================================-->
	<!-- basic information for a DTS Object                          -->
	<!--===============================================================================-->
	<xs:group name="ContentIdentifiers">
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:group ref="BasicIdentifiers"/>
		</xs:sequence>
	</xs:group>
	<xs:group name="NamespaceIdentifiers">
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:group ref="BasicIdentifiers"/>
		</xs:sequence>
	</xs:group>
	<xs:annotation>
		<xs:documentation> Top level DTS Objects (Attribute Types, Terms and Concepts) are defined by the BasicIdentifiers (Name, Code, and Id). 
			The value of each of these elements (if specified) must be unique in the Namespace. 
			If an element is not provided (Code and ID) a generator will create a unique value upon loading.
		</xs:documentation>
	</xs:annotation>
	<xs:group name="BasicIdentifiers">
		<xs:sequence>
			<xs:element name="name" type="xs:token"/>
			<xs:element name="code" type="xs:token" minOccurs="0"/>
			<xs:element name="id" type="xs:positiveInteger" minOccurs="0"/>
		</xs:sequence>
	</xs:group>
	<!--===============================================================================-->
	<!-- terminology - a definition or update of a terminology                         -->
	<!--===============================================================================-->
	<xs:element name="terminology">
		<xs:annotation>
			<xs:documentation> A namespace terminology is a collection of TypeDefs, TermDefs, ConceptDefs, PropertyDefs, and AssociationDefs </xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="namespace" type="NamespaceDef"/>
				<xs:element name="referencedNamespace" type="NamespaceDef" minOccurs="0" maxOccurs="unbounded"/>
				<xs:choice minOccurs="0" maxOccurs="unbounded">
					<xs:element name="proptype" type="PropertyTypeDef"/>
					<xs:element name="assntype" type="AssociationTypeDef"/>
					<xs:element name="qualtype" type="QualifierTypeDef"/>
				</xs:choice>
				<xs:element name="term" type="TermDef" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="concept" type="ConceptDef" minOccurs="0" maxOccurs="unbounded"/>
				<xs:choice minOccurs="0" maxOccurs="unbounded">
					<xs:element name="property" type="PropertyDef"/>
					<xs:element name="synonym" type="SynonymDef"/>
					<xs:element name="association" type="AssociationDef"/>
				</xs:choice>
			</xs:sequence>
			<xs:attribute name="type" type="xs:token" fixed="namespace"/>
		</xs:complexType>
	</xs:element>
	<!--===============================================================================-->
	<!-- NamespaceDef - definition of originating namespace                           -->
	<!--===============================================================================-->
	<xs:complexType name="NamespaceDef">
		<xs:sequence>
			<xs:group ref="BasicIdentifiers"/>
			<xs:element name="version" type="xs:token"/>
			<xs:element name="authority" type="xs:token"/>
		</xs:sequence>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- PropertyTypeDef - definition of Property Type                           -->
	<!--===============================================================================-->
	<xs:complexType name="PropertyTypeDef">
		<xs:group ref="ContentIdentifiers"/>
		<xs:attribute name="type" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="C"/>
					<xs:enumeration value="T"/>
					<xs:enumeration value="N"/>
					<xs:enumeration value="V"/>
					<!-- Concept Property -->
					<!-- Term Property -->
					<!-- Namespace Property -->
					<!-- Namespace Version Property -->
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- AssociationTypeDef - definition of Association Type                           -->
	<!--===============================================================================-->
	<xs:complexType name="AssociationTypeDef">
		<xs:sequence>
			<xs:group ref="NamespaceIdentifiers"/>
			<xs:element name="inverse_name" type="xs:token" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="type" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="C"/>
					<xs:enumeration value="T"/>
					<xs:enumeration value="S"/>
					<!-- Concept Association -->
					<!-- Term Association -->
					<!-- Synonym Association -->
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="purpose" use="optional" default="A">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="A"/>
					<xs:enumeration value="H"/>
					<xs:enumeration value="M"/>
					<!-- Arbitrary -->
					<!-- History -->
					<!-- Mapping -->
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- QualifierTypeDef - definition of Qualifier Type                           -->
	<!--===============================================================================-->
	<xs:complexType name="QualifierTypeDef">
		<xs:group ref="ContentIdentifiers"/>
		<xs:attribute name="type" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="CP"/>
					<xs:enumeration value="CA"/>
					<xs:enumeration value="TP"/>
					<xs:enumeration value="TA"/>
					<xs:enumeration value="NP"/>
					<xs:enumeration value="VP"/>
					<!-- Concept Property Qualifier -->
					<!-- Concept Association Qualifier-->
					<!-- Term Property Qualifier -->
					<!-- Term Association Qualifier-->
					<!-- Namespace Property Qualifier -->
					<!-- Namespace Version Property Qualifier-->
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- TermDef - definition of a term                           -->
	<!--===============================================================================-->
	<xs:complexType name="TermDef">
		<xs:sequence>
			<xs:group ref="NamespaceIdentifiers"/>
			<xs:element name="status" type="xs:token"/>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="synonym" type="SynonymDef"/>
				<xs:element name="property" type="PropertyDef"/>
				<xs:element name="association" type="AssociationDef"/>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- ConceptDef - definition of a Concept                           -->
	<!--===============================================================================-->
	<xs:complexType name="ConceptDef">
		<xs:sequence>
			<xs:group ref="NamespaceIdentifiers"/>
			<xs:element name="status" type="xs:token"/>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="synonym" type="SynonymDef"/>
				<xs:element name="property" type="PropertyDef"/>
				<xs:element name="association" type="AssociationDef"/>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="root" type="xs:boolean" use="optional"/>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- SynonymDef - definition of Synonym                           -->
	<!--===============================================================================-->
	<xs:complexType name="SynonymDef">
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:element name="name" type="xs:token"/>
			<!-- name of SynonymType -->
			<xs:group ref="FromElement" minOccurs="0"/>
			<!-- from Concept, optional if inside Concept -->
			<xs:group ref="ToElement"/>
			<!-- To Term -->
			<xs:element name="preferred" type="xs:boolean" minOccurs="0"/>
			<!-- true if a preferred synonym -->
		</xs:sequence>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- PropertyDef - definition of Property                           -->
	<!--===============================================================================-->
	<xs:complexType name="PropertyDef">
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:element name="name" type="xs:token"/>
			<!-- name of PropertyType -->
			<xs:element name="value" type="xs:token"/>
			<!-- Property value -->
			<xs:group ref="FromElement" minOccurs="0"/>
			<!-- Property's Concept/Term, optional if inside an object -->
			<xs:element name="qualifier" type="QualifierDef" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!--===============================================================================-->
	<!-- AssociationDef - definition of Association                           -->
	<!--===============================================================================-->
	<xs:complexType name="AssociationDef">
		<xs:annotation>
			<xs:documentation> This element includes all types of Associations: Synonyms, Term Associations and Concept Associations.
			</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:element name="name" type="xs:token"/>
			<!-- name of AssociationType -->
			<xs:group ref="FromElement"/>
			<xs:group ref="ToElement"/>
			<xs:element name="qualifier" type="QualifierDef" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:group name="ToElement">
		<xs:annotation>
			<xs:documentation> A reference from the local Concept/Term to another Concept/Term (in any Namespace).
			</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="to_namespace" type="xs:token"/>
			<xs:element name="to_name" type="xs:token">
				<xs:annotation>
					<xs:documentation>MED-RT: Concept Name
MeSH: Preferred Term
RxNorm: Preferred Term
SNOMED CT: FSN Synonym</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- name of target Concept/Term -->
			<xs:element name="to_code" type="xs:token" minOccurs="0">
				<xs:annotation>
					<xs:documentation>MED-RT: NUI
MeSH: Code in Source
RxNorm: Code in Source
SNOMED CT: Code in Source</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- code of target Term -->
		</xs:sequence>
	</xs:group>
	<xs:group name="FromElement">
		<xs:annotation>
			<xs:documentation> A reference to the local Concept/Term from another Concept/Term (in a different Namespace).
			</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="from_namespace" type="xs:token"/>
			<xs:element name="from_name" type="xs:token">
				<xs:annotation>
					<xs:documentation>MED-RT: Concept Name
MeSH: Preferred Term
RxNorm: Preferred Term
SNOMED CT: FSN Synonym</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- name of source Concept/Term -->
			<xs:element name="from_code" type="xs:token">
				<xs:annotation>
					<xs:documentation>MED-RT: NUI
MeSH: Code in Source
RxNorm: Code in Source
SNOMED CT: Code in Source</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- code of source Term -->
		</xs:sequence>
	</xs:group>
	<!--===============================================================================-->
	<!-- QualifierDef - definition of Qualifier                           -->
	<!--===============================================================================-->
	<xs:complexType name="QualifierDef">
		<xs:sequence>
			<xs:element name="namespace" type="xs:token"/>
			<xs:element name="name" type="xs:token"/>
			<!-- name of QualifierType -->
			<xs:element name="value" type="xs:token"/>
			<!-- Qualifier value -->
		</xs:sequence>
	</xs:complexType>
</xs:schema>
