forked from MichaelClerx/cellml-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcellml_1_0.xsd
354 lines (324 loc) · 15 KB
/
cellml_1_0.xsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cellml="http://www.cellml.org/cellml/1.0#"
targetNamespace="http://www.cellml.org/cellml/1.0#"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>
This schema document provides partial validation of CellML 1.0 documents.
For an overview of the capabilities and limitations of this validation method,
please see
https://github.com/MichaelClerx/cellml-validation/tree/master/reports
</xs:documentation>
</xs:annotation>
<!-- External schemas for MathML, RDF, and cmeta:id, used in lax validation -->
<xs:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd" />
<xs:import namespace="http://www.cellml.org/metadata/1.0#"
schemaLocation="http://cellml.org/specifications/xsd/cmeta-id.xsd" />
<!-- CellML Identifiers -->
<xs:simpleType name="identifier">
<xs:restriction base="xs:string">
<xs:pattern value="_*[a-zA-Z0-9][a-zA-Z0-9_]*" />
<!--<xs:pattern value="\s*_*[a-zA-Z0-9][a-zA-Z0-9_]*\s*" />-->
</xs:restriction>
</xs:simpleType>
<!-- Type for real number strings -->
<!-- We could use `double` for this, but there is no number type defined in CellML -->
<xs:simpleType name="real_number">
<xs:restriction base="xs:string">
<xs:pattern value="[+-]?((\.[0-9]+)|([0-9]+\.?[0-9]*))([eE][+-]?[0-9]+)?" />
<!--<xs:pattern value="\s*[+-]?((\.[0-9]+)|([0-9]+\.?[0-9]*))([eE][+-]?[0-9]+)?\s*" />-->
</xs:restriction>
</xs:simpleType>
<!-- Type for attributes having either "yes" or "no" as value -->
<xs:simpleType name="yes_no">
<xs:restriction base="xs:string">
<xs:enumeration value="yes" />
<xs:enumeration value="no" />
</xs:restriction>
</xs:simpleType>
<!-- Model element -->
<xs:element name="model" type="cellml:model_type">
<!-- Model keys -->
<!-- Unique component names -->
<xs:key name="component_name">
<xs:selector xpath="cellml:component" />
<xs:field xpath="@name" />
</xs:key>
<!-- Unique model units names -->
<xs:unique name="units_name">
<xs:selector xpath="cellml:units" />
<xs:field xpath="@name" />
</xs:unique>
<!-- Component connections must name components -->
<xs:keyref name="connect_component_1" refer="cellml:component_name">
<xs:selector xpath="cellml:connection/cellml:map_components" />
<xs:field xpath="@component_1" />
</xs:keyref>
<xs:keyref name="connect_component_2" refer="cellml:component_name">
<xs:selector xpath="cellml:connection/cellml:map_components" />
<xs:field xpath="@component_2" />
</xs:keyref>
<!-- Component connections can only be defined once (partial check) -->
<xs:unique name="map_components">
<xs:selector xpath="cellml:connection/cellml:map_components" />
<xs:field xpath="@component_1" />
<xs:field xpath="@component_2" />
</xs:unique>
<!-- Group component_refs must name components -->
<!-- Note: This only works for direct children, not for nested ones! -->
<xs:keyref name="group_components_root" refer="cellml:component_name">
<xs:selector xpath="cellml:group/cellml:component_ref" />
<xs:field xpath="@component" />
</xs:keyref>
</xs:element>
<!-- Model type and component keys/keyrefs -->
<xs:complexType name="model_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="units" type="cellml:units_type" />
<xs:element name="component" type="cellml:component_type">
<!-- Component keys -->
<!-- Unique variable names within component -->
<xs:key name="variable_name">
<xs:selector xpath="cellml:variable" />
<xs:field xpath="@name" />
</xs:key>
<!-- Variable_ref must name a variable from the same component -->
<xs:keyref name="reaction_variables" refer="cellml:variable_name">
<xs:selector xpath="cellml:reaction/cellml:variable_ref" />
<xs:field xpath="@variable" />
</xs:keyref>
<!-- Role delta_variable must name a variable from the same component -->
<xs:keyref name="delta_variables" refer="cellml:variable_name">
<xs:selector xpath="cellml:reaction/cellml:variable_ref/cellml:role" />
<xs:field xpath="@delta_variable" />
</xs:keyref>
<!-- Unique component units names -->
<!-- Note: This is not a key, since the unit fields can refer to either
a model or component unit, or a predefined base unit. -->
<xs:unique name="component_units_name">
<xs:selector xpath="cellml:units" />
<xs:field xpath="@name" />
</xs:unique>
<!-- Reaction delta_variables can only be used once -->
<xs:unique name="delta_variable">
<xs:selector xpath="cellml:reaction/cellml:variable_ref/cellml:role" />
<xs:field xpath="@delta_variable" />
</xs:unique>
</xs:element>
<xs:element name="group" type="cellml:group_type">
<!-- Named relationship_refs must be unique within a group -->
<xs:unique name="named_relationships_within_a_group">
<xs:selector xpath="cellml:relationship_ref" />
<xs:field xpath="@relationship" />
<xs:field xpath="@name" />
</xs:unique>
</xs:element>
<xs:element name="connection" type="cellml:connection_type" />
<!-- Allow any elements not in CellML (including tmp-documentation and rdf) -->
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="name" type="cellml:identifier" use="required" />
<!-- Allow any attributes not in CellML (including cmeta:id) -->
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<!-- Component type -->
<xs:complexType name="component_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="units" type="cellml:units_type" />
<xs:element name="variable" type="cellml:variable_type" />
<xs:element name="reaction" type="cellml:reaction_type">
<!-- Reaction variables can only be defined once -->
<xs:unique name="reaction_variable">
<xs:selector xpath="cellml:variable_ref" />
<xs:field xpath="@variable" />
</xs:unique>
</xs:element>
<!-- Allow elements from other namespaces, including MathML. Use lax
processing so that MathML might still be validated. -->
<xs:any namespace="##other" processContents="lax" />
</xs:choice>
<xs:attribute name="name" type="cellml:identifier" use="required" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<!-- Variable type -->
<xs:complexType name="variable_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="name" type="cellml:identifier" use="required" />
<xs:attribute name="units" type="xs:string" use="required" />
<xs:attribute name="initial_value" type="cellml:real_number" use="optional" />
<xs:attribute name="public_interface" type="cellml:interface" use="optional" default="none" />
<xs:attribute name="private_interface" type="cellml:interface" use="optional" default="none" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:simpleType name="interface">
<xs:restriction base="xs:string">
<xs:enumeration value="in" />
<xs:enumeration value="out" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
<!-- Connection and mapping types -->
<xs:complexType name="connection_type">
<xs:choice maxOccurs="unbounded">
<xs:element name="map_components" type="cellml:map_components_type" minOccurs="1" maxOccurs="1" />
<xs:element name="map_variables" type="cellml:map_variables_type" minOccurs="1" maxOccurs="unbounded" />
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="map_components_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="component_1" type="cellml:identifier" use="required" />
<xs:attribute name="component_2" type="cellml:identifier" use="required" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="map_variables_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="variable_1" type="cellml:identifier" use="required" />
<xs:attribute name="variable_2" type="cellml:identifier" use="required" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<!-- Unit types -->
<xs:complexType name="units_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="unit" type="cellml:unit_type" />
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="name" type="cellml:identifier" use="required" />
<xs:attribute name="base_units" type="cellml:yes_no" use="optional" default="no" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="unit_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="units" type="xs:string" use="required" />
<xs:attribute name="prefix" type="cellml:unit_prefix" use="optional" default="0" />
<xs:attribute name="exponent" type="cellml:real_number" use="optional" default="1.0" />
<xs:attribute name="multiplier" type="cellml:real_number" use="optional" default="1.0" />
<xs:attribute name="offset" type="cellml:real_number" use="optional" default="0.0" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:simpleType name="unit_prefix">
<xs:union memberTypes="cellml:unit_prefix_string xs:integer" />
</xs:simpleType>
<xs:simpleType name="unit_prefix_string">
<xs:restriction base="xs:string">
<xs:enumeration value="yotta" />
<xs:enumeration value="zetta" />
<xs:enumeration value="exa" />
<xs:enumeration value="peta" />
<xs:enumeration value="tera" />
<xs:enumeration value="giga" />
<xs:enumeration value="mega" />
<xs:enumeration value="kilo" />
<xs:enumeration value="hecto" />
<xs:enumeration value="deka" />
<xs:enumeration value="deci" />
<xs:enumeration value="centi" />
<xs:enumeration value="milli" />
<xs:enumeration value="micro" />
<xs:enumeration value="nano" />
<xs:enumeration value="pico" />
<xs:enumeration value="femto" />
<xs:enumeration value="atto" />
<xs:enumeration value="zepto" />
<xs:enumeration value="yocto" />
</xs:restriction>
</xs:simpleType>
<!-- Group and relationship types -->
<xs:complexType name="group_type">
<xs:choice maxOccurs="unbounded">
<xs:element name="relationship_ref" type="cellml:relationship_ref_type" minOccurs="1" />
<xs:element name="component_ref" type="cellml:component_ref_type" minOccurs="1" />
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="relationship_ref_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<!-- Note: relationship is optional because an extension namespace relationship
may be used instead -->
<xs:attribute name="relationship" type="cellml:relationship" use="optional" />
<xs:attribute name="name" type="cellml:identifier" use="optional" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="component_ref_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="component_ref" type="cellml:component_ref_type" />
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="component" type="cellml:identifier" use="required" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:simpleType name="relationship">
<xs:restriction base="xs:string">
<xs:enumeration value="containment" />
<xs:enumeration value="encapsulation" />
</xs:restriction>
</xs:simpleType>
<!-- Reaction types -->
<xs:complexType name="reaction_type">
<xs:choice maxOccurs="unbounded">
<xs:element name="variable_ref" type="cellml:variable_ref_type" minOccurs="1">
<xs:unique name="unique_role_direction_pairs">
<xs:selector xpath="cellml:role" />
<xs:field xpath="@role" />
<xs:field xpath="@direction" />
</xs:unique>
</xs:element>
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="reversible" type="cellml:yes_no" use="optional" default="yes" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="variable_ref_type">
<xs:choice maxOccurs="unbounded">
<xs:element name="role" type="cellml:role_type" minOccurs="1" />
<xs:any namespace="##other" processContents="skip" />
</xs:choice>
<xs:attribute name="variable" type="cellml:identifier" use="required" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="role_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<!-- Use lax processing for MathML validation -->
<xs:any namespace="##other" processContents="lax" />
</xs:choice>
<xs:attribute name="role" type="cellml:species_role" use="required" />
<xs:attribute name="delta_variable" type="cellml:identifier" use="optional" />
<xs:attribute name="direction" type="cellml:reaction_direction" use="optional" default="forward" />
<xs:attribute name="stoichiometry" type="cellml:real_number" use="optional" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:simpleType name="species_role">
<xs:restriction base="xs:string">
<xs:enumeration value="reactant" />
<xs:enumeration value="product" />
<xs:enumeration value="catalyst" />
<xs:enumeration value="activator" />
<xs:enumeration value="inhibitor" />
<xs:enumeration value="modifier" />
<xs:enumeration value="rate" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="reaction_direction">
<xs:restriction base="xs:string">
<xs:enumeration value="forward" />
<xs:enumeration value="reverse" />
<xs:enumeration value="both" />
</xs:restriction>
</xs:simpleType>
</xs:schema>