SBML.org — the global portal for all things SBML

Enhancement of internal consistency checking

Overview

In libSBML through version 3, it's possible to create an internal representation of an SBML model that is invalid, yet will not cause checkConsistency() to return errors. The underlying reason is that certain features are not checked by checkConsistency(), but instead are assumed to have been checked at different points elsewhere in libSBML, or by the XML parser. Creating an in-memory model may not lead to those checks being performed. To help catch these additional cases, we have added an additional validation method.

Example of the issue

The following code is used to create an L1V2 model with one compartment:

SBMLDocument * doc = new SBMLDocument();
doc->setLevelAndVersion(1, 2);
Model *m       = doc->createModel();
Compartment *c = m->createCompartment();

Further code then sets the spatial dimensions of the compartment to 2 and then checks the consistency of the document.

c->setSpatialDimensions(2);

int n = doc->checkConsistency();

The value of n returned is "0", i.e., no errors. This occurs because the document contains an L1V2 model and the attribute spatialDimensions is not defined in the SBML L1V2 specification. As a result, consistency checks relating to spatialDimensions will not be performed on compartment c.

Solution

LibSBML defines a new validator (internally called InternalConsistencyValidator), which will run checks on the internal consistency of the model and report errors that are not detected by checkConsistency().

API

A new method on the SBMLDocument class,

unsigned int checkInternalConsistency();

initializes the InternalConsistencyValidator and performs the checks on the current document. Errors are logged in the SBMLErrorLog object associated with the SBMLdocument instance, and returns the number of errors. The SBMLErrorLog can then be queried using existing methods.

Retrieved from "http://sbml.org/SBML_Projects/libSBML/Development/Enhancement_of_internal_consistency_checking"

This page was last modified 23:54, 15 March 2009.



Please use our issue tracking system for any questions or suggestions about this website. This page was last modified 23:54, 15 March 2009.