Skip to content

Commit f619114

Browse files
committed
fix(cellml): tweak cellml 1.1 validation to allow RDF and numbered ids
1 parent 8c450e4 commit f619114

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

biosimulators_utils/model_lang/cellml/cellml_1_1.xsd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<schema xmlns="http://www.w3.org/2001/XMLSchema"
33
xmlns:cellml="http://www.cellml.org/cellml/1.1#"
44
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
5+
xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
56
xmlns:xlink="http://www.w3.org/1999/xlink"
67
elementFormDefault="qualified"
78
targetNamespace="http://www.cellml.org/cellml/1.1#">
9+
<import namespace ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
810
<import namespace="http://www.w3.org/1998/Math/MathML"
911
schemaLocation="mathml2.xsd"/>
1012
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="common/xlink-href.xsd"/>
@@ -109,7 +111,8 @@
109111
<element name="units" type="cellml:units"/>
110112
<element name="variable" type="cellml:variable"/>
111113
<element name="reaction" type="cellml:reaction"/>
112-
<element ref="mathml:math"/>
114+
<element ref="mathml:math"/>
115+
<any namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="skip" />
113116
</choice>
114117
<attribute name="name" type="cellml:cellMLIdentifier" use="required"/>
115118
<anyAttribute namespace="##other" processContents="lax"/>

biosimulators_utils/model_lang/cellml/common/common-attribs.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<xs:attribute name="class" type="xs:NMTOKENS"/>
2727
<xs:attribute name="style" type="xs:string"/>
2828
<xs:attribute name="xref" type="xs:IDREF"/>
29-
<xs:attribute name="id" type="xs:ID"/>
29+
<xs:attribute name="id" type="xs:string"/>
3030
<xs:attribute ref="xlink:href"/>
3131
<!-- allow attributes from foreign namespaces, and don't check them -->
3232
<xs:anyAttribute namespace="##other" processContents="skip"/>

biosimulators_utils/model_lang/cellml/validation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ def validate_model_version_1_1(filename, doc, resolve_imports=True, config=None)
148148
# The original ``cellml_1_1.xsd`` was modified to change the http sources to local sources.
149149
# Additionally, the following two lines were removed from the ``cellml_1_1_original.xsd``: 113, 309
150150
# These lines added the following to the definitions of "Component" and "Role": <any namespace="##other" processContents="skip"/>
151-
# This caused lxml to fail to parse the schema due to it being nondeterministic.
151+
# This caused lxml to fail to parse the schema due to it being nondeterministic.
152+
# In its place, <any namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="skip" />
153+
# was added to allow using RDF syntax in the schema. The RDF is not validated.
154+
# Finally, in common/common-attribs.xsd the type of the attribute "id" was changed from "ID" to "string".
155+
# This was done to allow using numbers as ids for equations as described in the CellML primer.
152156

153157
schema_filename = pkg_resources.resource_filename('biosimulators_utils',
154158
os.path.join("model_lang", "cellml", "cellml_1_1.xsd"))

0 commit comments

Comments
 (0)