<?xml version="1.0"?>
<Schema name="cml_dev_karne" xmlns="http://www.w3.org/1999/XMLSchema">
<description>
CML development - Version 0.2 - 7/4/00

This document is the first draft of an XML Schema compatible with CML
V1.0 published in JCICS... In converting the schema we have suggested
some closed and some open content models. As CML develops it seems likely
that there will be advantage in opening some of the models (e.g. angle),
perhaps for annotations and ancillary information. Readers should note
that the XML Schema activity is still at draft stage and that this schema
may be revised in the future for compatibility. 

This schema is intended to be software and platform independent - we show
in a note how it may be made to work with current implementations. XML
documents can be validated against this schema by adding xmlns="x-schema:URL"
within the cml element.

Peter Murray Rust, Henry Rzepa, Michael Wright

Comments to Michael Wright - karne@innocent.com
</description>

<!-- ********** Attribute Types ********** -->
<!-- *** common *** -->

<AttributeType name="title" required="no"/>
<!-- primarly for display but may be used as a search field-->
<AttributeType name="id" required="no"/>			
<!-- *must* be an unique id -->
<AttributeType name="convention" required="no"/>
<AttributeType name="builtin" required="no"/>
<!-- indicates a data element with a particular chemical meaning allowed values == "x2 y2 xy2 x3 y3 z3 xyz3 xFract yFract zFract xyzFract elementType atomId isotope occupancy hydrogenCount atomParity residueType residueId formalCharge atomRef atomRefs length order stereo acell bcell ccell alpha beta gamma z spacegroup" -->

<!-- *** linkers *** -->

<AttributeType name="href" required="no"/>
<!-- link to object -->
<AttributeType name="dictRef" required="no"/>
<!-- link to glossary -->
<AttributeType name="unitsRef" required="no"/>
<!-- link to scientific unit declaration -->
<AttributeType name="atomRef" required="no"/>
<!-- link to atom -->
<AttributeType name="atomRefs" required="no"/>
<!-- link to atoms -->

<!-- *** quantifiers/constraints *** -->

<AttributeType name="count" required="no"/>
<!-- qualifier - useful for stoichiometry -->
<AttributeType name="size" required="no"/>
<!-- constraint on array and matrix -->
<AttributeType name="rows" required="no"/>
<!-- constraint on array and matrix -->
<AttributeType name="columns" required="no"/>
<!-- constraint on array and matrix -->
<AttributeType name="min" required="no"/>
<!-- constraint on numeric data -->
<AttributeType name="max" required="no"/>
<!-- constraint on numeric data -->
<AttributeType name="units" required="no"/>
<!-- units as a string -->

<!-- ********** Element Types ************ -->
<!-- *** data  *** -->

<ElementType name="string" content="textOnly" model="closed">
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="float" content="textOnly" model="closed">
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="integer" content="textOnly" model="closed">
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<!-- the above three are for general use - to ensure compatability with schema and DTD, use these rather than defining new elements -->

<ElementType name="stringArray" content="textOnly" model="closed">
	<!-- array of strings, (e.g. atom labels/elements with builtin = id, elementType) -->
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="size"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="floatArray" content="textOnly" model="closed">
	<!-- array of floating point numbers, (e.g. single axis coordinates with builtin = x3, y3 or z3) -->
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="size"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="integerArray" content="textOnly" model="closed">
	<!-- array of integers -->
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="size"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="floatMatrix" content="textOnly" model="closed">
	<!-- matrix of floating point numbers -->
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="rows"/>
	<attribute type="columns"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="coordinate2" content="textOnly" model="closed">
	<!-- use for data pairs (e.g spectra xy) -->
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="coordinate3" content="textOnly" model="closed">
	<!-- use for data triplets (e.g spectra x, y, m) -->			
	<attribute type="id"/>
	<attribute type="builtin"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="units"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="angle" content="textOnly" model="open">		
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="atomRefs"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units" default="deg"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="torsion" content="textOnly" model="open">		
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="atomRefs"/>
	<attribute type="min"/>
	<attribute type="max"/>
	<attribute type="units" default="deg"/>
	<attribute type="unitsRef"/>
	<attribute type="dictRef"/>
</ElementType>

<!-- *** mixed *** -->

<ElementType name="link" content="mixed" model="open">
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="href"/>
</ElementType>	

<ElementType name="formula" content="mixed" model="open">
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<!-- default convention is a simple element/number string (e.g. C17 H18 O2 S2) -->
	<attribute type="count"/>
	<attribute type="dictRef"/>
</ElementType>
	
<!-- *** strutural *** -->	
	
<ElementType name="atom" content="eltOnly" model="open" order="many">
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention" default="mol"/>
	<attribute type="count"/>
	<attribute type="dictRef"/>
	<element type="float" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = x2, y2 or x3, y3, z3 and charge -->
	<element type="string" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = elementType -->
	<element type="integer" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = hydrogenCount -->
	<element type="link" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="bond" content="eltOnly" model="open" order="many">
	<attribute type="id"/>
	<attribute type="convention" default="mol"/>
	<attribute type="atomRef"/>
	<attribute type="atomRefs"/>
	<!-- avoid using these and use a subelement with builtin="atomRef" -->
	<element type="integer" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = atomRef, order -->
	<element type="float" minOccurs="0" maxOccurs="*"/>
	<element type="string" minOccurs="0" maxOccurs="*"/>
	<element type="link" minOccurs="0" maxOccurs="*"/>
	<element type="angle" minOccurs="0" maxOccurs="*"/>
	<element type="torsion" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="list" content="eltOnly" model="open" order="many">
	<!--a list of atoms, bonds or spectra coordinate pairs/triplets -->
	<attribute type="id"/>
	<attribute type="title"/>
	<!-- required: atoms/bonds/xypairs/peak table/atom map-->
	<attribute type="convention"/>
	<!-- should be included for spectra: (XY..XY), (XYM) -->
	<element type="string" minOccurs="0" maxOccurs="*"/>
	<element type="integer" minOccurs="0" maxOccurs="*"/>
	<element type="float" minOccurs="0" maxOccurs="*"/>
	<element type="floatArray" minOccurs="0" maxOccurs="*"/>
	<element type="stringArray" minOccurs="0" maxOccurs="*"/>
	<element type="integerArray" minOccurs="0" maxOccurs="*"/>
	<element type="floatMatrix" minOccurs="0" maxOccurs="*"/>
	<element type="angle" minOccurs="0" maxOccurs="*"/>
	<element type="torsion" minOccurs="0" maxOccurs="*"/>
	<element type="coordinate2" minOccurs="0" maxOccurs="*"/>
	<element type="coordinate3" minOccurs="0" maxOccurs="*"/>
	<element type="link" minOccurs="0" maxOccurs="*"/>
	<element type="formula" minOccurs="0" maxOccurs="*"/>
	<element type="atom" minOccurs="0" maxOccurs="*"/>
	<element type="bond" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="atomArray" content="eltOnly" model="open" order="many">
	<!-- only use for large molecules -->
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
	<element type="stringArray" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = id, elementType -->
	<element type="floatArray" minOccurs="0" maxOccurs="*"/>
	<!-- builtin = "x3, y3, z3, charge -->
	<element type="integerArray" minOccurs="0" maxOccurs="*"/>
	<element type="link" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="bondArray" content="eltOnly" model="open" order="many">
	<!-- only use for large molecules -->
	<attribute type="id"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
	<element type="stringArray" minOccurs="0" maxOccurs="*"/>
	<element type="floatArray" minOccurs="0" maxOccurs="*"/>
	<element type="integerArray" minOccurs="0" maxOccurs="*"/>
	<element type="link" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="electron" content="eltOnly" model="open">
	<attribute type="id"/>
	<attribute type="count"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="crystal" content="eltOnly" model="open">
	<attribute type="id"/>
	<attribute type="title" default="crystal"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="sequence" content="eltOnly" model="open">
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="feature" content="eltOnly" model="open">
	<attribute type="id"/>
	<attribute type="title"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
</ElementType>

<ElementType name="molecule" content="eltOnly" model="open" order="many">
	<!--marks the start of molecular information - may contain molecule specific information in strings or formula and the structure in two lists or an atomArray -->
	<attribute type="id"/>
	<attribute type="title" default="molecule"/>
	<attribute type="convention" default="mol"/>
	<attribute type="dictRef"/>
	<element type="formula" minOccurs="0" maxOccurs="*"/>
	<element type="list" minOccurs="0" maxOccurs="*"/>
	<element type="atomArray" minOccurs="0" maxOccurs="*"/>
	<element type="bondArray" minOccurs="0" maxOccurs="*"/>
	<element type="string" minOccurs="0" maxOccurs="*"/>
	<element type="float" minOccurs="0" maxOccurs="*"/>
	<element type="integer" minOccurs="0" maxOccurs="*"/>
	<element type="link" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="reaction" content="eltOnly" model="open" order="many">
	<attribute type="id"/>
	<attribute type="title" default="reaction"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
	<element type="string" minOccurs="0" maxOccurs="*"/>
	<element type="float" minOccurs="0" maxOccurs="*"/>
	<element type="integer" minOccurs="0" maxOccurs="*"/>
	<element type="list" minOccurs="0" maxOccurs="*"/>
</ElementType>

<!-- **********  root ********** -->

<ElementType name="cml" content="mixed" model="open" order="many">
	<attribute type="id"/>
	<attribute type="title" default="cml document"/>
	<attribute type="convention"/>
	<attribute type="dictRef"/>
	<!-- namespace should indicate this schema e.g. xmlns="x-schema:cml_schema_10.xml" -->
	<element type="molecule" minOccurs="0" maxOccurs="*"/>
	<element type="crystal" minOccurs="0" maxOccurs="*"/>
	<element type="reaction" minOccurs="0" maxOccurs="*"/>
</ElementType>

</Schema>

