diff --git a/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd b/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd new file mode 100644 index 00000000..dca21597 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/cellml_1_1.xsd @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd b/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd new file mode 100644 index 00000000..33698b8f --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/common/common-attribs.xsd @@ -0,0 +1,41 @@ + + + + + + + This is the common attributes module for MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/common/math.xsd b/biosimulators_utils/model_lang/cellml/common/math.xsd new file mode 100644 index 00000000..c8e12147 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/common/math.xsd @@ -0,0 +1,130 @@ + + + + + + + This is an XML Schema module defining the "math" element of MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/common/xlink-href.xsd b/biosimulators_utils/model_lang/cellml/common/xlink-href.xsd new file mode 100644 index 00000000..a386bc9f --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/common/xlink-href.xsd @@ -0,0 +1,20 @@ + + + + This schema provides the XLink href attribute for use in the MathML2 + schema. Written by Max Froumentin, W3C. + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/arith.xsd b/biosimulators_utils/model_lang/cellml/content/arith.xsd new file mode 100644 index 00000000..fdb508f7 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/arith.xsd @@ -0,0 +1,90 @@ + + + + + + + This is an XML Schema module for the "arithmetic" operators of content + MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/calculus.xsd b/biosimulators_utils/model_lang/cellml/content/calculus.xsd new file mode 100644 index 00000000..1b8fdb0e --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/calculus.xsd @@ -0,0 +1,146 @@ + + + + + + + This is an XML Schema module for the calculs operators of content + MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/common-attrib.xsd b/biosimulators_utils/model_lang/cellml/content/common-attrib.xsd new file mode 100644 index 00000000..b0d599f4 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/common-attrib.xsd @@ -0,0 +1,30 @@ + + + + + + + This is the XML schema module defining common attributes for the + content part of MathML. + Authors: Stéphane Dalmas, INRIA. + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/constants.xsd b/biosimulators_utils/model_lang/cellml/content/constants.xsd new file mode 100644 index 00000000..a22548e2 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/constants.xsd @@ -0,0 +1,83 @@ + + + + + This is the XML Schema module for the basic constants of MathML content. + Author: Stéphane Dalmas. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/constructs.xsd b/biosimulators_utils/model_lang/cellml/content/constructs.xsd new file mode 100644 index 00000000..4cfc21af --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/constructs.xsd @@ -0,0 +1,260 @@ + + + + + + + + This is an XML Schema module for the basic constructs of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/elementary-functions.xsd b/biosimulators_utils/model_lang/cellml/content/elementary-functions.xsd new file mode 100644 index 00000000..b106f0d1 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/elementary-functions.xsd @@ -0,0 +1,117 @@ + + + + + + This is an XML Schema module for the elementary functions in content + MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/functions.xsd b/biosimulators_utils/model_lang/cellml/content/functions.xsd new file mode 100644 index 00000000..11a5768d --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/functions.xsd @@ -0,0 +1,73 @@ + + + + + + This is an XML Schema module for operators dealing with functions in content + MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/linear-algebra.xsd b/biosimulators_utils/model_lang/cellml/content/linear-algebra.xsd new file mode 100644 index 00000000..eb62bcb6 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/linear-algebra.xsd @@ -0,0 +1,173 @@ + + + + + + + This is an XML Schema module for the linear algebra part of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/logic.xsd b/biosimulators_utils/model_lang/cellml/content/logic.xsd new file mode 100644 index 00000000..6dac2abe --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/logic.xsd @@ -0,0 +1,53 @@ + + + + + This is an XML Schema module for the logic operators of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/relations.xsd b/biosimulators_utils/model_lang/cellml/content/relations.xsd new file mode 100644 index 00000000..87496e5c --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/relations.xsd @@ -0,0 +1,55 @@ + + + + + This is an XML Schema module for the relational operators of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/semantics.xsd b/biosimulators_utils/model_lang/cellml/content/semantics.xsd new file mode 100644 index 00000000..d337ee76 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/semantics.xsd @@ -0,0 +1,85 @@ + + + + + + + This is an XML Schema module for the "sematics" element of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/sets.xsd b/biosimulators_utils/model_lang/cellml/content/sets.xsd new file mode 100644 index 00000000..7a7f7f68 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/sets.xsd @@ -0,0 +1,236 @@ + + + + + + + This is an XML Schema module for the part of content MathML dealing with + sets and lists. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/statistics.xsd b/biosimulators_utils/model_lang/cellml/content/statistics.xsd new file mode 100644 index 00000000..cf0f20e3 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/statistics.xsd @@ -0,0 +1,136 @@ + + + + + + + This is an XML Schema module for the statistical operators of content MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/tokens.xsd b/biosimulators_utils/model_lang/cellml/content/tokens.xsd new file mode 100644 index 00000000..7e7f9b81 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/tokens.xsd @@ -0,0 +1,120 @@ + + + + + + + This is the XML schema module for the token elements of the + content part of MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/content/vector-calculus.xsd b/biosimulators_utils/model_lang/cellml/content/vector-calculus.xsd new file mode 100644 index 00000000..3e5dd9ce --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/content/vector-calculus.xsd @@ -0,0 +1,88 @@ + + + + + + + This is an XML Schema module for the vector calculs operators of content + MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/mathml2.xsd b/biosimulators_utils/model_lang/cellml/mathml2.xsd new file mode 100644 index 00000000..2bd76bfb --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/mathml2.xsd @@ -0,0 +1,59 @@ + + + + + + This is an XML Schema for MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/action.xsd b/biosimulators_utils/model_lang/cellml/presentation/action.xsd new file mode 100644 index 00000000..96336985 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/action.xsd @@ -0,0 +1,44 @@ + + + + + + + This is the XML Schema module for the MathML "maction" element. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/characters.xsd b/biosimulators_utils/model_lang/cellml/presentation/characters.xsd new file mode 100644 index 00000000..32b4d3f7 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/characters.xsd @@ -0,0 +1,37 @@ + + + + + + + This is the XML Schema module for the MathML "mglyph" element. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/common-attribs.xsd b/biosimulators_utils/model_lang/cellml/presentation/common-attribs.xsd new file mode 100644 index 00000000..2dff7e33 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/common-attribs.xsd @@ -0,0 +1,113 @@ + + + + + + + This schema module defines sets of attributes common to several elements + of presentation MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/common-types.xsd b/biosimulators_utils/model_lang/cellml/presentation/common-types.xsd new file mode 100644 index 00000000..a44c3bfc --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/common-types.xsd @@ -0,0 +1,103 @@ + + + + + + + This is an XML Schema module containing some type definitions for MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/error.xsd b/biosimulators_utils/model_lang/cellml/presentation/error.xsd new file mode 100644 index 00000000..01b5b960 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/error.xsd @@ -0,0 +1,40 @@ + + + + + + + This is the XML Schema module for the MathML "merror" element. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/layout.xsd b/biosimulators_utils/model_lang/cellml/presentation/layout.xsd new file mode 100644 index 00000000..80b005ef --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/layout.xsd @@ -0,0 +1,195 @@ + + + + + + This is the XML schema module for the layout elements of the + presentation part of MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/scripts.xsd b/biosimulators_utils/model_lang/cellml/presentation/scripts.xsd new file mode 100644 index 00000000..cf7eea15 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/scripts.xsd @@ -0,0 +1,186 @@ + + + + + + + This is an XML Schema module for the presentation elements of MathML + dealing with subscripts and superscripts. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/space.xsd b/biosimulators_utils/model_lang/cellml/presentation/space.xsd new file mode 100644 index 00000000..24373538 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/space.xsd @@ -0,0 +1,52 @@ + + + + + + + This is the XML Schema module for the MathML "mspace" element. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/style.xsd b/biosimulators_utils/model_lang/cellml/presentation/style.xsd new file mode 100644 index 00000000..a0181218 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/style.xsd @@ -0,0 +1,69 @@ + + + + + + + This is an XML Schema for the "mstyle" element of MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/table.xsd b/biosimulators_utils/model_lang/cellml/presentation/table.xsd new file mode 100644 index 00000000..968f7bc8 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/table.xsd @@ -0,0 +1,216 @@ + + + + + + + This is an XML Schema module for tables in MathML presentation. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/presentation/tokens.xsd b/biosimulators_utils/model_lang/cellml/presentation/tokens.xsd new file mode 100644 index 00000000..56d156c6 --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/presentation/tokens.xsd @@ -0,0 +1,124 @@ + + + + + + + This is the XML schema module for the token elements of the + presentation part of MathML. + Author: Stéphane Dalmas, INRIA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimulators_utils/model_lang/cellml/validation.py b/biosimulators_utils/model_lang/cellml/validation.py index 7907ebaf..9bb569fb 100644 --- a/biosimulators_utils/model_lang/cellml/validation.py +++ b/biosimulators_utils/model_lang/cellml/validation.py @@ -9,6 +9,7 @@ from ...config import Config, get_config # noqa: F401 import libcellml import lxml.etree +import lxml.isoschematron import os import pkg_resources @@ -138,8 +139,27 @@ def validate_model_version_1_1(filename, doc, resolve_imports=True, config=None) """ errors = [] warnings = [] + xml_file = lxml.etree.parse(filename) + schema_filename = pkg_resources.resource_filename('biosimulators_utils', + os.path.join("model_lang", "cellml", "cellml_1_1.xsd")) + print(schema_filename) + xml_schema_doc = lxml.etree.parse(schema_filename) + + schema = lxml.etree.XMLSchema(xml_schema_doc) + + + if not schema.validate(doc): + for error in schema.error_log.filter_levels([lxml.etree.ErrorLevels.ERROR, lxml.etree.ErrorLevels.FATAL]): + errors.append([ + '{}.{}: {}'.format(error.line, error.column, error.message) + ]) + + for warning in schema.error_log.filter_levels(lxml.etree.ErrorLevels.WARNING): + warnings.append([ + '{}.{}: {}'.format(warning.line, warning.column, warning.message) + ]) - warnings.append(['Validation is not available for CellML 1.1 files.']) + #warnings.append(['Validation is not available for CellML 1.1 files.']) return (errors, warnings, None) diff --git a/biosimulators_utils/model_lang/cellml/xlink-href.xsd b/biosimulators_utils/model_lang/cellml/xlink-href.xsd new file mode 100644 index 00000000..a386bc9f --- /dev/null +++ b/biosimulators_utils/model_lang/cellml/xlink-href.xsd @@ -0,0 +1,20 @@ + + + + This schema provides the XLink href attribute for use in the MathML2 + schema. Written by Max Froumentin, W3C. + + + + + + + + diff --git a/setup.py b/setup.py index 08a404a0..bffde783 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,8 @@ name: [ os.path.join('utils', 'identifiers_org.json'), os.path.join('model_lang', 'cellml', '*.rng'), + os.path.join('model_lang', 'cellml', '*.xsd'), + os.path.join('model_lang', 'cellml', '**' '*.xsd'), os.path.join('viz', 'vega', '**', '*.json'), ], }