libSBML Python API
5.18.0
|
This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.
LibSBML implements facilities for verifying that a given SBML document is valid according to the SBML specifications; it also exposes the validation interface so that user programs and SBML Level 3 package authors may use the facilities to implement new validators. There are two main interfaces to libSBML's validation facilities, based on the classes Validator and SBMLValidator.
The Validator class is the basis of the system for validating an SBML document against the validation rules defined in the SBML specifications. The scheme used by Validator relies is compact and uses the visitor programming pattern, but it relies on C/C++ features and is not directly accessible from language bindings. SBMLValidator offers a framework for straightforward class-based extensibility, so that user code can subclass SBMLValidator to implement new validation systems, different validators can be introduced or turned off at run-time, and interfaces can be provided in the libSBML language bindings. SBMLValidator can call Validator functionality internally (as is the case in the current implementation of SBMLInternalValidator) or use entirely different implementation approaches, as necessary.
Users of libSBML may already be familiar with the facilities encompassed by the validation system, in the form of the consistency-checking methods defined on SBMLDocument. The methods SBMLDocument.setConsistencyChecks(), SBMLDocument.checkConsistency(), SBMLDocument.checkInternalConsistency() and other method of that sort are in fact implemented via SBMLValidator, specifically as methods on the class SBMLInternalValidator.
Authors may use SBMLValidator as the base class for their own validator extensions to libSBML. The class SBMLInternalValidator may serve as a code example for how to implement such things.
Public Member Functions | |
def | __init__ (self, args) |
This method has multiple variants; they differ in the arguments they accept. More... | |
def | clearFailures (self) |
Clears this validator's list of failures. More... | |
def | clone (self) |
Creates and returns a deep copy of this SBMLValidator object. More... | |
def | getDocument (self, args) |
Returns the current SBML document in use by this validator. More... | |
def | getErrorLog (self) |
Returns the list of errors or warnings logged during parsing, consistency checking, or attempted translation of this model. More... | |
def | getFailure (self, n) |
Returns the failure object at index n in this validator's list of failures logged during the last run. More... | |
def | getModel (self, args) |
Returns the Model object stored in the SBMLDocument. More... | |
def | getNumFailures (self) |
Returns the number of failures encountered in the last validation run. More... | |
def | logFailure (self, err) |
Adds the given failure to this list of Validators failures. More... | |
def | setDocument (self, doc) |
Sets the current SBML document to the given SBMLDocument object. More... | |
def | validate (self, args) |
This method has multiple variants; they differ in the arguments they accept. More... | |
def libsbml.SBMLValidator.__init__ | ( | self, | |
args | |||
) |
This method has multiple variants; they differ in the arguments they accept.
__init__() SBMLValidator __init__(SBMLValidator orig) SBMLValidator
Each variant is described separately below.
SBMLValidator()
Creates a new SBMLValidator.
SBMLValidator(SBMLValidator orig)
Copy constructor; creates a copy of an SBMLValidator object.
orig | the object to copy. |
def libsbml.SBMLValidator.clearFailures | ( | self | ) |
Clears this validator's list of failures.
clearFailures()
If you are validating multiple SBML documents with the same validator, call this method after you have processed the list of failures from the last validation run and before validating the next document.
def libsbml.SBMLValidator.clone | ( | self | ) |
Creates and returns a deep copy of this SBMLValidator object.
clone() SBMLValidator
def libsbml.SBMLValidator.getDocument | ( | self, | |
args | |||
) |
Returns the current SBML document in use by this validator.
getDocument() SBMLDocument
def libsbml.SBMLValidator.getErrorLog | ( | self | ) |
Returns the list of errors or warnings logged during parsing, consistency checking, or attempted translation of this model.
getErrorLog() SBMLErrorLog
Note that this refers to the SBMLDocument object's error log (i.e., the list returned by SBMLDocument.getErrorLog()). That list of errors and warnings is separate from the validation failures tracked by this validator (i.e., the list returned by getFailures()).
def libsbml.SBMLValidator.getFailure | ( | self, | |
n | |||
) |
Returns the failure object at index n in this validator's list of failures logged during the last run.
getFailure(long n) SBMLError
Callers should use getNumFailures() first, to find out the number of entries in this validator's list of failures.
n | an integer indicating the index of the object to return from the failures list; index values start at 0. |
def libsbml.SBMLValidator.getModel | ( | self, | |
args | |||
) |
Returns the Model object stored in the SBMLDocument.
getModel() Model
It is important to note that this method does not create a Model instance. The model in the SBMLDocument must have been created at some prior time, for example using SBMLDocument.createModel() or SBMLDocument.setModel(). This method returns None
if a model does not yet exist.
def libsbml.SBMLValidator.getNumFailures | ( | self | ) |
Returns the number of failures encountered in the last validation run.
getNumFailures() long
This method returns the number of failures logged by this validator. This number only reflects this validator's actions; the number may not be the same as the number of errors and warnings logged on the SBMLDocument object's error log (i.e., the object returned by SBMLDocument.getErrorLog()), because other parts of libSBML may log errors and warnings beyond those found by this validator.
def libsbml.SBMLValidator.logFailure | ( | self, | |
err | |||
) |
def libsbml.SBMLValidator.setDocument | ( | self, | |
doc | |||
) |
Sets the current SBML document to the given SBMLDocument object.
setDocument(SBMLDocument doc) int
doc | the document to use for this validation. |
def libsbml.SBMLValidator.validate | ( | self, | |
args | |||
) |
This method has multiple variants; they differ in the arguments they accept.
validate() long validate(SBMLDocument d) long validate(string filename) long
Each variant is described separately below.
validate(string filename)
Validates the SBML document located at the given filename
.
This is a convenience method that saves callers the trouble of using SBMLReader to read the document first.
filename | the path to the file to be read and validated. |
validate()
Runs this validator on the current SBML document.
validate(SBMLDocument d)
Validates the given SBMLDocument object.
This is identical to calling setDocument() followed by validate().
d | the SBML document to validate. |