Skip to content

Commit

Permalink
fix(cellml): tweak cellml 1.1 validation to allow RDF and numbered ids
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalshaikh42 committed Apr 13, 2022
1 parent 8c450e4 commit f619114
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion biosimulators_utils/model_lang/cellml/cellml_1_1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cellml="http://www.cellml.org/cellml/1.1#"
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
elementFormDefault="qualified"
targetNamespace="http://www.cellml.org/cellml/1.1#">
<import namespace ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="mathml2.xsd"/>
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="common/xlink-href.xsd"/>
Expand Down Expand Up @@ -109,7 +111,8 @@
<element name="units" type="cellml:units"/>
<element name="variable" type="cellml:variable"/>
<element name="reaction" type="cellml:reaction"/>
<element ref="mathml:math"/>
<element ref="mathml:math"/>
<any namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="skip" />
</choice>
<attribute name="name" type="cellml:cellMLIdentifier" use="required"/>
<anyAttribute namespace="##other" processContents="lax"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<xs:attribute name="class" type="xs:NMTOKENS"/>
<xs:attribute name="style" type="xs:string"/>
<xs:attribute name="xref" type="xs:IDREF"/>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute ref="xlink:href"/>
<!-- allow attributes from foreign namespaces, and don't check them -->
<xs:anyAttribute namespace="##other" processContents="skip"/>
Expand Down
6 changes: 5 additions & 1 deletion biosimulators_utils/model_lang/cellml/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ def validate_model_version_1_1(filename, doc, resolve_imports=True, config=None)
# The original ``cellml_1_1.xsd`` was modified to change the http sources to local sources.
# Additionally, the following two lines were removed from the ``cellml_1_1_original.xsd``: 113, 309
# These lines added the following to the definitions of "Component" and "Role": <any namespace="##other" processContents="skip"/>
# This caused lxml to fail to parse the schema due to it being nondeterministic.
# This caused lxml to fail to parse the schema due to it being nondeterministic.
# In its place, <any namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="skip" />
# was added to allow using RDF syntax in the schema. The RDF is not validated.
# Finally, in common/common-attribs.xsd the type of the attribute "id" was changed from "ID" to "string".
# This was done to allow using numbers as ids for equations as described in the CellML primer.

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

0 comments on commit f619114

Please sign in to comment.