SBMLDocument.h File Reference

Detailed Description

Top-level container for an SBML Model and associated data.

Author:
Ben Bornstein
Include dependency graph for SBMLDocument.h:
This graph shows which files directly or indirectly include this file:

Functions

unsigned int SBMLDocument_checkConsistency (SBMLDocument_t *d)
 Performs a set of consistency and validation checks on the given SBML document.
unsigned int SBMLDocument_checkInternalConsistency (SBMLDocument_t *d)
 Performs consistency checking on libSBML's internal representation of an SBML Model.
unsigned int SBMLDocument_checkL1Compatibility (SBMLDocument_t *d)
 Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 1 and can be converted to Level 1.
unsigned int SBMLDocument_checkL2v1Compatibility (SBMLDocument_t *d)
 Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 1 and can be converted to Level 2 Version 1.
unsigned int SBMLDocument_checkL2v2Compatibility (SBMLDocument_t *d)
 Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 2 and can be converted to Level 2 Version 2.
unsigned int SBMLDocument_checkL2v3Compatibility (SBMLDocument_t *d)
 Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 3 and can be converted to Level 2 Version 3.
unsigned int SBMLDocument_checkL2v4Compatibility (SBMLDocument_t *d)
 Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 4 and can be converted to Level 2 Version 4.
SBMLDocument_t * SBMLDocument_clone (const SBMLDocument_t *d)
 Creates and returns a deep copy of the given SBMLDocument_t structure.
SBMLDocument_t * SBMLDocument_create (void)
 Creates a new, empty SBMLDocument_t structure.
Model_t * SBMLDocument_createModel (SBMLDocument_t *d)
 Creates a new Model_t structure inside the given SBMLDocument_t structure and returns a pointer to it.
SBMLDocument_t * SBMLDocument_createWithLevelAndVersion (unsigned int level, unsigned int version)
 Creates a new, empty SBMLDocument_t structure with given values for the SBML Level and Version.
SBMLDocument_t * SBMLDocument_createWithSBMLNamespaces (SBMLNamespaces_t *sbmlns)
int SBMLDocument_expandFunctionDefintions (SBMLDocument_t *d)
 Removes any FunctionDefinitions from the document and expands any instances of their use within <math> elements.
int SBMLDocument_expandInitialAssignments (SBMLDocument_t *d)
 Removes any InitialAssignments from the document and replaces the appropriate values.
void SBMLDocument_free (SBMLDocument_t *d)
 Frees the given SBMLDocument_t structure.
unsigned int SBMLDocument_getDefaultLevel (void)
unsigned int SBMLDocument_getDefaultVersion (void)
const SBMLError_t * SBMLDocument_getError (SBMLDocument_t *d, unsigned int n)
 Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model.
unsigned int SBMLDocument_getLevel (const SBMLDocument_t *d)
 Returns the SBML Level of the given SBMLDocument_t structure.
Model_t * SBMLDocument_getModel (SBMLDocument_t *d)
 Returns the Model object stored in this SBMLDocument_t structure.
const XMLNamespaces_t * SBMLDocument_getNamespaces (SBMLDocument_t *d)
 Returns a list of XMLNamespaces_t associated with the XML content of this SBML document.
unsigned int SBMLDocument_getNumErrors (const SBMLDocument_t *d)
 Returns the number of errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.
int SBMLDocument_getPackageRequired (SBMLDocument_t *d, const char *package)
int SBMLDocument_getPkgRequired (SBMLDocument_t *d, const char *package)
unsigned int SBMLDocument_getVersion (const SBMLDocument_t *d)
 Returns the Version within the SBML Level of the given SBMLDocument_t structure.
int SBMLDocument_isSetPackageRequired (SBMLDocument_t *d, const char *package)
int SBMLDocument_isSetPkgRequired (SBMLDocument_t *d, const char *package)
void SBMLDocument_printErrors (SBMLDocument_t *d, FILE *stream)
 Prints to the given output stream all the errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.
void SBMLDocument_setConsistencyChecks (SBMLDocument_t *d, int validator, int apply)
void SBMLDocument_setConsistencyChecksForConversion (SBMLDocument_t *d, int validator, int apply)
int SBMLDocument_setLevelAndVersion (SBMLDocument_t *d, unsigned int level, unsigned int version)
 Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.
int SBMLDocument_setLevelAndVersionNonStrict (SBMLDocument_t *d, unsigned int level, unsigned int version)
 Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.
int SBMLDocument_setLevelAndVersionStrict (SBMLDocument_t *d, unsigned int level, unsigned int version)
 Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.
int SBMLDocument_setModel (SBMLDocument_t *d, const Model_t *m)
 Sets the model contained in the given SBMLDocument_t structure to a copy of the given Model_t structure.
int SBMLDocument_setPackageRequired (SBMLDocument_t *d, const char *package, int flag)
int SBMLDocument_setPkgRequired (SBMLDocument_t *d, const char *package, int flag)
int SBMLDocument_setSBMLNamespaces (SBMLDocument_t *d, SBMLNamespaces_t *sbmlns)

Function Documentation

unsigned int SBMLDocument_checkConsistency ( SBMLDocument_t *  d)

Performs a set of consistency and validation checks on the given SBML document.

If this method returns a nonzero value (meaning, one or more consistency checks have failed for SBML document), the failures may be due to warnings or errors. Callers should inspect the severity flag in the individual SBMLError objects returned by getError() to determine the nature of the failures.

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
unsigned int SBMLDocument_checkInternalConsistency ( SBMLDocument_t *  d)

Performs consistency checking on libSBML's internal representation of an SBML Model.

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
Note:
The consistency checks performed by this function are limited to inconsistencies that are not caught by other consistency checks.
See also:
setConsistencyChecks()
unsigned int SBMLDocument_checkL1Compatibility ( SBMLDocument_t *  d)

Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 1 and can be converted to Level 1.

Callers should query the results of the consistency check by calling getError().

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
unsigned int SBMLDocument_checkL2v1Compatibility ( SBMLDocument_t *  d)

Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 1 and can be converted to Level 2 Version 1.

Callers should query the results of the consistency check by calling getError().

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
unsigned int SBMLDocument_checkL2v2Compatibility ( SBMLDocument_t *  d)

Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 2 and can be converted to Level 2 Version 2.

Callers should query the results of the consistency check by calling getError().

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
unsigned int SBMLDocument_checkL2v3Compatibility ( SBMLDocument_t *  d)

Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 3 and can be converted to Level 2 Version 3.

Callers should query the results of the consistency check by calling getError().

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
unsigned int SBMLDocument_checkL2v4Compatibility ( SBMLDocument_t *  d)

Performs a set of consistency checks on the document to establish whether it is compatible with SBML Level 2 Version 4 and can be converted to Level 2 Version 4.

Callers should query the results of the consistency check by calling getError().

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of failed checks (errors) encountered.
SBMLDocument_t* SBMLDocument_clone ( const SBMLDocument_t *  d)

Creates and returns a deep copy of the given SBMLDocument_t structure.

Parameters:
dthe SBMLDocument_t structure
Returns:
a (deep) copy of the SBMLDocument_t structure
SBMLDocument_t* SBMLDocument_create ( void  )

Creates a new, empty SBMLDocument_t structure.

The SBML Level and Version attributes default to the most recent SBML specification (at the time this libSBML was released).

Returns:
the SBMLDocument_t structure created
Model_t* SBMLDocument_createModel ( SBMLDocument_t *  d)

Creates a new Model_t structure inside the given SBMLDocument_t structure and returns a pointer to it.

Parameters:
dthe SBMLDocument_t structure
Returns:
the Model_t structure created
SBMLDocument_t* SBMLDocument_createWithLevelAndVersion ( unsigned int  level,
unsigned int  version 
)

Creates a new, empty SBMLDocument_t structure with given values for the SBML Level and Version.

If not specified, the SBML Level and Version attributes default to the most recent SBML specification (at the time this libSBML was released).

Parameters:
levelan integer for the SBML Level
versionan integer for the Version within the SBML Level
Returns:
the SBMLDocument_t structure created
SBMLDocument_t* SBMLDocument_createWithSBMLNamespaces ( SBMLNamespaces_t *  sbmlns)
int SBMLDocument_expandFunctionDefintions ( SBMLDocument_t *  d)

Removes any FunctionDefinitions from the document and expands any instances of their use within <math> elements.

For example a Model contains a FunctionDefinition with id f representing the math expression: f(x, y) = x * y. The math element of the KineticLaw uses f(s, p). The outcome of the function is that the math of the KineticLaw now represents the math expression: s * p and the model no longer contains any FunctionDefinitions.

Parameters:
dthe SBMLDocument_t structure
Returns:
true (non-zero) if the transformation was successful, false (0) otherwise.
Note:
This function will check the consistency of a model before attemptimg the transformation. In the case of a model with invalid SBML the transformation will not be done and the function will return .
int SBMLDocument_expandInitialAssignments ( SBMLDocument_t *  d)

Removes any InitialAssignments from the document and replaces the appropriate values.

For example a Model contains a InitialAssignment with symbol k where k is the id of a Parameter. The outcome of the function is that the value attribute of the Parameter is the value calculated using the math expression of the InitialAssignment and the corresponding InitialAssignment has been removed from the Model.

Parameters:
dthe SBMLDocument_t structure
Returns:
true (non-zero) if the transformation was successful, false (0) otherwise.
Note:
This function will check the consistency of a model before attemptimg the transformation. In the case of a model with invalid SBML the transformation will not be done and the function will return . As part of the process the function will check that it has values for any components referred to by the math elements of InitialAssignments. In the case where not all values have been declared the particular InitialAssignment will not be removed and the function will return .
void SBMLDocument_free ( SBMLDocument_t *  d)

Frees the given SBMLDocument_t structure.

Parameters:
dthe SBMLDocument_t structure
unsigned int SBMLDocument_getDefaultLevel ( void  )
Returns:
the most recent SBML specification level (at the time this libSBML was released).
unsigned int SBMLDocument_getDefaultVersion ( void  )
Returns:
the most recent SBML specification version (at the time this libSBML was released).
const SBMLError_t* SBMLDocument_getError ( SBMLDocument_t *  d,
unsigned int  n 
)

Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model.

Callers can use method XMLError_getSeverity() on the result to assess the severity of the problem. The severity levels range from informationl messages to fatal errors.

Returns:
the error or warning indexed by integer n, or return NULL if n > (SBMLDocument_getNumErrors() - 1).
Parameters:
dthe SBMLDocument_t structure
nthe index of the error sought.
See also:
SBMLDocument_getNumErrors(), SBMLDocument_setLevelAndVersion(), SBMLDocument_checkConsistency(), SBMLDocument_checkL1Compatibility(), SBMLDocument_checkL2v1Compatibility() SBMLDocument_checkL2v2Compatibility(), SBMLReader_readSBML(), SBMLReader_readSBMLFromString().
unsigned int SBMLDocument_getLevel ( const SBMLDocument_t *  d)

Returns the SBML Level of the given SBMLDocument_t structure.

Parameters:
dthe SBMLDocument_t structure
Returns:
the SBML Level number
Model_t* SBMLDocument_getModel ( SBMLDocument_t *  d)

Returns the Model object stored in this SBMLDocument_t structure.

Parameters:
dthe SBMLDocument_t structure
Returns:
the Model contained in this SBMLDocument_t structure.
const XMLNamespaces_t* SBMLDocument_getNamespaces ( SBMLDocument_t *  d)

Returns a list of XMLNamespaces_t associated with the XML content of this SBML document.

Parameters:
dthe SBMLDocument_t structure
Returns:
pointer to the XMLNamespaces_t structure associated with this SBML object
unsigned int SBMLDocument_getNumErrors ( const SBMLDocument_t *  d)

Returns the number of errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.

Parameters:
dthe SBMLDocument_t structure
Returns:
the number of errors or warnings encountered
See also:
SBMLDocument_setLevelAndVersion(), SBMLDocument_checkConsistency(), SBMLDocument_checkL1Compatibility(), SBMLDocument_checkL2v1Compatibility() SBMLDocument_checkL2v2Compatibility(), SBMLReader_readSBML(), SBMLReader_readSBMLFromString().
int SBMLDocument_getPackageRequired ( SBMLDocument_t *  d,
const char *  package 
)
int SBMLDocument_getPkgRequired ( SBMLDocument_t *  d,
const char *  package 
)
unsigned int SBMLDocument_getVersion ( const SBMLDocument_t *  d)

Returns the Version within the SBML Level of the given SBMLDocument_t structure.

Parameters:
dthe SBMLDocument_t structure
Returns:
the version number
int SBMLDocument_isSetPackageRequired ( SBMLDocument_t *  d,
const char *  package 
)
int SBMLDocument_isSetPkgRequired ( SBMLDocument_t *  d,
const char *  package 
)
void SBMLDocument_printErrors ( SBMLDocument_t *  d,
FILE *  stream 
)

Prints to the given output stream all the errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.

If no errors have occurred, i.e., SBMLDocument_getNumErrors() == 0, no output will be sent to the stream.

The format of the output is:

N error(s): line NNN: (id) message

Parameters:
dthe SBMLDocument_t structure
streamthe output stream where the messages should be printed
void SBMLDocument_setConsistencyChecks ( SBMLDocument_t *  d,
int  validator,
int  apply 
)
void SBMLDocument_setConsistencyChecksForConversion ( SBMLDocument_t *  d,
int  validator,
int  apply 
)
int SBMLDocument_setLevelAndVersion ( SBMLDocument_t *  d,
unsigned int  level,
unsigned int  version 
)

Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.

This method is used to convert models between Levels and Versions of SBML. Generally, models can be converted upward without difficulty (e.g., from SBML Level 1 to Level 2, or from an earlier version of Level 2 to the latest version of Level 2). Sometimes models can be translated downward as well, if they do not use constructs specific to more advanced Levels of SBML.

Callers can also check compatibility directly using the methods checkL1Compatibility(), checkL2v1Compatibility(), and checkL2v2Compatibility().

The valid combinations as of this release of libSBML are the following:

  • Level 1 Version 1
  • Level 1 Version 2
  • Level 2 Version 1
  • Level 2 Version 2
  • Level 2 Version 3
  • Level 2 Version 4
Parameters:
dthe SBMLDocument_t structure
levelthe desired SBML Level
versionthe desired Version within the SBML Level
Note:
Calling this method will not necessarily lead to successful conversion. If the conversion fails, it will be logged in the error list associated with this SBMLDocument_t structure. Callers should consult getNumErrors() to find out if the conversion succeeded without problems. For conversions from Level 2 to Level 1, callers can also check the Level of the model after calling this method to find out whether it is Level 1. (If the conversion to Level 1 failed, the Level of this model will be left unchanged.)
int SBMLDocument_setLevelAndVersionNonStrict ( SBMLDocument_t *  d,
unsigned int  level,
unsigned int  version 
)

Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.

This method is used to convert models between Levels and Versions of SBML. Generally, models can be converted upward without difficulty (e.g., from SBML Level 1 to Level 2, or from an earlier version of Level 2 to the latest version of Level 2). Sometimes models can be translated downward as well, if they do not use constructs specific to more advanced Levels of SBML.

Callers can also check compatibility directly using the methods checkL1Compatibility(), checkL2v1Compatibility(), and checkL2v2Compatibility().

The valid combinations as of this release of libSBML are the following:

  • Level 1 Version 1
  • Level 1 Version 2
  • Level 2 Version 1
  • Level 2 Version 2
  • Level 2 Version 3
  • Level 2 Version 4
Parameters:
dthe SBMLDocument_t structure
levelthe desired SBML Level
versionthe desired Version within the SBML Level
Note:
Calling this method will not necessarily lead to successful conversion. If the conversion fails, it will be logged in the error list associated with this SBMLDocument_t structure. Callers should consult getNumErrors() to find out if the conversion succeeded without problems. For conversions from Level 2 to Level 1, callers can also check the Level of the model after calling this method to find out whether it is Level 1. (If the conversion to Level 1 failed, the Level of this model will be left unchanged.)
int SBMLDocument_setLevelAndVersionStrict ( SBMLDocument_t *  d,
unsigned int  level,
unsigned int  version 
)

Sets the SBML Level and Version of this SBMLDocument, attempting to convert the model as needed.

This method is used to convert models between Levels and Versions of SBML. Generally, models can be converted upward without difficulty (e.g., from SBML Level 1 to Level 2, or from an earlier version of Level 2 to the latest version of Level 2). Sometimes models can be translated downward as well, if they do not use constructs specific to more advanced Levels of SBML.

Callers can also check compatibility directly using the methods checkL1Compatibility(), checkL2v1Compatibility(), and checkL2v2Compatibility().

The valid combinations as of this release of libSBML are the following:

  • Level 1 Version 1
  • Level 1 Version 2
  • Level 2 Version 1
  • Level 2 Version 2
  • Level 2 Version 3
  • Level 2 Version 4
Parameters:
dthe SBMLDocument_t structure
levelthe desired SBML Level
versionthe desired Version within the SBML Level
Note:
Calling this method will not necessarily lead to successful conversion. If the conversion fails, it will be logged in the error list associated with this SBMLDocument_t structure. Callers should consult getNumErrors() to find out if the conversion succeeded without problems. For conversions from Level 2 to Level 1, callers can also check the Level of the model after calling this method to find out whether it is Level 1. (If the conversion to Level 1 failed, the Level of this model will be left unchanged.)

Strict conversion applies the additional criteria that both the source and the target model must be consistent SBML. Users can control the consistency checks that are applied using the SBMLDocument::setConsistencyChecks function. If either the source or the potential target model have validation errors, the conversion is not performed. When a strict conversion is successful, the underlying SBML object model is altered to reflect the new level and version. Thus information that cannot be converted (e.g. sboTerms) will be lost.

int SBMLDocument_setModel ( SBMLDocument_t *  d,
const Model_t *  m 
)

Sets the model contained in the given SBMLDocument_t structure to a copy of the given Model_t structure.

Parameters:
dthe SBMLDocument_t structure
mthe new Model_t structure to use.
Returns:
integer value indicating success/failure of the function. The value is drawn from the enumeration #OperationReturnValues_t.The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_LEVEL_MISMATCH
  • LIBSBML_VERSION_MISMATCH
int SBMLDocument_setPackageRequired ( SBMLDocument_t *  d,
const char *  package,
int  flag 
)
int SBMLDocument_setPkgRequired ( SBMLDocument_t *  d,
const char *  package,
int  flag 
)
int SBMLDocument_setSBMLNamespaces ( SBMLDocument_t *  d,
SBMLNamespaces_t *  sbmlns 
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines