MathSBML

MathSBML Home Page MathSBML Site Map

SBMLValidate


SBMLValidate[file, format] uses the online validator to check an SBML model.

SBMLValidate[file] is equivalent to SBMLValidate[file,"xml"]

SBMLValidate new in version 2.5.10


The validator is described in more detail at the sbml online tools page. The mathematica interface is provided using J/Link and a Java Wrapper that calls the online tool. If internet access is not available SBMLValidate will not work.

format="text" means return text format.

format="xml" means return symbolicXML format.

Example

Consider the following sbml model foo.xml:

<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2" level="2" version="1">
  <model id="compartments_transportReaction">
    <listOfCompartments>
      <compartment id="c1" size="0.1"/>
      <compartment id="c2" size="10"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="S1" compartment="c1" initialConcentration="1"/>
      <specys id="S2" compartment="c2" initialConcentration="0"/>
    </listOfSpecies>
    <listOfReactions>
      <reaction id="r" reversible="false">
        <listOfReactants>
          <speciesReference species="S1"/>
        </listOfReactant>
        <listOfProducts>
          <speciesReference species="S2"/>
        </listOfProducts>
        <kineticLaw>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <times/>
              <ci> k </ci>
              <ci> S1 </ci>
            </apply>
          </math>
          <listOfParameters>
            <parameter id="k" value="0.1"/>
          </listOfParameters>
        </kineticLaw>
      </reaction>
    </listOfReactions>
  </model>
</sbml>

        
SBMLValidate["foo.xml", "text"]

will return

foo.xml:10: error: Unknown element 'specys'
foo.xml:10: error: Attribute 'id' is not declared for element 'specys'
foo.xml:10: error: Attribute 'compartment' is not declared for element 'specys'
foo.xml:10: error: Attribute 'initialConcentration' is not declared for element 'specys'
foo.xml:11: error: Element 'specys' is not valid for content model: '(notes,annotation,species,)'
foo.xml:16: fatal: Expected end of tag 'listOfReactants'        
   
SBMLValidate["foo.xml", "text"]

will return Symbolic SBML for the xml shown in the following example.

XMLOut[SBMLValidate["foo.xml", "text"]]

will return

<?xml version="1.0" encoding="UTF-8"?>
<validation-results>
 <file filename="sbmlbug.xml"/>
 <error category="http://apache.org/xml/messages/XMLValidity"
     code="2"
     severity="2">
  <location line="10"
      column="66"/>
  <message lang="en_US">Unknown element 'specys'</message>
  <excerpt><specys id="S2" compartment="c2" initialConcentration="0"/></excerpt>
 </error>
 <error category="http://apache.org/xml/messages/XMLValidity"
     code="17"
     severity="2">
  <location line="10"
      column="66"/>
  <message lang="en_US">Attribute 'id' is not declared for element 'specys'</message>
  <excerpt><specys id="S2" compartment="c2" initialConcentration="0"/></excerpt>
 </error>
 <error category="http://apache.org/xml/messages/XMLValidity"
     code="17"
     severity="2">
  <location line="10"
      column="66"/>
  <message lang="en_US">Attribute 'compartment' is not declared for element 'specys'</message>
  <excerpt><specys id="S2" compartment="c2" initialConcentration="0"/></excerpt>
 </error>
 <error category="http://apache.org/xml/messages/XMLValidity"
     code="17"
     severity="2">
  <location line="10"
      column="66"/>
  <message lang="en_US">Attribute 'initialConcentration' is not declared for element 'specys'</message>
  <excerpt><specys id="S2" compartment="c2" initialConcentration="0"/></excerpt>
 </error>
 <error category="http://apache.org/xml/messages/XMLValidity"
     code="7"
     severity="2">
  <location line="11"
      column="21"/>
  <message lang="en_US">Element 'specys' is not valid for content model: '(notes,annotation,species,)'</message>
  <excerpt></listOfSpecies></excerpt>
 </error>
 <error category="http://apache.org/xml/messages/XMLErrors"
     code="202"
     severity="3">
  <location line="16"
      column="11"/>
  <message lang="en_US">Expected end of tag 'listOfReactants'</message>
  <excerpt></listOfReactant></excerpt>
 </error>
</validation-results>