本文整理汇总了C#中libsbmlcs.SBMLDocument.getErrorLog方法的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument.getErrorLog方法的具体用法?C# SBMLDocument.getErrorLog怎么用?C# SBMLDocument.getErrorLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.SBMLDocument
的用法示例。
在下文中一共展示了SBMLDocument.getErrorLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_internal_consistency_check_20307
public void test_internal_consistency_check_20307()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
FunctionDefinition fd = m.createFunctionDefinition();
ASTNode ast = libsbml.parseFormula("lambda(x, 2*x)");
fd.setMath(ast);
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20307 );
fd.setId("fd");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例2: test_internal_consistency_check_20421
public void test_internal_consistency_check_20421()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
UnitDefinition ud = m.createUnitDefinition();
ud.setId("ud");
Unit u = ud.createUnit();
errors = d.checkInternalConsistency();
assertTrue( errors == 4 );
assertTrue( d.getError(0).getErrorId() == 20421 );
assertTrue( d.getError(1).getErrorId() == 20421 );
assertTrue( d.getError(2).getErrorId() == 20421 );
assertTrue( d.getError(3).getErrorId() == 20421 );
u.setKind(libsbml.UNIT_KIND_MOLE);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 3 );
assertTrue( d.getError(0).getErrorId() == 20421 );
assertTrue( d.getError(1).getErrorId() == 20421 );
assertTrue( d.getError(2).getErrorId() == 20421 );
u.setExponent(1.0);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 2 );
assertTrue( d.getError(0).getErrorId() == 20421 );
assertTrue( d.getError(1).getErrorId() == 20421 );
u.setScale(0);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20421 );
u.setMultiplier(1.0);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例3: test_internal_consistency_check_20419
public void test_internal_consistency_check_20419()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
UnitDefinition ud = m.createUnitDefinition();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20419 );
ud.setId("ud");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例4: test_internal_consistency_check_21231
public void test_internal_consistency_check_21231()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Event r = m.createEvent();
r.setUseValuesFromTriggerTime(true);
ASTNode ast = libsbml.parseFormula("2*x");
Trigger t = r.createTrigger();
t.setMath(ast);
t.setPersistent(true);
t.setInitialValue(false);
EventAssignment ea = r.createEventAssignment();
ea.setVariable("ea");
ea.setMath(ast);
Priority prior = r.createPriority();
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 21231 );
prior.setMath(ast);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例5: test_internal_consistency_check_21172
public void test_internal_consistency_check_21172()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Reaction r = m.createReaction();
r.setId("r");
r.setReversible(true);
r.setFast(false);
SpeciesReference sr = r.createReactant();
sr.setSpecies("s");
sr.setConstant(true);
KineticLaw kl = r.createKineticLaw();
ASTNode ast = libsbml.parseFormula("2*x");
kl.setMath(ast);
LocalParameter lp = kl.createLocalParameter();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 21172 );
lp.setId("pp");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例6: test_internal_consistency_check_21007
public void test_internal_consistency_check_21007()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Constraint r = m.createConstraint();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 21007 );
ASTNode ast = libsbml.parseFormula("lambda(x, 2*x)");
r.setMath(ast);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例7: Main
//.........这里部分代码省略.........
sr.setStoichiometry(1);
sr.setSpecies("S");
rxn.addReactant(sr);
sr.setSpecies("D");
rxn.addProduct(sr);
mod1.addReaction(rxn);
var mod1plug = (CompModelPlugin)(mod1.getPlugin("comp"));
var port = new Port();
port.setId("S_port");
port.setIdRef("S");
mod1plug.addPort(port);
var port2 = mod1plug.createPort();
port2.setId("D_port");
port2.setIdRef("D");
port.setId("comp_port");
port.setIdRef("comp");
mod1plug.addPort(port);
port.setId("J0_port");
port.setIdRef("J0");
mod1plug.addPort(port);
// create the Model
var model = document.createModel();
model.setId("complexified");
// Set the submodels
var mplugin = (CompModelPlugin)(model.getPlugin("comp"));
var submod1 = mplugin.createSubmodel();
submod1.setId("A");
submod1.setModelRef("ExtMod1");
var submod2 = mplugin.createSubmodel();
submod2.setId("B");
submod2.setModelRef("simple");
var del = submod2.createDeletion();
del.setPortRef("J0_port");
// Synchronize the compartments
var mcomp = model.createCompartment();
mcomp.setSpatialDimensions(3);
mcomp.setConstant(true);
mcomp.setId("comp");
mcomp.setSize(1L);
var compartplug = (CompSBasePlugin)(mcomp.getPlugin("comp"));
var re = new ReplacedElement();
re.setIdRef("comp");
re.setSubmodelRef("A");
compartplug.addReplacedElement(re);
re.setSubmodelRef("B");
re.unsetIdRef();
re.setPortRef("comp_port");
compartplug.addReplacedElement(re);
//Synchronize the species
spec.setId("S");
spec.setInitialConcentration(5);
var specplug = (CompSBasePlugin)(spec.getPlugin("comp"));
var sre = specplug.createReplacedElement();
sre.setSubmodelRef("A");
sre.setIdRef("S");
var sre2 = specplug.createReplacedElement();
sre2.setSubmodelRef("B");
sre2.setPortRef("S_port");
model.addSpecies(spec);
spec.setId("D");
spec.setInitialConcentration(10);
sre.setIdRef("D");
sre2.setPortRef("D_port");
model.addSpecies(spec);
libsbml.writeSBMLToFile(document, "spec_example3.xml");
document = libsbml.readSBMLFromFile("spec_example3.xml");
if (document == null)
{
Console.WriteLine("Error reading back in file.");
retval = -1;
}
else
{
document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false);
document.checkConsistency();
if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 ||
document.getErrorLog().getNumFailsWithSeverity(3) > 0)
{
var stream = new OStringStream();
document.printErrors(stream);
Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" +
stream.str());
retval = -1;
}
libsbml.writeSBMLToFile(document, "spec_example3_rt.xml");
}
return retval;
}
示例8: test_internal_consistency_check_20805
public void test_internal_consistency_check_20805()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
InitialAssignment ia = m.createInitialAssignment();
ASTNode ast = libsbml.parseFormula("lambda(x, 2*x)");
ia.setMath(ast);
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20805 );
ia.setSymbol("fd");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例9: test_internal_consistency_check_20908
public void test_internal_consistency_check_20908()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
AssignmentRule r = m.createAssignmentRule();
ASTNode ast = libsbml.parseFormula("lambda(x, 2*x)");
r.setMath(ast);
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20908 );
r.setVariable("fd");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例10: test_internal_consistency_check_20706
public void test_internal_consistency_check_20706()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Parameter p = m.createParameter();
errors = d.checkInternalConsistency();
assertTrue( errors == 2 );
assertTrue( d.getError(0).getErrorId() == 20706 );
assertTrue( d.getError(1).getErrorId() == 20706 );
p.setId("c");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20706 );
p.setConstant(true);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例11: test_internal_consistency_check_20623
public void test_internal_consistency_check_20623()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Compartment c = m.createCompartment();
c.setId("c");
c.setConstant(true);
Species s = m.createSpecies();
errors = d.checkInternalConsistency();
assertTrue( errors == 5 );
assertTrue( d.getError(0).getErrorId() == 20623 );
assertTrue( d.getError(1).getErrorId() == 20614 );
assertTrue( d.getError(2).getErrorId() == 20623 );
assertTrue( d.getError(3).getErrorId() == 20623 );
assertTrue( d.getError(4).getErrorId() == 20623 );
s.setId("s");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 4 );
assertTrue( d.getError(0).getErrorId() == 20614 );
assertTrue( d.getError(1).getErrorId() == 20623 );
assertTrue( d.getError(2).getErrorId() == 20623 );
assertTrue( d.getError(3).getErrorId() == 20623 );
s.setCompartment("c");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 3 );
assertTrue( d.getError(0).getErrorId() == 20623 );
assertTrue( d.getError(1).getErrorId() == 20623 );
assertTrue( d.getError(2).getErrorId() == 20623 );
s.setHasOnlySubstanceUnits(true);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 2 );
assertTrue( d.getError(0).getErrorId() == 20623 );
assertTrue( d.getError(1).getErrorId() == 20623 );
s.setBoundaryCondition(true);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20623 );
s.setConstant(true);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例12: test_internal_consistency_check_20517
public void test_internal_consistency_check_20517()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Compartment c = m.createCompartment();
errors = d.checkInternalConsistency();
assertTrue( errors == 2 );
assertTrue( d.getError(0).getErrorId() == 20517 );
assertTrue( d.getError(1).getErrorId() == 20517 );
c.setId("c");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 20517 );
c.setConstant(true);
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例13: Main
private static int Main(string[] args)
{
var sbmlns = new SBMLNamespaces(3, 1, "comp", 1);
// create the document
var document = new SBMLDocument(sbmlns);
//Define the external model definitions
var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp"));
compdoc.setRequired(true);
var extmod = compdoc.createExternalModelDefinition();
extmod.setId("ExtMod1");
extmod.setSource("enzyme_model.xml");
extmod.setModelRef("enzyme");
// create the main Model
var model = document.createModel();
// Set the submodels
var mplugin = (CompModelPlugin)(model.getPlugin("comp"));
var submod1 = mplugin.createSubmodel();
submod1.setId("A");
submod1.setModelRef("ExtMod1");
var submod2 = mplugin.createSubmodel();
submod2.setId("B");
submod2.setModelRef("ExtMod1");
// create a replacement compartment
var comp = model.createCompartment();
comp.setSpatialDimensions(3);
comp.setConstant(true);
comp.setId("comp");
comp.setSize(1L);
//Tell the model that this compartment replaces both of the inside ones.
var compartplug = (CompSBasePlugin)(comp.getPlugin("comp"));
var re = new ReplacedElement();
re.setIdRef("comp");
re.setSubmodelRef("A");
compartplug.addReplacedElement(re);
re.setSubmodelRef("B");
compartplug.addReplacedElement(re);
// create a replacement species
var spec = model.createSpecies();
spec.setCompartment("comp");
spec.setHasOnlySubstanceUnits(false);
spec.setConstant(false);
spec.setBoundaryCondition(false);
spec.setId("S");
//Tell the model that this species replaces both of the inside ones.
var spp = (CompSBasePlugin)(spec.getPlugin("comp"));
re.setIdRef("S");
re.setSubmodelRef("A");
spp.addReplacedElement(re);
re.setSubmodelRef("B");
spp.addReplacedElement(re);
libsbml.writeSBMLToFile(document, "spec_example2.xml");
document = libsbml.readSBMLFromFile("spec_example2.xml");
if (document == null)
{
Console.WriteLine("Error reading back in file.");
return -1;
}
else
{
document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false);
document.checkConsistency();
if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 ||
document.getErrorLog().getNumFailsWithSeverity(3) > 0)
{
var stream = new OStringStream();
document.printErrors(stream);
Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" +
stream.str());
return -1;
}
libsbml.writeSBMLToFile(document, "spec_example2_rt.xml");
}
return 0;
}
示例14: test_internal_consistency_check_21117
public void test_internal_consistency_check_21117()
{
SBMLDocument d = new SBMLDocument(3,1);
long errors;
Model m = d.createModel();
Reaction r = m.createReaction();
r.setId("r");
r.setReversible(true);
r.setFast(false);
SpeciesReference sr = r.createReactant();
sr.setSpecies("s");
sr.setConstant(true);
ModifierSpeciesReference msr = r.createModifier();
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 1 );
assertTrue( d.getError(0).getErrorId() == 21117 );
msr.setSpecies("s");
d.getErrorLog().clearLog();
errors = d.checkInternalConsistency();
assertTrue( errors == 0 );
d = null;
}
示例15: validateExampleSBML
//===============================================================================
//
//
// Helper functions for writing/validating the given SBML documents.
//
//
//===============================================================================
/**
*
* Validates the given SBMLDocument.
*
* This function is based on validateSBML.cpp implemented by
* Sarah Keating, Ben Bornstein, and Michael Hucka.
*
*/
private static bool validateExampleSBML(SBMLDocument sbmlDoc)
{
if (sbmlDoc == null)
{
Console.Error.WriteLine("validateExampleSBML: given a null SBML Document");
return false;
}
string consistencyMessages = "";
string validationMessages = "";
bool noProblems = true;
int numCheckFailures = 0;
int numConsistencyErrors = 0;
int numConsistencyWarnings = 0;
int numValidationErrors = 0;
int numValidationWarnings = 0;
// LibSBML 3.3 is lenient when generating models from scratch using the
// API for creating objects. Once the whole model is done and before it
// gets written out, it's important to check that the whole model is in
// fact complete, consistent and valid.
numCheckFailures = (int)sbmlDoc.checkInternalConsistency();
if (numCheckFailures > 0)
{
noProblems = false;
for (int i = 0;
i < numCheckFailures;
i++)
{
SBMLError sbmlErr = sbmlDoc.getError(i);
if (sbmlErr.isFatal() || sbmlErr.isError())
{
++numConsistencyErrors;
}
else
{
++numConsistencyWarnings;
}
}
consistencyMessages = sbmlDoc.getErrorLog().toString();
}
// If the internal checks fail, it makes little sense to attempt
// further validation, because the model may be too compromised to
// be properly interpreted.
if (numConsistencyErrors > 0)
{
consistencyMessages += "Further validation aborted.";
}
else
{
numCheckFailures = (int)sbmlDoc.checkConsistency();
if (numCheckFailures > 0)
{
noProblems = false;
for (int i = 0;
i < numCheckFailures;
i++)
{
SBMLError sbmlErr = sbmlDoc.getError(i);
if (sbmlErr.isFatal() || sbmlErr.isError())
{
++numValidationErrors;
}
else
{
++numValidationWarnings;
}
}
validationMessages = sbmlDoc.getErrorLog().toString();
}
}
if (noProblems)
return true;
else
{
if (numConsistencyErrors > 0)
{
Console.WriteLine("ERROR: encountered " + numConsistencyErrors
+ " consistency error" + (numConsistencyErrors == 1 ? "" : "s")
+ " in model '" + sbmlDoc.getModel().getId() + "'.");
//.........这里部分代码省略.........