getNumErrors() публичный Метод

public getNumErrors ( ) : long
Результат long
 public void test_SBMLDocument_createWith()
 {
     SBMLDocument d = new  SBMLDocument(1,2);
       assertTrue( d.getTypeCode() == libsbml.SBML_DOCUMENT );
       assertTrue( d.getNotes() == null );
       assertTrue( d.getAnnotation() == null );
       assertTrue( d.getLevel() == 1 );
       assertTrue( d.getVersion() == 2 );
       assertTrue( d.getNumErrors() == 0 );
       d = null;
 }
Пример #2
0
 public void test_WriteL3SBML_error()
 {
     SBMLDocument d = new SBMLDocument();
       SBMLWriter w = new SBMLWriter();
       assertEquals( false, w.writeSBML(d, "/tmp/impossible/path/should/fail") );
       assertTrue( d.getNumErrors() == 1 );
       assertTrue( d.getError(0).getErrorId() == libsbml.XMLFileUnwritable );
       d = null;
       w = null;
 }
Пример #3
0
 public void test_ReadSBML_notes_sbml()
 {
     string s = wrapXML("<sbml level='1' version='1'>" +
     "  <notes>Notes are not allowed as part of the SBML element.</notes>" +
     "</sbml>");
       D = libsbml.readSBMLFromString(s);
       assertTrue( D.getNotes() != null );
       string notes = D.getNotes().getChild(0).getCharacters();
       assertTrue( (  "Notes are not allowed as part of the SBML element." != notes ) == false );
       assertTrue( D.getNumErrors() > 0 );
 }
Пример #4
0
 public void test_ReadSBML_invalid_default_namespace()
 {
     string valid = wrapXML("<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" level=\"2\" version=\"4\"> " +
     "   <model>" +
     "     <notes>" +
     "       <p xmlns=\"http://www.w3.org/1999/xhtml\">Some text.</p>" +
     "     </notes>" +
     "     <annotation>" +
     "       <example xmlns=\"http://www.example.org/\"/>" +
     "     </annotation>" +
     "     <listOfCompartments>" +
     "       <compartment id=\"compartmentOne\" size=\"1\"/>" +
     "     </listOfCompartments>" +
     "     <listOfSpecies>" +
     "       <species id=\"S1\" initialConcentration=\"1\" compartment=\"compartmentOne\"/>" +
     "       <species id=\"S2\" initialConcentration=\"0\" compartment=\"compartmentOne\"/>" +
     "     </listOfSpecies>" +
     "     <listOfParameters>" +
     "       <parameter id=\"t\" value = \"1\" units=\"second\"/>" +
     "     </listOfParameters>" +
     "     <listOfConstraints>" +
     "       <constraint sboTerm=\"SBO:0000064\">" +
     "         <math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
     "           <apply>" +
     "             <leq/>" +
     "             <ci> S1 </ci>" +
     "             <ci> t </ci>" +
     "           </apply>" +
     "         </math>" +
     "         <message>" +
     "           <p xmlns=\"http://www.w3.org/1999/xhtml\"> Species S1 is out of range </p>" +
     "         </message>" +
     "       </constraint>" +
     "     </listOfConstraints>" +
     "     <listOfReactions>" +
     "       <reaction id=\"reaction_1\" reversible=\"false\">" +
     "           <listOfReactants>" +
     "             <speciesReference species=\"S1\"/>" +
     "           </listOfReactants>" +
     "           <listOfProducts>" +
     "             <speciesReference species=\"S2\">" +
     "             </speciesReference>" +
     "           </listOfProducts>" +
     "       </reaction>" +
     "     </listOfReactions>" +
     "   </model>" +
     " </sbml>");
       string invalid = wrapXML("<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" level=\"2\" version=\"4\"> " +
     "   <model xmlns=\"http://invalid/custom/default/uri\">" +
     "     <notes xmlns=\"http://invalid/custom/default/uri/in/notes\">" +
     "       <p xmlns=\"http://www.w3.org/1999/xhtml\">Some text.</p>" +
     "     </notes>" +
     "     <annotation xmlns=\"http://invalid/custom/default/uri/in/annotation\">" +
     "       <example xmlns=\"http://www.example.org/\"/>" +
     "     </annotation>" +
     "     <listOfCompartments>" +
     "       <compartment id=\"compartmentOne\" size=\"1\"/>" +
     "     </listOfCompartments>" +
     "     <listOfSpecies>" +
     "       <notes xmlns=\"http://invalid/custom/default/uri/in/notes\">" +
     "         <p xmlns=\"http://www.w3.org/1999/xhtml\">Some text.</p>" +
     "       </notes>" +
     "       <annotation xmlns=\"http://invalid/custom/default/uri/in/annotation\">" +
     "         <example xmlns=\"http://www.example.org/\"/>" +
     "       </annotation>" +
     "       <species id=\"S1\" initialConcentration=\"1\" compartment=\"compartmentOne\"/>" +
     "       <species id=\"S2\" initialConcentration=\"0\" compartment=\"compartmentOne\"/>" +
     "     </listOfSpecies>" +
     "     <listOfParameters>" +
     "       <parameter id=\"t\" value = \"1\" units=\"second\"/>" +
     "     </listOfParameters>" +
     "     <listOfConstraints>" +
     "       <constraint sboTerm=\"SBO:0000064\">" +
     "         <math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
     "           <apply>" +
     "             <leq/>" +
     "             <ci> S1 </ci>" +
     "             <ci> t </ci>" +
     "           </apply>" +
     "         </math>" +
     "         <message xmlns=\"http://invalid/custom/default/uri/in/message\">" +
     "           <p xmlns=\"http://www.w3.org/1999/xhtml\"> Species S1 is out of range </p>" +
     "         </message>" +
     "       </constraint>" +
     "     </listOfConstraints>" +
     "     <listOfReactions>" +
     "       <reaction id=\"reaction_1\" reversible=\"false\">" +
     "           <listOfReactants>" +
     "             <speciesReference xmlns=\"http://invalid/custom/default/uri\" species=\"S1\"/>" +
     "           </listOfReactants>" +
     "           <listOfProducts>" +
     "             <speciesReference species=\"S2\">" +
     "               <notes xmlns=\"http://invalid/custom/default/uri/in/notes\">" +
     "                 <p xmlns=\"http://www.w3.org/1999/xhtml\">Some text.</p>" +
     "               </notes>" +
     "               <annotation xmlns=\"http://invalid/custom/default/uri/in/annotation\">" +
     "                 <example xmlns=\"http://www.example.org/\"/>" +
     "               </annotation>" +
     "             </speciesReference>" +
     "           </listOfProducts>" +
     "       </reaction>" +
     "     </listOfReactions>" +
     "   </model>" +
     " </sbml>");
       D = libsbml.readSBMLFromString(valid);
       assertTrue( D.getNumErrors() == 0 );
       D = null;
       D = libsbml.readSBMLFromString(invalid);
       assertTrue( D.getNumErrors() == 9 );
 }
Пример #5
0
 public void test_ReadSBML_FunctionDefinition_OnlyBVars()
 {
     FunctionDefinition fd;
       SBMLError error;
       int numErrors;
       ASTNode math;
       string formula;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
     "  <functionDefinition id='invalid'>" +
     "    <math xmlns='http://www.w3.org/1998/Math/MathML'>" +
     "      <lambda>" +
     "        <bvar><ci> x </ci></bvar>" +
     "        <bvar><ci> y </ci></bvar>" +
     "        <bvar><ci> z </ci></bvar>" +
     "      </lambda>" +
     "    </math>" +
     "  </functionDefinition>" +
     "</listOfFunctionDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       D.checkInternalConsistency();
       D.checkConsistency();
       numErrors = (int)D.getNumErrors();
       assertTrue( numErrors == 1 );
       error = D.getError(0);
       int errorId = (int)error.getErrorId();
       assertTrue( errorId == libsbml.NoBodyInFunctionDef );
       assertTrue( M.getNumFunctionDefinitions() == 1 );
       fd = M.getFunctionDefinition(0);
       assertTrue( fd != null );
       assertEquals( true, fd.isSetId() );
       assertEquals( false, fd.isSetName() );
       assertTrue((  "invalid"   == fd.getId() ));
       assertTrue( fd.getBody() == null );
       assertEquals( true, fd.isSetMath() );
       math = fd.getMath();
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, y, z)" == formula ));
 }
Пример #6
0
 public void test_ReadSBML_annotation_sbml_L2()
 {
     string s = wrapXML("<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\"> " +
     "  <annotation>" +
     "    <rdf xmlns=\"http://www.w3.org/1999/anything\">" +
     "		 </rdf>" +
     "	  </annotation>" +
     "	  <model>" +
     "   </model>" +
     " </sbml>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( D.getNumErrors() == 0 );
 }
Пример #7
0
 public void test_ReadSBML_annotation_sbml()
 {
     string s = wrapXML("<sbml level=\"1\" version=\"1\">" +
     "  <annotation xmlns:jd = \"http://www.sys-bio.org/sbml\">" +
     "    <jd:header>" +
     "      <VersionHeader SBMLVersion = \"1.0\"/>" +
     "    </jd:header>" +
     "    <jd:display>" +
     "      <SBMLGraphicsHeader BackGroundColor = \"15728639\"/>" +
     "    </jd:display>" +
     "  </annotation>" +
     "</sbml>");
       D = libsbml.readSBMLFromString(s);
       assertTrue( D.getNumErrors() > 0 );
 }
Пример #8
0
 public void test_ReadSBML_notes_sbml_L2()
 {
     string s = wrapXML("<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\"> " +
     "  <notes>" +
     "    <html xmlns=\"http://www.w3.org/1999/xhtml\">" +
     "		 </html>" +
     "	  </notes>" +
     "	  <model>" +
     "   </model>" +
     " </sbml>");
       D = libsbml.readSBMLFromString(s);
       assertTrue( D.getNotes() != null );
       assertTrue( D.getNumErrors() == 0 );
 }