From 4b01408393c70f7c1372cf277ea64dc65c0787ea Mon Sep 17 00:00:00 2001 From: Bilal Shaikh Date: Wed, 13 Apr 2022 15:54:12 -0400 Subject: [PATCH] fix(cellml): tweak cellml 1.1 validation to allow RDF and numbered ids --- biosimulators_utils/model_lang/cellml/cellml_1_1.xsd | 5 ++++- .../model_lang/cellml/common/common-attribs.xsd | 2 +- biosimulators_utils/model_lang/cellml/validation.py | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd b/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd index 3ade21ef..b3f124e0 100644 --- a/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd +++ b/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd @@ -2,9 +2,11 @@ + @@ -109,7 +111,8 @@ - + + diff --git a/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd b/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd index 33698b8f..2a3011f6 100644 --- a/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd +++ b/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd @@ -26,7 +26,7 @@ - + diff --git a/biosimulators_utils/model_lang/cellml/validation.py b/biosimulators_utils/model_lang/cellml/validation.py index e1e96135..bac5045f 100644 --- a/biosimulators_utils/model_lang/cellml/validation.py +++ b/biosimulators_utils/model_lang/cellml/validation.py @@ -142,13 +142,17 @@ def validate_model_version_1_1(filename, doc, resolve_imports=True, config=None) """ # ``cellml_1_1_original.xsd`` was obtained from https://www.cellml.org/tools/cellml_1_1_schema # `cellml_1_1.xsd`` was created by were directly downloading all referenced namspaces from - # https://www.cellml.org/tools/cellml_1_1_schema/common, - # https://www.cellml.org/tools/cellml_1_1_schema/content, + # https://www.cellml.org/tools/cellml_1_1_schema/common, + # https://www.cellml.org/tools/cellml_1_1_schema/content, # https://www.cellml.org/tools/cellml_1_1_schema/presentation # 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": # This caused lxml to fail to parse the schema due to it being nondeterministic. + # In its place, + # 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"))