libSBML Python API  5.18.0
libsbml.UnitDefinition Class Reference
Inheritance diagram for libsbml.UnitDefinition:
[legend]

Detailed Description

A definition of a unit used in an SBML model.

Units of measurement may be supplied in a number of contexts in an SBML model. The SBML unit definition facility uses two classes of objects, UnitDefinition and Unit. The approach to defining units in SBML is compositional; for example, meter second –2 is constructed by combining a Unit object representing meter with another Unit object representing second –2. The combination is wrapped inside a UnitDefinition, which provides for assigning an identifier and optional name to the combination. The identifier can then be referenced from elsewhere in a model. Thus, the UnitDefinition class is the container, and Unit instances are placed inside UnitDefinition instances.

Two points are worth discussing in the context of SBML units. First, unit declarations in SBML models are optional. The consequence of this is that a model must be numerically self-consistent independently of unit declarations, for the benefit of software tools that cannot interpret or manipulate units. Unit declarations in SBML are thus more akin to a type of annotation; they can indicate intentions, and can be used by model readers for checking the consistency of the model, labeling simulation output, etc., but any transformations of values implied by different units must be incorporated explicitly into a model.

Second, the vast majority of situations that require new SBML unit definitions involve simple multiplicative combinations of base units and factors. An example is moles per litre per second. What distinguishes these sorts of unit definitions from more complex ones is that they may be expressed without the use of an additive offset from a zero point. The use of offsets complicates all unit definition systems, yet in the domain of SBML, the real-life cases requiring offsets are few (and in fact, to the best of our knowledge, only involve temperature). Consequently, the SBML unit system has been consciously designed to simplify implementation of unit support for the most common cases in systems biology. The cost of this simplification is to require units with offsets to be handled explicitly by the modeler.

Summary of the UnitDefinition construct

UnitDefinition has two attributes and one subelement. The two attributes are 'id' and 'name', and the subelement is ListOfUnits.

The required attribute 'id' and optional attribute 'name' are both strings. The 'id' attribute is used to give the defined unit a unique identifier by which other parts of an SBML model definition can refer to it. The 'name' attribute is intended to be used for giving the unit definition an optional human-readable name. Please see the next section for information about the values permitted for 'id'.

A UnitDefinition may contain exactly one ListOfUnits, and this list may contain one or more Unit definitions; see the definitions of these other object classes for more information about them. In SBML Level 2 and SBML Level 3 Version 1, if the ListOfUnits was present, it must have one or more Unit definitions. In SBML Level 3 Version 2, this restriction was relaxed, and a ListOfUnits was allowed to be empty. In either case, if a UnitDefinition had no child Unit elements, the unit was considered to be undefined.

The following example illustrates a complete unit definition (when written in XML) when all the pieces are combined together. This defines 'mmls' to be millimoles per litre per second.

 <listOfUnitDefinitions>
     <unitDefinition id='mmls'>
         <listOfUnits>
             <unit kind='mole'   scale='-3'/>
             <unit kind='litre'  exponent='-1'/>
             <unit kind='second' exponent='-1'/>
         </listOfUnits>
     </unitDefinition>
 </listOfUnitDefinitions>

Special considerations for Unit object identifiers

The attribute 'id' in UnitDefinition cannot be given simply any value, and the precise details of the values permitted differ slightly between Levels of SBML:

  • The 'id' of a UnitDefinition must not contain a value from the list of SBML's predefined base unit names (i.e., the strings gram, litre, etc.). In SBML Level 3, this list consists of the following:

    amperefaradjouleluxradianvolt
    avogadrogramkatalmetresecondwatt
    becquerelgraykelvinmolesiemensweber
    candelahenrykilogramnewtonsievert
    coulombhertzlitreohmsteradian
    dimensionlessitemlumenpascaltesla

    This list of predefined base units is nearly identical in SBML Level 2 Version 4, the exception being that Level 2 does not define avogadro. SBML Level 2 Version 1 (and only this Level+Version combination) provides an additional predefined unit name, Celsius, not available in Level 3. Finally, SBML Level 1 Versions 2–3 provide two more additional predefined unit names, meter and liter. This is explained in somewhat greater detail in the description of the Unit class.

    • In SBML Level 2 (all Versions), there is an additional set of reserved identifiers: substance, volume, area, length, and time. Using one of these values for the attribute 'id' of a UnitDefinition has the effect of redefining the model-wide default units for the corresponding quantities. The list of special unit names in SBML Level 2 is given in the table below:
    Identifier Possible scalable units Default units
    substancemole, item, gram, kilogram, dimensionlessmole
    volumelitre, cubic metre, dimensionlesslitre
    areasquare metre, dimensionlesssquare metre
    lengthmetre, dimensionlessmetre
    timesecond, dimensionlesssecond

    Also, SBML Level 2 imposes two limitations on redefining the predefined unit substance, volume, area, length, and time: (1) The UnitDefinition of a predefined SBML unit can only contain a single Unit object within it. (2) The value of the 'kind' attribute in a Unit instance must be drawn from one of the values in the second column of the table above.

    The special unit names substance, volume, area, length, and time are not defined by SBML Level 3, which uses a different approach to setting model-wide inherited units.

Further comments about SBML's unit definition system

The vast majority of modeling situations requiring new SBML unit definitions involve simple multiplicative combinations of base units and factors. An example of this might be moles per litre per second. What distinguishes these sorts of simpler unit definitions from more complex ones is that they may be expressed without the use of an additive offset from a zero point. The use of offsets complicates all unit definition systems, yet in the domain of SBML the real-life cases requiring offsets are few (and in fact, to the best of our knowledge, only involve temperature). Consequently, the SBML unit system has been consciously designed in a way that attempts to simplify implementation of unit support for the most common cases in systems biology.

As of SBML Level 2 Version 2, Unit no longer has the attribute called 'offset' introduced in SBML Level 2 Version 1. It turned out that the general case involving units with offsets was incorrectly defined, and few (if any) developers even attempted to support offset-based units in their software. In the development of Level 2 Version 2, a consensus among SBML developers emerged that a fully generalized unit scheme is so confusing and complicated that it actually impedes interoperability. SBML Level 2 Version 2, Version 3 and Version 4 acknowledge this reality by reducing and simplifying the unit system, specifically by removing the 'offset' attribute on Unit and Celsius as a pre-defined unit.

The following guidelines suggest methods for handling units that do require the use of zero offsets for their definitions:

  • Handling Celsius. A model in which certain quantities are temperatures measured in degrees Celsius can be converted straightforwardly to a model in which those temperatures are in kelvin. A software tool could do this by performing a straightforward substitution using the following relationship: T kelvin = TCelsius + 273.15. In every mathematical formula of the model where a quantity (call it x) in degrees Celsius appears, replace x with xk+ 273.15, where xk is now in kelvin. An alternative approach would be to use a FunctionDefinition object to define a function encapsulating this relationship above and then using that in the rest of the model as needed. Since Celsius is a commonly-used unit, software tools could help users by providing users with the ability to express temperatures in Celsius in the tools' interfaces, and making substitutions automatically when writing out the SBML.

  • Other units requiring offsets. One approach to handling other kinds of units is to use a FunctionDefinition to define a function encapsulating the necessary mathematical relationship, then substituting a call to this function wherever the original quantity appeared in the model. For example, here is a possible definition for converting Fahrenheit to Celsius degrees:

     <functionDefinition id='Fahrenheit_to_kelvin'>
         <math xmlns='http://www.w3.org/1998/Math/MathML'>
             <lambda>
                 <bvar><ci> temp_in_fahrenheit </ci></bvar>
                 <apply>
                     <divide/>
                     <apply>
                         <plus/>
                         <ci> temp_in_fahrenheit </ci>
                         <cn> 459.67 </cn>
                     </apply>
                     <cn> 1.8 </cn>
                 </apply>
             </lambda>
         </math>
     </functionDefinition>

  • An alternative approach not requiring the use of function definitions is to use an AssignmentRule for each variable in Fahrenheit units. The AssignmentRule could compute the conversion from Fahrenheit to (say) kelvin, assign its value to a variable (in Kelvin units), and then that variable could be used elsewhere in the model.

  • Still another approach is to rewrite the mathematical formulas of a model to directly incorporate the conversion formula wherever the original quantity appeared.

Please consult the SBML specifications for more information about this and other issues involving units.

Public Member Functions

def __init__ (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def addCVTerm (self, term, newBag=False)
 Adds a copy of the given CVTerm object to this SBML object. More...
 
def addUnit (self, u)
 Adds a copy of the given Unit to this UnitDefinition. More...
 
def appendAnnotation (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def appendNotes (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def areEquivalent (ud1, ud2)
 Predicate returning True if two UnitDefinition objects are equivalent. More...
 
def areIdentical (ud1, ud2)
 Predicate returning True if two UnitDefinition objects are identical. More...
 
def clone (self)
 Creates and returns a deep copy of this UnitDefinition object. More...
 
def combine (ud1, ud2)
 Combines two UnitDefinition objects into a single UnitDefinition. More...
 
def connectToChild (self)
 
def convertToSI (ud)
 Convert a given UnitDefinition into a new UnitDefinition object that uses SI units. More...
 
def createUnit (self)
 Creates a new and empty Unit, adds it to this UnitDefinition's list of units, and returns it. More...
 
def deleteDisabledPlugins (self, recursive=True)
 Deletes all information stored in disabled plugins. More...
 
def disablePackage (self, pkgURI, pkgPrefix)
 Disables the given SBML Level 3 package on this object. More...
 
def divide (ud1, ud2)
 Combines two UnitDefinition objects into a single UnitDefinition as a division. More...
 
def enablePackage (self, pkgURI, pkgPrefix, flag)
 Enables or disables the given SBML Level 3 package on this object. More...
 
def getAncestorOfType (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def getAnnotation (self, args)
 Returns the content of the 'annotation' subelement of this object as a tree of XMLNode objects. More...
 
def getAnnotationString (self, args)
 Returns the content of the 'annotation' subelement of this object as a character string. More...
 
def getColumn (self)
 Returns the column number where this object first appears in the XML representation of the SBML document. More...
 
def getCVTerm (self, n)
 Returns the nth CVTerm in the list of CVTerms of this SBML object. More...
 
def getCVTerms (self, args)
 Returns a list of CVTerm objects in the annotations of this SBML object. More...
 
def getDisabledPlugin (self, args)
 Returns the nth disabled plug-in object (extension interface) for an SBML Level 3 package extension. More...
 
def getElementByMetaId (self, metaid)
 Returns the first child element it can find with the given metaid, or None if no such object is found. More...
 
def getElementBySId (self, id)
 Returns the first child element found that has the given id in the model-wide SId namespace, or None if no such object is found. More...
 
def getElementName (self)
 Returns the XML element name of this object, which for UnitDefinition, is always 'unitDefinition'. More...
 
def getId (self)
 Returns the value of the 'id' attribute of this UnitDefinition. More...
 
def getIdAttribute (self)
 Returns the value of the 'id' attribute of this SBML object. More...
 
def getLevel (self)
 Returns the SBML Level of the SBMLDocument object containing this object. More...
 
def getLine (self)
 Returns the line number where this object first appears in the XML representation of the SBML document. More...
 
def getListOfAllElements (self, filter=None)
 Returns an SBaseList of all child SBase objects, including those nested to an arbitrary depth. More...
 
def getListOfAllElementsFromPlugins (self, filter=None)
 Returns a List of all child SBase objects contained in SBML package plug-ins. More...
 
def getListOfUnits (self, args)
 Returns the list of Units for this UnitDefinition instance. More...
 
def getMetaId (self)
 Returns the value of the 'metaid' attribute of this SBML object. More...
 
def getModel (self)
 Returns the Model object for the SBML Document in which the current object is located. More...
 
def getModelHistory (self, args)
 Returns the ModelHistory object, if any, attached to this object. More...
 
def getName (self)
 Returns the value of the 'name' attribute of this UnitDefinition object. More...
 
def getNamespaces (self)
 Returns a list of the XML Namespaces declared on the SBML document owning this object. More...
 
def getNotes (self, args)
 Returns the content of the 'notes' subelement of this object as a tree of XMLNode objects. More...
 
def getNotesString (self, args)
 Returns the content of the 'notes' subelement of this object as a string. More...
 
def getNumCVTerms (self)
 Returns the number of CVTerm objects in the annotations of this SBML object. More...
 
def getNumDisabledPlugins (self)
 Returns the number of disabled plug-in objects (extension interfaces) for SBML Level 3 package extensions known. More...
 
def getNumPlugins (self)
 Returns the number of plug-in objects (extenstion interfaces) for SBML Level 3 package extensions known. More...
 
def getNumUnits (self)
 Returns the number of Unit objects contained within this UnitDefinition. More...
 
def getPackageCoreVersion (self)
 Returns the SBML Core Version within the SBML Level of the actual object. More...
 
def getPackageName (self)
 Returns the name of the SBML Level 3 package in which this element is defined. More...
 
def getPackageVersion (self)
 Returns the Version of the SBML Level 3 package to which this element belongs to. More...
 
def getParentSBMLObject (self, args)
 Returns the parent SBML object containing this object. More...
 
def getPlugin (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def getPrefix (self)
 Returns the XML namespace prefix of this element. More...
 
def getResourceBiologicalQualifier (self, resource)
 Returns the MIRIAM biological qualifier associated with the given resource. More...
 
def getResourceModelQualifier (self, resource)
 Returns the MIRIAM model qualifier associated with the given resource. More...
 
def getSBMLDocument (self, args)
 Returns the SBMLDocument object containing this object instance. More...
 
def getSBOTerm (self)
 Returns the integer portion of the value of the 'sboTerm' attribute of this object. More...
 
def getSBOTermAsURL (self)
 Returns the URL representation of the 'sboTerm' attribute of this object. More...
 
def getSBOTermID (self)
 Returns the string representation of the 'sboTerm' attribute of this object. More...
 
def getTypeCode (self)
 Returns the libSBML type code for this object instance. More...
 
def getUnit (self, args)
 Returns a specific Unit instance belonging to this UnitDefinition. More...
 
def getURI (self)
 Gets the namespace URI to which this element belongs to. More...
 
def getVersion (self)
 Returns the Version within the SBML Level of the SBMLDocument object containing this object. More...
 
def hasRequiredAttributes (self)
 Predicate returning True if all the required attributes for this UnitDefinition object have been set. More...
 
def hasRequiredElements (self)
 Predicate returning True if all the required elements for this UnitDefinition object have been set. More...
 
def hasValidLevelVersionNamespaceCombination (self)
 Predicate returning true if this object's level/version and namespace values correspond to a valid SBML specification. More...
 
def isPackageEnabled (self, pkgName)
 Predicate returning True if the given SBML Level 3 package is enabled with this object. More...
 
def isPackageURIEnabled (self, pkgURI)
 Predicate returning True if an SBML Level 3 package with the given URI is enabled with this object. More...
 
def isPkgEnabled (self, pkgName)
 Predicate returning True if the given SBML Level 3 package is enabled with this object. More...
 
def isPkgURIEnabled (self, pkgURI)
 Predicate returning True if an SBML Level 3 package with the given URI is enabled with this object. More...
 
def isSetAnnotation (self)
 Predicate returning True if this object's 'annotation' subelement exists and has content. More...
 
def isSetId (self)
 Predicate returning True if this UnitDefinition's 'id' attribute is set. More...
 
def isSetIdAttribute (self)
 Predicate returning True if this object's 'id' attribute is set. More...
 
def isSetMetaId (self)
 Predicate returning True if this object's 'metaid' attribute is set. More...
 
def isSetModelHistory (self)
 Predicate returning True if this object has a ModelHistory object attached to it. More...
 
def isSetName (self)
 Predicate returning True if this UnitDefinition's 'name' attribute is set. More...
 
def isSetNotes (self)
 Predicate returning True if this object's 'notes' subelement exists and has content. More...
 
def isSetSBOTerm (self)
 Predicate returning True if this object's 'sboTerm' attribute is set. More...
 
def isSetUserData (self)
 Predicate returning true or false depending on whether the user data of this element has been set. More...
 
def isVariantOfArea (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'area'. More...
 
def isVariantOfDimensionless (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the unit 'dimensionless'. More...
 
def isVariantOfLength (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'length'. More...
 
def isVariantOfMass (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'mass'. More...
 
def isVariantOfSubstance (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'substance'. More...
 
def isVariantOfSubstancePerTime (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit 'substance' divided by the predefined unit 'time'. More...
 
def isVariantOfTime (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'time'. More...
 
def isVariantOfVolume (self, relaxed=False)
 Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'volume'. More...
 
def matchesRequiredSBMLNamespacesForAddition (self, args)
 Returns True if this object's set of XML namespaces are a subset of the given object's XML namespaces. More...
 
def matchesSBMLNamespaces (self, args)
 Returns True if this object's set of XML namespaces are the same as the given object's XML namespaces. More...
 
def printUnits (ud, compact=False)
 Expresses the given definition in a plain-text form. More...
 
def removeFromParentAndDelete (self)
 Removes this object from its parent. More...
 
def removeTopLevelAnnotationElement (self, args)
 Removes the top-level element within the 'annotation' subelement of this SBML object with the given name and optional URI. More...
 
def removeUnit (self, n)
 Removes the nth Unit object from this UnitDefinition object and returns a pointer to it. More...
 
def renameMetaIdRefs (self, oldid, newid)
 Replaces all uses of a given meta identifier attribute value with another value. More...
 
def renameSIdRefs (self, oldid, newid)
 Replaces all uses of a given SIdRef type attribute value with another value. More...
 
def renameUnitSIdRefs (self, oldid, newid)
 Replaces all uses of a given UnitSIdRef type attribute value with another value. More...
 
def reorder (ud)
 Alphabetically orders the Unit objects within the ListOfUnits of a UnitDefinition. More...
 
def replaceTopLevelAnnotationElement (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def setAnnotation (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def setId (self, sid)
 Sets the value of the 'id' attribute of this UnitDefinition. More...
 
def setIdAttribute (self, sid)
 Sets the value of the 'id' attribute of this SBML object. More...
 
def setMetaId (self, metaid)
 Sets the value of the meta-identifier attribute of this SBML object. More...
 
def setModelHistory (self, history)
 Sets the ModelHistory of this object. More...
 
def setName (self, name)
 Sets the value of the 'name' attribute of this UnitDefinition. More...
 
def setNamespaces (self, xmlns)
 Sets the namespaces relevant of this SBML object. More...
 
def setNotes (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def setSBOTerm (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def simplify (ud)
 Simplifies the UnitDefinition such that any given kind of Unit object occurs only once in the ListOfUnits. More...
 
def toSBML (self)
 Returns a string consisting of a partial SBML corresponding to just this object. More...
 
def toXMLNode (self)
 Returns this element as an XMLNode. More...
 
def unsetAnnotation (self)
 Unsets the value of the 'annotation' subelement of this SBML object. More...
 
def unsetCVTerms (self)
 Clears the list of CVTerm objects attached to this SBML object. More...
 
def unsetId (self)
 Unsets the value of the 'id' attribute of this SBML object. More...
 
def unsetIdAttribute (self)
 Unsets the value of the 'id' attribute of this SBML object. More...
 
def unsetMetaId (self)
 Unsets the value of the 'metaid' attribute of this SBML object. More...
 
def unsetModelHistory (self)
 Unsets the ModelHistory object attached to this object. More...
 
def unsetName (self)
 Unsets the value of the 'name' attribute of this UnitDefinition. More...
 
def unsetNotes (self)
 Unsets the value of the 'notes' subelement of this SBML object. More...
 
def unsetSBOTerm (self)
 Unsets the value of the 'sboTerm' attribute of this SBML object. More...
 
def unsetUserData (self)
 Unsets the user data of this element. More...
 

Constructor & Destructor Documentation

def libsbml.UnitDefinition.__init__ (   self,
  args 
)

This method has multiple variants; they differ in the arguments they accept.

__init__(long  level, long  version)   UnitDefinition
__init__(SBMLNamespaces sbmlns)   UnitDefinition
__init__(UnitDefinition orig)   UnitDefinition

Each variant is described separately below.


Method variant with the following signature:
UnitDefinition(SBMLNamespaces sbmlns)

Creates a new UnitDefinition using the given SBMLNamespaces object sbmlns.

The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core. A common approach to using libSBML's SBMLNamespaces facilities is to create an SBMLNamespaces object somewhere in a program once, then hand that object as needed to object constructors that accept SBMLNamespaces as arguments.
Parameters
sbmlnsan SBMLNamespaces object.
Exceptions
ValueErrorThrown if the given sbmlns is inconsistent or incompatible with this object.
Note
Attempting to add an object to an SBMLDocument having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute.

Method variant with the following signature:
UnitDefinition(long level, long version)

Creates a new UnitDefinition using the given SBML level and version values.

Parameters
levela long integer, the SBML Level to assign to this UnitDefinition.
versiona long integer, the SBML Version to assign to this UnitDefinition.
Exceptions
ValueErrorThrown if the given level and version combination are invalid or if this object is incompatible with the given level and version.
Note
Attempting to add an object to an SBMLDocument having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute.

Method variant with the following signature:
UnitDefinition(UnitDefinition orig)

Copy constructor; creates a copy of this UnitDefinition.

Parameters
origthe object to copy.

Member Function Documentation

def libsbml.SBase.addCVTerm (   self,
  term,
  newBag = False 
)
inherited

Adds a copy of the given CVTerm object to this SBML object.

addCVTerm(CVTerm term, bool newBag)   int
addCVTerm(CVTerm term)   int
Parameters
termthe CVTerm to assign.
newBagif True, creates a new RDF bag with the same identifier as a previous bag, and if False, adds the term to an existing RDF bag with the same type of qualifier as the term being added.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
Note
Since the CV Term uses the 'metaid' attribute of the object as a reference, if the object has no 'metaid' attribute value set, then the CVTerm will not be added.
This method should be used with some caution. The fact that this method copies the object passed to it means that the caller will be left holding a physically different object instance than the one contained inside this object. Changes made to the original object instance (such as resetting attribute values) will not affect the instance in this object. In addition, the caller should make sure to free the original object if it is no longer being used, or else a memory leak will result. Please see other methods on this class (particularly a corresponding method whose name begins with the word create) for alternatives that do not lead to these issues.
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.addUnit (   self,
  u 
)

Adds a copy of the given Unit to this UnitDefinition.

addUnit(Unit u)   int
Parameters
uthe Unit instance to add to this UnitDefinition.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
Note
This method should be used with some caution. The fact that this method copies the object passed to it means that the caller will be left holding a physically different object instance than the one contained inside this object. Changes made to the original object instance (such as resetting attribute values) will not affect the instance in this object. In addition, the caller should make sure to free the original object if it is no longer being used, or else a memory leak will result. Please see other methods on this class (particularly a corresponding method whose name begins with the word create) for alternatives that do not lead to these issues.
See also
createUnit()
def libsbml.SBase.appendAnnotation (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

appendAnnotation(XMLNode annotation)   int
appendAnnotation(string annotation)   int

Each variant is described separately below.


Method variant with the following signature:
appendAnnotation(XMLNode annotation)

Appends the given annotation to the 'annotation' subelement of this object.

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Unlike SBase.setAnnotation() or SBase.setAnnotation(), this method allows other annotations to be preserved when an application adds its own data.

Parameters
annotationan XML structure that is to be copied and appended to the content of the 'annotation' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getAnnotationString()
isSetAnnotation()
setAnnotation()
setAnnotation()
appendAnnotation()
unsetAnnotation()

Method variant with the following signature:
appendAnnotation(string annotation)

Appends the given annotation to the 'annotation' subelement of this object.

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Unlike SBase.setAnnotation() or SBase.setAnnotation(), this method allows other annotations to be preserved when an application adds its own data.

Parameters
annotationan XML string that is to be copied and appended to the content of the 'annotation' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getAnnotationString()
isSetAnnotation()
setAnnotation()
setAnnotation()
appendAnnotation()
unsetAnnotation()
def libsbml.SBase.appendNotes (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

appendNotes(XMLNode notes)   int
appendNotes(string notes)   int

Each variant is described separately below.


Method variant with the following signature:
appendNotes(string notes)

Appends the given notes to the 'notes' subelement of this object.

The content of the parameter notes is copied.

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

Parameters
notesan XML string that is to appended to the content of the 'notes' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getNotesString()
isSetNotes()
setNotes()
setNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()

Method variant with the following signature:
appendNotes(XMLNode notes)

Appends the given notes to the 'notes' subelement of this object.

The content of notes is copied.

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

Parameters
notesan XML node structure that is to appended to the content of the 'notes' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getNotesString()
isSetNotes()
setNotes()
setNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.UnitDefinition.areEquivalent (   ud1,
  ud2 
)

Predicate returning True if two UnitDefinition objects are equivalent.

areEquivalent(UnitDefinition ud1, UnitDefinition ud2)   bool

For the purposes of performing this comparison, two UnitDefinition objects are considered equivalent when they contain equivalent list of Unit objects. Unit objects are in turn considered equivalent if they satisfy the predicate Unit.areEquivalent(). The predicate tests a subset of the objects's attributes.

Parameters
ud1the first UnitDefinition object to compare.
ud2the second UnitDefinition object to compare.
Returns
True if all the Unit objects in ud1 are equivalent to the Unit objects in ud2, False otherwise.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
See also
UnitDefinition.areIdentical()
Unit.areEquivalent()
def libsbml.UnitDefinition.areIdentical (   ud1,
  ud2 
)

Predicate returning True if two UnitDefinition objects are identical.

areIdentical(UnitDefinition ud1, UnitDefinition ud2)   bool

For the purposes of performing this comparison, two UnitDefinition objects are considered identical when they contain identical lists of Unit objects. Pairs of Unit objects in the lists are in turn considered identical if they satisfy the predicate Unit.areIdentical(). The predicate compares every attribute of the Unit objects.

Parameters
ud1the first UnitDefinition object to compare.
ud2the second UnitDefinition object to compare.
Returns
True if all the Unit objects in ud1 are identical to the Unit objects of ud2, False otherwise.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
See also
UnitDefinition.areEquivalent()
Unit.areIdentical()
def libsbml.UnitDefinition.clone (   self)

Creates and returns a deep copy of this UnitDefinition object.

clone()   UnitDefinition
Returns
the (deep) copy of this UnitDefinition object.
def libsbml.UnitDefinition.combine (   ud1,
  ud2 
)

Combines two UnitDefinition objects into a single UnitDefinition.

combine(UnitDefinition ud1, UnitDefinition ud2)   UnitDefinition

This takes UnitDefinition objects ud1 and ud2, and creates a UnitDefinition object that expresses the product of the units of ud1 and ud2.

Parameters
ud1the first UnitDefinition object.
ud2the second UnitDefinition object.
Returns
a UnitDefinition which represents the product of the units of the two argument UnitDefinitions.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
def libsbml.UnitDefinition.connectToChild (   self)
connectToChild()
def libsbml.UnitDefinition.convertToSI (   ud)

Convert a given UnitDefinition into a new UnitDefinition object that uses SI units.

convertToSI(UnitDefinition ud)   UnitDefinition
Parameters
udthe UnitDefinition object to convert to SI.
Returns
a new UnitDefinition object representing the results of the conversion.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
def libsbml.UnitDefinition.createUnit (   self)

Creates a new and empty Unit, adds it to this UnitDefinition's list of units, and returns it.

createUnit()   Unit
Returns
a newly constructed (and empty) Unit instance.
Note
It is worth emphasizing that the attribute 'kind' value of a Unit is a required attribute for a valid Unit definition. The createUnit() method does not assign a valid kind to the constructed unit (instead, it sets the 'kind' to UNIT_KIND_INVALID). Callers are cautioned to set the newly-constructed Unit's kind using Unit.setKind() soon after calling this method.
See also
addUnit()
def libsbml.SBase.deleteDisabledPlugins (   self,
  recursive = True 
)
inherited

Deletes all information stored in disabled plugins.

deleteDisabledPlugins(bool recursive)
deleteDisabledPlugins()

If the plugin is re-enabled later, it will then not have any previously-stored information.

SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
If a plugin is disabled, the package information it contains is no longer considered to be part of the SBML document for the purposes of searching the document or writing out the document. However, the information is still retained, so if the plugin is enabled again, the same information will once again be available, and will be written out to the final model.
Parameters
recursiveif True, the disabled information will be deleted also from all child elements, otherwise only from this SBase element.
See also
getNumDisabledPlugins()
def libsbml.SBase.disablePackage (   self,
  pkgURI,
  pkgPrefix 
)
inherited

Disables the given SBML Level 3 package on this object.

disablePackage(string pkgURI, string pkgPrefix)   int

This method disables the specified package on this object and other objects connected by child-parent links in the same SBMLDocument object.

An example of when this may be useful is during construction of model components when mixing existing and new models. Suppose your application read an SBML document containing a model that used the SBML Hierarchical Model Composition (“comp”) package, and extracted parts of that model in order to construct a new model in memory. The new, in-memory model will not accept a component drawn from an other SBMLDocument with different package namespace declarations. You could reconstruct the same namespaces in the in-memory model first, but as a shortcut, you could also disable the package namespace on the object being added. Here is a code example to help clarify this:

1 import sys
2 import os.path
3 from libsbml import *
4 
5 # We read an SBML L3V1 model that uses the 'comp' package.
6 
7 doc = readSBML('sbml-file-with-comp-elements.xml');
8 if doc.getNumErrors() > 0:
9  print('readSBML encountered errors while reading the file.')
10  doc.printErrors()
11  sys.exit(1)
12 
13 # We extract one of the species from the model.
14 
15 model = doc.getModel()
16 if model == None:
17  print('Unable to retrieve Model object')
18  sys.exit(1)
19 
20 s1 = model.getSpecies(0)
21 if s1 == None:
22  print('Unable to retrieve Species object')
23  sys.exit(1)
24 
25 # We construct a new model.
26 # This model does not use the 'comp' package.
27 
28 try:
29  newDoc = SBMLDocument(3, 1)
30 except ValueError:
31  print('Could not create SBMLDocument object')
32  sys.exit(1)
33 
34 newModel = newDoc.createModel()
35 if newModel == None:
36  print('Unable to create new Model object')
37  sys.exit(1)
38 
39 # The following would normally fail with an error, because
40 # addSpecies() would first check that the parent of the given
41 # object has namespaces declared, and will discover that s1
42 # does but newModel does not.
43 
44 # newModel.addSpecies(s1)
45 
46 # However, if we disable the 'comp' package on s1, then the
47 # call to addSpecies will work.
48 
49 compNS = 'http://www.sbml.org/sbml/level3/version1/comp/version1'
50 status = s1.disablePackage(compNS, 'comp')
51 if status != LIBSBML_OPERATION_SUCCESS:
52  print('Unable to disable package.')
53  sys.exit(1)
54 
55 newSpecies = newModel.addSpecies(s1) # This will work now.
56 if newSpecies == None:
57  print('Could not add Species') # (This will not happen,
58  sys.exit(1) # but always check errors.)
Parameters
pkgURIthe URI of the package.
pkgPrefixthe XML prefix of the package.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
enablePackage()
def libsbml.UnitDefinition.divide (   ud1,
  ud2 
)

Combines two UnitDefinition objects into a single UnitDefinition as a division.

divide(UnitDefinition ud1, UnitDefinition ud2)   UnitDefinition

This takes UnitDefinition objects ud1 and ud2, and creates a UnitDefinition object that expresses the division of the units of ud1 and ud2.

Parameters
ud1the first UnitDefinition object.
ud2the second UnitDefinition object.
Returns
a UnitDefinition which represents the division of the units of the two argument UnitDefinitions.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
def libsbml.SBase.enablePackage (   self,
  pkgURI,
  pkgPrefix,
  flag 
)
inherited

Enables or disables the given SBML Level 3 package on this object.

enablePackage(string pkgURI, string pkgPrefix, bool flag)   int

This method enables the specified package on this object and other objects connected by child-parent links in the same SBMLDocument object. This method is the converse of SBase.disablePackage().

Parameters
pkgURIthe URI of the package.
pkgPrefixthe XML prefix of the package.
flagwhether to enable (True) or disable (False) the package.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
disablePackage()
def libsbml.SBase.getAncestorOfType (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

getAncestorOfType(int type, string pkgName)   SBase
getAncestorOfType(int type)   SBase

Each variant is described separately below.


Method variant with the following signature:
getAncestorOfType(int type, string pkgName = 'core')

Returns the first ancestor object that has the given SBML type code from the given package.

LibSBML attaches an identifying code to every kind of SBML object. These are known as SBML type codes. In the Python language interface for libSBML, the type codes are defined as static integer constants in the interface class libsbml. The names of the type codes all begin with the characters SBML_.

This method searches the tree of objects that are parents of this object, and returns the first one that has the given SBML type code from the given pkgName.

Parameters
typethe SBML type code of the object sought.
pkgName(optional) the short name of an SBML Level 3 package to which the sought-after object must belong.
Returns
the ancestor SBML object of this SBML object that corresponds to the given SBML object type code, or None if no ancestor exists.
Warning
The optional argument pkgName must be used for all type codes from SBML Level 3 packages. Otherwise, the function will search the 'core' namespace alone, not find any corresponding elements, and return None.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.

Method variant with the following signature:
getAncestorOfType(int type, string pkgName = 'core')

Returns the first ancestor object that has the given SBML type code from the given package.

LibSBML attaches an identifying code to every kind of SBML object. These are known as SBML type codes. In the Python language interface for libSBML, the type codes are defined as static integer constants in the interface class libsbml. The names of the type codes all begin with the characters SBML_.

This method searches the tree of objects that are parents of this object, and returns the first one that has the given SBML type code from the given pkgName.

Parameters
typethe SBML type code of the object sought.
pkgName(optional) the short name of an SBML Level 3 package to which the sought-after object must belong.
Returns
the ancestor SBML object of this SBML object that corresponds to the given SBML object type code, or None if no ancestor exists.
Warning
The optional argument pkgName must be used for all type codes from SBML Level 3 packages. Otherwise, the function will search the 'core' namespace alone, not find any corresponding elements, and return None.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.SBase.getAnnotation (   self,
  args 
)
inherited

Returns the content of the 'annotation' subelement of this object as a tree of XMLNode objects.

getAnnotation()   XMLNode
Whereas the SBML 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

The annotations returned by this method will be in XML form. LibSBML provides an object model and related interfaces for certain specific kinds of annotations, namely model history information and RDF content. See the ModelHistory, CVTerm and RDFAnnotationParser classes for more information about the facilities available.

Returns
the annotation of this SBML object as a tree of XMLNode objects.
See also
getAnnotationString()
isSetAnnotation()
setAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
unsetAnnotation()
def libsbml.SBase.getAnnotationString (   self,
  args 
)
inherited

Returns the content of the 'annotation' subelement of this object as a character string.

getAnnotationString()   string
Whereas the SBML 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

The annotations returned by this method will be in string form. See the method getAnnotation() for a version that returns annotations in XML form.

Returns
the annotation of this SBML object as a character string.
See also
getAnnotation()
isSetAnnotation()
setAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
unsetAnnotation()
def libsbml.SBase.getColumn (   self)
inherited

Returns the column number where this object first appears in the XML representation of the SBML document.

getColumn()   long
Returns
the column number of this SBML object. If this object was created programmatically and not read from a file, this method will return the value 0.
Note
The column number for each construct in an SBML model is set upon reading the model. The accuracy of the column number depends on the correctness of the XML representation of the model, and on the particular XML parser library being used. The former limitation relates to the following problem: if the model is actually invalid XML, then the parser may not be able to interpret the data correctly and consequently may not be able to establish the real column number. The latter limitation is simply that different parsers seem to have their own accuracy limitations, and out of all the parsers supported by libSBML, none have been 100% accurate in all situations. (At this time, libSBML supports the use of libxml2, Expat and Xerces.)
See also
getLine()
def libsbml.SBase.getCVTerm (   self,
  n 
)
inherited

Returns the nth CVTerm in the list of CVTerms of this SBML object.

getCVTerm(long  n)   CVTerm
Parameters
nlong the index of the CVTerm to retrieve.
Returns
the nth CVTerm in the list of CVTerms for this SBML object. If the index n is invalid, None is returned.
def libsbml.SBase.getCVTerms (   self,
  args 
)
inherited

Returns a list of CVTerm objects in the annotations of this SBML object.

getCVTerms()   List *
Returns
the list of CVTerms for this SBML object.
def libsbml.SBase.getDisabledPlugin (   self,
  args 
)
inherited

Returns the nth disabled plug-in object (extension interface) for an SBML Level 3 package extension.

getDisabledPlugin(long  n)   SBasePlugin

If no such plugin exists, None is returned.

SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
If a plugin is disabled, the package information it contains is no longer considered to be part of the SBML document for the purposes of searching the document or writing out the document. However, the information is still retained, so if the plugin is enabled again, the same information will once again be available, and will be written out to the final model.
Parameters
nthe index of the disabled plug-in to return.
Returns
the nth disabled plug-in object (the libSBML extension interface) of a package extension. If the index n is invalid, None is returned.
See also
getNumDisabledPlugins()
getPlugin()
def libsbml.UnitDefinition.getElementByMetaId (   self,
  metaid 
)

Returns the first child element it can find with the given metaid, or None if no such object is found.

getElementByMetaId(string metaid)   SBase
Parameters
metaidstring representing the metaid of the object to find.
Returns
pointer to the first element found with the given metaid.
def libsbml.UnitDefinition.getElementBySId (   self,
  id 
)

Returns the first child element found that has the given id in the model-wide SId namespace, or None if no such object is found.

getElementBySId(string id)   SBase
Parameters
idstring representing the id of the object to find.
Returns
pointer to the first element found with the given id.
def libsbml.UnitDefinition.getElementName (   self)

Returns the XML element name of this object, which for UnitDefinition, is always 'unitDefinition'.

getElementName()   string
Returns
the name of this element, i.e., 'unitDefinition'.
def libsbml.UnitDefinition.getId (   self)

Returns the value of the 'id' attribute of this UnitDefinition.

getId()   string
Note
Because of the inconsistent behavior of this function with respect to assignments and rules, it is now recommended to use the getIdAttribute() function instead.
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Returns
the id of this UnitDefinition.
See also
getIdAttribute()
setIdAttribute()
isSetIdAttribute()
unsetIdAttribute()
def libsbml.SBase.getIdAttribute (   self)
inherited

Returns the value of the 'id' attribute of this SBML object.

getIdAttribute()   string
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Returns
the id of this SBML object, if set and valid for this level and version of SBML; an empty string otherwise.
Note
Because of the inconsistent behavior of this function with respect to assignments and rules, callers should use getIdAttribute() instead.
See also
setIdAttribute()
isSetIdAttribute()
unsetIdAttribute()
def libsbml.SBase.getLevel (   self)
inherited

Returns the SBML Level of the SBMLDocument object containing this object.

getLevel()   long
LibSBML uses the class SBMLDocument as a top-level container for storing SBML content and data associated with it (such as warnings and error messages). An SBML model in libSBML is contained inside an SBMLDocument object. SBMLDocument corresponds roughly to the class SBML defined in the SBML Level 3 and Level 2 specifications, but it does not have a direct correspondence in SBML Level 1. (But, it is created by libSBML no matter whether the model is Level 1, Level 2 or Level 3.)
Returns
the SBML level of this SBML object.
See also
getVersion()
getNamespaces()
getPackageVersion()
def libsbml.SBase.getLine (   self)
inherited

Returns the line number where this object first appears in the XML representation of the SBML document.

getLine()   long
Returns
the line number of this SBML object. If this object was created programmatically and not read from a file, this method will return the value 0.
Note
The line number for each construct in an SBML model is set upon reading the model. The accuracy of the line number depends on the correctness of the XML representation of the model, and on the particular XML parser library being used. The former limitation relates to the following problem: if the model is actually invalid XML, then the parser may not be able to interpret the data correctly and consequently may not be able to establish the real line number. The latter limitation is simply that different parsers seem to have their own accuracy limitations, and out of all the parsers supported by libSBML, none have been 100% accurate in all situations. (At this time, libSBML supports the use of libxml2, Expat and Xerces.)
See also
getColumn()
def libsbml.SBase.getListOfAllElements (   self,
  filter = None 
)
inherited

Returns an SBaseList of all child SBase objects, including those nested to an arbitrary depth.

getListOfAllElements(ElementFilter filter)   SBaseList
getListOfAllElements()   SBaseList
Returns
a list of all objects that are children of this object.
def libsbml.SBase.getListOfAllElementsFromPlugins (   self,
  filter = None 
)
inherited

Returns a List of all child SBase objects contained in SBML package plug-ins.

getListOfAllElementsFromPlugins(ElementFilter filter)   SBaseList
getListOfAllElementsFromPlugins()   SBaseList
SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.

This method walks down the list of all SBML Level 3 packages used by this object and returns all child objects defined by those packages.

Returns
a pointer to a List of pointers to all children objects from plug-ins.
def libsbml.UnitDefinition.getListOfUnits (   self,
  args 
)

Returns the list of Units for this UnitDefinition instance.

getListOfUnits()   ListOfUnits
 
Returns
the ListOfUnits value for this UnitDefinition.
def libsbml.SBase.getMetaId (   self)
inherited

Returns the value of the 'metaid' attribute of this SBML object.

getMetaId()   string
The optional attribute named 'metaid', present on every major SBML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each 'metaid' value must be globally unique within an SBML file. The latter point is important, because the uniqueness criterion applies across any attribute with type ID anywhere in the file, not just the 'metaid' attribute used by SBML—something to be aware of if your application-specific XML content inside the 'annotation' subelement happens to use the XML ID type. Although SBML itself specifies the use of XML ID only for the 'metaid' attribute, SBML-compatible applications should be careful if they use XML ID's in XML portions of a model that are not defined by SBML, such as in the application-specific content of the 'annotation' subelement. Finally, note that LibSBML does not provide an explicit XML ID data type; it uses ordinary character strings, which is easier for applications to support.
Returns
the meta-identifier of this SBML object.
See also
isSetMetaId()
setMetaId()
def libsbml.SBase.getModel (   self)
inherited

Returns the Model object for the SBML Document in which the current object is located.

getModel()   Model
Returns
the Model object for the SBML Document of this SBML object.
See also
getParentSBMLObject()
getSBMLDocument()
def libsbml.SBase.getModelHistory (   self,
  args 
)
inherited

Returns the ModelHistory object, if any, attached to this object.

getModelHistory()   ModelHistory
Returns
the ModelHistory object attached to this object, or None if none exist.
Note
In SBML Level 2, model history annotations were only permitted on the Model element. In SBML Level 3, they are permitted on all SBML components derived from SBase.
def libsbml.UnitDefinition.getName (   self)

Returns the value of the 'name' attribute of this UnitDefinition object.

getName()   string
In SBML Level 3 Version 2, the 'id' and 'name' attributes were moved to SBase directly, instead of being defined individually for many (but not all) objects. LibSBML has for a long time provided functions defined on SBase itself to get, set, and unset those attributes, which would fail or otherwise return empty strings if executed on any object for which those attributes were not defined. Now that all SBase objects define those attributes, those functions now succeed for any object with the appropriate level and version.

The 'name' attribute is optional and is not intended to be used for cross-referencing purposes within a model. Its purpose instead is to provide a human-readable label for the component. The data type of 'name' is the type string defined in XML Schema. SBML imposes no restrictions as to the content of 'name' attributes beyond those restrictions defined by the string type in XML Schema.

The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)

As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read; and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.

An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.

Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.

Returns
the name of this SBML object, or the empty string if not set or unsettable.
See also
getIdAttribute()
isSetName()
setName()
unsetName()
def libsbml.SBase.getNamespaces (   self)
inherited

Returns a list of the XML Namespaces declared on the SBML document owning this object.

getNamespaces()   XMLNamespaces

The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core.

Returns
the XML Namespaces associated with this SBML object, or None in certain very usual circumstances where a namespace is not set.
See also
getLevel()
getVersion()
def libsbml.SBase.getNotes (   self,
  args 
)
inherited

Returns the content of the 'notes' subelement of this object as a tree of XMLNode objects.

getNotes()   XMLNode
The optional SBML element named 'notes', present on every major SBML component type (and in SBML Level 3, the 'message' subelement of Constraint), is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements conform to the definition of XHTML 1.0. However, the content cannot be entirely free-form; it must satisfy certain requirements defined in the SBML specifications for specific SBML Levels. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); this method implements a verification process that lets callers check whether the content of a given XMLNode object conforms to the SBML requirements for 'notes' and 'message' structure. Developers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations of using 'notes' in SBML. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

The 'notes' element content returned by this method will be in XML form, but libSBML does not provide an object model specifically for the content of notes. Callers will need to traverse the XML tree structure using the facilities available on XMLNode and related objects. For an alternative method of accessing the notes, see getNotesString().

Returns
the content of the 'notes' subelement of this SBML object as a tree structure composed of XMLNode objects.
See also
getNotesString()
isSetNotes()
setNotes()
setNotes()
appendNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.SBase.getNotesString (   self,
  args 
)
inherited

Returns the content of the 'notes' subelement of this object as a string.

getNotesString()   string
The optional SBML element named 'notes', present on every major SBML component type (and in SBML Level 3, the 'message' subelement of Constraint), is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements conform to the definition of XHTML 1.0. However, the content cannot be entirely free-form; it must satisfy certain requirements defined in the SBML specifications for specific SBML Levels. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); this method implements a verification process that lets callers check whether the content of a given XMLNode object conforms to the SBML requirements for 'notes' and 'message' structure. Developers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations of using 'notes' in SBML. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

For an alternative method of accessing the notes, see getNotes(), which returns the content as an XMLNode tree structure. Depending on an application's needs, one or the other method may be more convenient.

Returns
the content of the 'notes' subelement of this SBML object as a string.
See also
getNotes()
isSetNotes()
setNotes()
setNotes()
appendNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.SBase.getNumCVTerms (   self)
inherited

Returns the number of CVTerm objects in the annotations of this SBML object.

getNumCVTerms()   long
Returns
the number of CVTerms for this SBML object.
def libsbml.SBase.getNumDisabledPlugins (   self)
inherited

Returns the number of disabled plug-in objects (extension interfaces) for SBML Level 3 package extensions known.

getNumDisabledPlugins()   long
SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
If a plugin is disabled, the package information it contains is no longer considered to be part of the SBML document for the purposes of searching the document or writing out the document. However, the information is still retained, so if the plugin is enabled again, the same information will once again be available, and will be written out to the final model.
Returns
the number of disabled plug-in objects (extension interfaces) of package extensions known by this instance of libSBML.
def libsbml.SBase.getNumPlugins (   self)
inherited

Returns the number of plug-in objects (extenstion interfaces) for SBML Level 3 package extensions known.

getNumPlugins()   long
SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
Returns
the number of plug-in objects (extension interfaces) of package extensions known by this instance of libSBML.
See also
getPlugin()
def libsbml.UnitDefinition.getNumUnits (   self)

Returns the number of Unit objects contained within this UnitDefinition.

getNumUnits()   long
Returns
an integer representing the number of Units in this UnitDefinition.
def libsbml.SBase.getPackageCoreVersion (   self)
inherited

Returns the SBML Core Version within the SBML Level of the actual object.

getPackageCoreVersion()   long
LibSBML uses the class SBMLDocument as a top-level container for storing SBML content and data associated with it (such as warnings and error messages). An SBML model in libSBML is contained inside an SBMLDocument object. SBMLDocument corresponds roughly to the class SBML defined in the SBML Level 3 and Level 2 specifications, but it does not have a direct correspondence in SBML Level 1. (But, it is created by libSBML no matter whether the model is Level 1, Level 2 or Level 3.)
Returns
the SBML core version of this SBML object.
def libsbml.SBase.getPackageName (   self)
inherited

Returns the name of the SBML Level 3 package in which this element is defined.

getPackageName()   string
Returns
the name of the SBML package in which this element is defined. The string "core" will be returned if this element is defined in SBML Level 3 Core. The string "unknown" will be returned if this element is not defined in any SBML package.
def libsbml.SBase.getPackageVersion (   self)
inherited

Returns the Version of the SBML Level 3 package to which this element belongs to.

getPackageVersion()   long
Returns
the version of the SBML Level 3 package to which this element belongs. The value 0 will be returned if this element belongs to the SBML Level 3 Core package.
See also
getLevel()
getVersion()
def libsbml.SBase.getParentSBMLObject (   self,
  args 
)
inherited

Returns the parent SBML object containing this object.

getParentSBMLObject()   SBase

This returns the immediately-containing object. This method is convenient when holding an object nested inside other objects in an SBML model.

Returns
the parent SBML object of this SBML object.
See also
getSBMLDocument()
getModel()
def libsbml.SBase.getPlugin (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

getPlugin(string package)   SBasePlugin
getPlugin(long  n)   SBasePlugin

Each variant is described separately below.


Method variant with the following signature:
getPlugin(long n)

Returns the nth plug-in object (extension interface) for an SBML Level 3 package extension. The returned plug-in will be the appropriate type of plugin requested: calling Model.getPlugin() will return an FbcModelPlugin; calling Parameter.getPlugin() will return CompSBasePlugin, etc.

If no such plugin exists, None is returned.

SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
Parameters
nthe index of the plug-in to return.
Returns
the nth plug-in object (the libSBML extension interface) of a package extension. If the index n is invalid, None is returned.
See also
getNumPlugins()
getPlugin()

Method variant with the following signature:
getPlugin(string package)

Returns a plug-in object (extension interface) for an SBML Level 3 package extension with the given package name or URI. The returned plug-in will be the appropriate type of plugin requested: calling Model.getPlugin() will return an FbcModelPlugin; calling Parameter.getPlugin() will return CompSBasePlugin, etc.

If no such plugin exists, None is returned.

SBML Level 3 consists of a Core definition that can be extended via optional SBML Level 3 packages. A given model may indicate that it uses one or more SBML packages, and likewise, a software tool may be able to support one or more packages. LibSBML does not come preconfigured with all possible packages included and enabled, in part because not all package specifications have been finalized. To support the ability for software systems to enable support for the Level 3 packages they choose, libSBML features a plug-in mechanism. Each SBML Level 3 package is implemented in a separate code plug-in that can be enabled by the application to support working with that SBML package. A given SBML model may thus contain not only objects defined by SBML Level 3 Core, but also objects created by libSBML plug-ins supporting additional Level 3 packages.
Parameters
packagethe name or URI of the package.
Returns
the plug-in object (the libSBML extension interface) of a package extension with the given package name or URI.
See also
getPlugin()
def libsbml.SBase.getPrefix (   self)
inherited

Returns the XML namespace prefix of this element.

getPrefix()   string

This reports the XML namespace prefix chosen for this class of object in the current SBML document. This may be an empty string if the component has no explicit prefix (for instance, if it is a core SBML object placed in the default SBML namespace of the document). If it is not empty, then it corresponds to the XML namespace prefix used set the object, whatever that may be in a given SBML document.

Returns
a text string representing the XML namespace prefix.
def libsbml.SBase.getResourceBiologicalQualifier (   self,
  resource 
)
inherited

Returns the MIRIAM biological qualifier associated with the given resource.

getResourceBiologicalQualifier(string resource)   long

In MIRIAM, qualifiers are an optional means of indicating the relationship between a model component and its annotations. There are two broad kinds of annotations: model and biological. The latter kind is used to qualify the relationship between a model component and a biological entity which it represents. Examples of relationships include 'is' and 'has part', but many others are possible. MIRIAM defines numerous relationship qualifiers to enable different software tools to qualify biological annotations in the same standardized way. In libSBML, the MIRIAM controlled-vocabulary annotations on an SBML model element are represented using lists of CVTerm objects, and the the MIRIAM biological qualifiers are represented using valueswhose names begin with BQB_ in the interface class libsbml.

This method searches the controlled-vocabulary annotations (i.e., the list of CVTerm objects) on the present object, then out of those that have biological qualifiers, looks for an annotation to the given resource. If such an annotation is found, it returns the type of biological qualifier associated with that resource as a valuewhose name begins with BQB_ from the interface class libsbml.

Parameters
resourcestring representing the resource; e.g., 'http://www.geneontology.org/#GO:0005892'.
Returns
the qualifier associated with the resource, or BQB_UNKNOWN if the resource does not exist.
Note
The set of MIRIAM biological qualifiers grows over time, although relatively slowly. The values are up to date with MIRIAM at the time of a given libSBML release. The set of values in list of BQB_ constants defined in libsbml may be expanded in later libSBML releases, to match the values defined by MIRIAM at that later time.
def libsbml.SBase.getResourceModelQualifier (   self,
  resource 
)
inherited

Returns the MIRIAM model qualifier associated with the given resource.

getResourceModelQualifier(string resource)   long

In MIRIAM, qualifiers are an optional means of indicating the relationship between a model component and its annotations. There are two broad kinds of annotations: model and biological. The former kind is used to qualify the relationship between a model component and another modeling object. An example qualifier is 'isDerivedFrom', to indicate that a given component of the model is derived from the modeling object represented by the referenced resource. MIRIAM defines numerous relationship qualifiers to enable different software tools to qualify model annotations in the same standardized way. In libSBML, the MIRIAM controlled-vocabulary annotations on an SBML model element are represented using lists of CVTerm objects, and the the MIRIAM model qualifiers are represented using valueswhose names begin with BQM_ in the interface class libsbml.

This method method searches the controlled-vocabulary annotations (i.e., the list of CVTerm objects) on the present object, then out of those that have model qualifiers, looks for an annotation to the given resource. If such an annotation is found, it returns the type of type of model qualifier associated with that resource as a valuewhose name begins with BQM_ from the interface class libsbml.

Parameters
resourcestring representing the resource; e.g., 'http://www.geneontology.org/#GO:0005892'.
Returns
the model qualifier type associated with the resource, or BQM_UNKNOWN if the resource does not exist.
Note
The set of MIRIAM model qualifiers grows over time, although relatively slowly. The values are up to date with MIRIAM at the time of a given libSBML release. The set of values in list of BQM_ constants defined in libsbml may be expanded in later libSBML releases, to match the values defined by MIRIAM at that later time.
def libsbml.SBase.getSBMLDocument (   self,
  args 
)
inherited

Returns the SBMLDocument object containing this object instance.

getSBMLDocument()   SBMLDocument
LibSBML uses the class SBMLDocument as a top-level container for storing SBML content and data associated with it (such as warnings and error messages). An SBML model in libSBML is contained inside an SBMLDocument object. SBMLDocument corresponds roughly to the class SBML defined in the SBML Level 3 and Level 2 specifications, but it does not have a direct correspondence in SBML Level 1. (But, it is created by libSBML no matter whether the model is Level 1, Level 2 or Level 3.)

This method allows the caller to obtain the SBMLDocument for the current object.

Returns
the parent SBMLDocument object of this SBML object.
See also
getParentSBMLObject()
getModel()
def libsbml.SBase.getSBOTerm (   self)
inherited

Returns the integer portion of the value of the 'sboTerm' attribute of this object.

getSBOTerm()   int
Beginning with SBML Level 2 Version 2, objects derived from SBase have an optional attribute named 'sboTerm' for supporting the use of the Systems Biology Ontology. In SBML proper, the data type of the attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a seven digit integer number; libSBML simplifies the representation by only storing the 'NNNNNNN' integer portion. Thus, in libSBML, the 'sboTerm' attribute on SBase has data type int, and SBO identifiers are stored simply as integers.
SBO terms are a type of optional annotation, and each different class of SBML object derived from SBase imposes its own requirements about the values permitted for 'sboTerm'. More details can be found in SBML specifications for Level 2 Version 2 and above.
Returns
the value of the 'sboTerm' attribute as an integer, or -1 if the value is not set.
def libsbml.SBase.getSBOTermAsURL (   self)
inherited

Returns the URL representation of the 'sboTerm' attribute of this object.

getSBOTermAsURL()   string

This method returns the entire SBO identifier as a text string in the form http://identifiers.org/biomodels.sbo/SBO:NNNNNNN'.

SBO terms are a type of optional annotation, and each different class of SBML object derived from SBase imposes its own requirements about the values permitted for 'sboTerm'. More details can be found in SBML specifications for Level 2 Version 2 and above.
Returns
the value of the 'sboTerm' attribute as an identifiers.org URL, or an empty string if the value is not set.
def libsbml.SBase.getSBOTermID (   self)
inherited

Returns the string representation of the 'sboTerm' attribute of this object.

getSBOTermID()   string
Beginning with SBML Level 2 Version 2, objects derived from SBase have an optional attribute named 'sboTerm' for supporting the use of the Systems Biology Ontology. In SBML proper, the data type of the attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a seven digit integer number; libSBML simplifies the representation by only storing the 'NNNNNNN' integer portion. Thus, in libSBML, the 'sboTerm' attribute on SBase has data type int, and SBO identifiers are stored simply as integers.
SBO terms are a type of optional annotation, and each different class of SBML object derived from SBase imposes its own requirements about the values permitted for 'sboTerm'. More details can be found in SBML specifications for Level 2 Version 2 and above.
Returns
the value of the 'sboTerm' attribute as a string (its value will be of the form 'SBO:NNNNNNN'), or an empty string if the value is not set.
def libsbml.UnitDefinition.getTypeCode (   self)

Returns the libSBML type code for this object instance.

getTypeCode()   int
LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters SBML_. In the Python language interface for libSBML, the type codes are defined as static integer constants in the interface class libsbml. Note that different Level 3 package plug-ins may use overlapping type codes; to identify the package to which a given object belongs, call the SBase.getPackageName() method on the object.

The exception to this is lists: all SBML-style list elements have the type SBML_LIST_OF, regardless of what package they are from.

Returns
the SBML type code for this object: SBML_UNIT_DEFINITION (default).
Warning
The specific integer values of the possible type codes may be reused by different libSBML plug-ins for SBML Level 3. packages, To fully identify the correct code, it is necessary to invoke both getPackageName() and getTypeCode() (or ListOf.getItemTypeCode()).
See also
getPackageName()
getElementName()
def libsbml.UnitDefinition.getUnit (   self,
  args 
)

Returns a specific Unit instance belonging to this UnitDefinition.

getUnit(long  n)   Unit
Parameters
nan integer, the index of the Unit to be returned.
Returns
the nth Unit of this UnitDefinition. If the index n is invalid, None is returned.
See also
getNumUnits()
def libsbml.SBase.getURI (   self)
inherited

Gets the namespace URI to which this element belongs to.

getURI()   string

For example, all elements that belong to SBML Level 3 Version 1 Core must would have the URI 'http://www.sbml.org/sbml/level3/version1/core'; all elements that belong to Layout Extension Version 1 for SBML Level 3 Version 1 Core must would have the URI 'http://www.sbml.org/sbml/level3/version1/layout/version1'.

This function first returns the URI for this element by looking into the SBMLNamespaces object of the document with the its package name. If not found, it will then look for the namespace associated with the element itself.

Returns
the URI of this element, as a text string.
See also
getSBMLDocument()
getPackageName()
def libsbml.SBase.getVersion (   self)
inherited

Returns the Version within the SBML Level of the SBMLDocument object containing this object.

getVersion()   long
LibSBML uses the class SBMLDocument as a top-level container for storing SBML content and data associated with it (such as warnings and error messages). An SBML model in libSBML is contained inside an SBMLDocument object. SBMLDocument corresponds roughly to the class SBML defined in the SBML Level 3 and Level 2 specifications, but it does not have a direct correspondence in SBML Level 1. (But, it is created by libSBML no matter whether the model is Level 1, Level 2 or Level 3.)
Returns
the SBML version of this SBML object.
See also
getLevel()
getNamespaces()
def libsbml.UnitDefinition.hasRequiredAttributes (   self)

Predicate returning True if all the required attributes for this UnitDefinition object have been set.

hasRequiredAttributes()   bool

The required attributes for a UnitDefinition object are:

  • 'id'
Returns
True if the required attributes have been set, False otherwise.
def libsbml.UnitDefinition.hasRequiredElements (   self)

Predicate returning True if all the required elements for this UnitDefinition object have been set.

hasRequiredElements()   bool
Note
The required elements for a Constraint object are:
  • 'listOfUnits' (required in SBML Level 2 only, optional in Level 3)
Returns
a boolean value indicating whether all the required elements for this object have been defined.
def libsbml.SBase.hasValidLevelVersionNamespaceCombination (   self)
inherited

Predicate returning true if this object's level/version and namespace values correspond to a valid SBML specification.

hasValidLevelVersionNamespaceCombination()   bool

The valid combinations of SBML Level, Version and Namespace as of this release of libSBML are the following:

  • Level 1 Version 2: http://www.sbml.org/sbml/level1
  • Level 2 Version 1: http://www.sbml.org/sbml/level2
  • Level 2 Version 2: http://www.sbml.org/sbml/level2/version2
  • Level 2 Version 3: http://www.sbml.org/sbml/level2/version3
  • Level 2 Version 4: http://www.sbml.org/sbml/level2/version4
  • Level 3 Version 1 Core: http://www.sbml.org/sbml/level3/version1/core
Returns
true if the level, version and namespace values of this SBML object correspond to a valid set of values, false otherwise.
def libsbml.SBase.isPackageEnabled (   self,
  pkgName 
)
inherited

Predicate returning True if the given SBML Level 3 package is enabled with this object.

isPackageEnabled(string pkgName)   bool

The search ignores the package version.

Parameters
pkgNamethe name of the package.
Returns
True if the given package is enabled within this object, False otherwise.
See also
isPackageURIEnabled()
def libsbml.SBase.isPackageURIEnabled (   self,
  pkgURI 
)
inherited

Predicate returning True if an SBML Level 3 package with the given URI is enabled with this object.

isPackageURIEnabled(string pkgURI)   bool
Parameters
pkgURIthe URI of the package.
Returns
True if the given package is enabled within this object, False otherwise.
See also
isPackageEnabled()
def libsbml.SBase.isPkgEnabled (   self,
  pkgName 
)
inherited

Predicate returning True if the given SBML Level 3 package is enabled with this object.

isPkgEnabled(string pkgName)   bool

The search ignores the package version.

Parameters
pkgNamethe name of the package.
Returns
True if the given package is enabled within this object, False otherwise.
See also
isPkgURIEnabled()
def libsbml.SBase.isPkgURIEnabled (   self,
  pkgURI 
)
inherited

Predicate returning True if an SBML Level 3 package with the given URI is enabled with this object.

isPkgURIEnabled(string pkgURI)   bool
Parameters
pkgURIthe URI of the package.
Returns
True if the given package is enabled within this object, False otherwise.
See also
isPkgEnabled()
def libsbml.SBase.isSetAnnotation (   self)
inherited

Predicate returning True if this object's 'annotation' subelement exists and has content.

isSetAnnotation()   bool

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Returns
True if a 'annotation' subelement exists, False otherwise.
See also
getAnnotation()
getAnnotationString()
setAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
unsetAnnotation()
def libsbml.UnitDefinition.isSetId (   self)

Predicate returning True if this UnitDefinition's 'id' attribute is set.

isSetId()   bool
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Returns
True if the 'id' attribute of this SBML object is set, False otherwise.
Note
Because of the inconsistent behavior of this function with respect to assignments and rules, it is recommended that callers use isSetIdAttribute() instead.
See also
getIdAttribute()
setIdAttribute()
unsetIdAttribute()
isSetIdAttribute()
def libsbml.SBase.isSetIdAttribute (   self)
inherited

Predicate returning True if this object's 'id' attribute is set.

isSetIdAttribute()   bool
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Returns
True if the 'id' attribute of this SBML object is set, False otherwise.
See also
getIdAttribute()
setIdAttribute()
unsetIdAttribute()
def libsbml.SBase.isSetMetaId (   self)
inherited

Predicate returning True if this object's 'metaid' attribute is set.

isSetMetaId()   bool
The optional attribute named 'metaid', present on every major SBML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each 'metaid' value must be globally unique within an SBML file. The latter point is important, because the uniqueness criterion applies across any attribute with type ID anywhere in the file, not just the 'metaid' attribute used by SBML—something to be aware of if your application-specific XML content inside the 'annotation' subelement happens to use the XML ID type. Although SBML itself specifies the use of XML ID only for the 'metaid' attribute, SBML-compatible applications should be careful if they use XML ID's in XML portions of a model that are not defined by SBML, such as in the application-specific content of the 'annotation' subelement. Finally, note that LibSBML does not provide an explicit XML ID data type; it uses ordinary character strings, which is easier for applications to support.
Returns
True if the 'metaid' attribute of this SBML object is set, False otherwise.
See also
getMetaId()
setMetaId()
def libsbml.SBase.isSetModelHistory (   self)
inherited

Predicate returning True if this object has a ModelHistory object attached to it.

isSetModelHistory()   bool
Returns
True if the ModelHistory of this object is set, False otherwise.
Note
In SBML Level 2, model history annotations were only permitted on the Model element. In SBML Level 3, they are permitted on all SBML components derived from SBase.
def libsbml.UnitDefinition.isSetName (   self)

Predicate returning True if this UnitDefinition's 'name' attribute is set.

isSetName()   bool
In SBML Level 3 Version 2, the 'id' and 'name' attributes were moved to SBase directly, instead of being defined individually for many (but not all) objects. LibSBML has for a long time provided functions defined on SBase itself to get, set, and unset those attributes, which would fail or otherwise return empty strings if executed on any object for which those attributes were not defined. Now that all SBase objects define those attributes, those functions now succeed for any object with the appropriate level and version.

The 'name' attribute is optional and is not intended to be used for cross-referencing purposes within a model. Its purpose instead is to provide a human-readable label for the component. The data type of 'name' is the type string defined in XML Schema. SBML imposes no restrictions as to the content of 'name' attributes beyond those restrictions defined by the string type in XML Schema.

The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)

As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read; and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.

An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.

Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.

Returns
True if the 'name' attribute of this SBML object is set, False otherwise.
See also
getName()
setName()
unsetName()
def libsbml.SBase.isSetNotes (   self)
inherited

Predicate returning True if this object's 'notes' subelement exists and has content.

isSetNotes()   bool

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

Returns
True if a 'notes' subelement exists, False otherwise.
See also
getNotes()
getNotesString()
setNotes()
setNotes()
appendNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.SBase.isSetSBOTerm (   self)
inherited

Predicate returning True if this object's 'sboTerm' attribute is set.

isSetSBOTerm()   bool
Returns
True if the 'sboTerm' attribute of this SBML object is set, False otherwise.
def libsbml.SBase.isSetUserData (   self)
inherited

Predicate returning true or false depending on whether the user data of this element has been set.

isSetUserData()   bool
The user data associated with an SBML object can be used by an application developer to attach custom information to that object in the model. In case of a deep copy, this data will passed as-is. The data attribute will never be interpreted by libSBML.
Returns
boolean, True if this object's user data has been set, False otherwise.
def libsbml.UnitDefinition.isVariantOfArea (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'area'.

isVariantOfArea(bool relaxed)   bool
isVariantOfArea()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit area, meaning square metres with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfDimensionless (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the unit 'dimensionless'.

isVariantOfDimensionless(bool relaxed)   bool
isVariantOfDimensionless()   bool
Returns
True if this UnitDefinition is a variant of dimensionless, meaning dimensionless with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfLength (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'length'.

isVariantOfLength(bool relaxed)   bool
isVariantOfLength()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit length, meaning metres with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfMass (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'mass'.

isVariantOfMass(bool relaxed)   bool
isVariantOfMass()   bool
Returns
True if this UnitDefinition is a variant of mass units, meaning gram or kilogram with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfSubstance (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'substance'.

isVariantOfSubstance(bool relaxed)   bool
isVariantOfSubstance()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit substance, meaning moles or items (and grams or kilograms from SBML Level 2 Version 2 onwards) with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfSubstancePerTime (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit 'substance' divided by the predefined unit 'time'.

isVariantOfSubstancePerTime(bool relaxed)   bool
isVariantOfSubstancePerTime()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit substance per predefined unit time, meaning it contains two units one of which is a variant of substance and the other is a variant of time which an exponent of -1; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfTime (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'time'.

isVariantOfTime(bool relaxed)   bool
isVariantOfTime()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit time, meaning seconds with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.isVariantOfVolume (   self,
  relaxed = False 
)

Convenience function for testing if a given unit definition is a variant of the predefined unit identifier 'volume'.

isVariantOfVolume(bool relaxed)   bool
isVariantOfVolume()   bool
Returns
True if this UnitDefinition is a variant of the predefined unit volume, meaning litre or cubic metre with only arbitrary variations in scale or multiplier values; False otherwise.
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.SBase.matchesRequiredSBMLNamespacesForAddition (   self,
  args 
)
inherited

Returns True if this object's set of XML namespaces are a subset of the given object's XML namespaces.

matchesRequiredSBMLNamespacesForAddition(SBase sb)   bool
The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core. A common approach to using libSBML's SBMLNamespaces facilities is to create an SBMLNamespaces object somewhere in a program once, then hand that object as needed to object constructors that accept SBMLNamespaces as arguments.
Parameters
sban object to compare with respect to namespaces.
Returns
boolean, True if this object's collection of namespaces is a subset of sb's, False otherwise.
def libsbml.SBase.matchesSBMLNamespaces (   self,
  args 
)
inherited

Returns True if this object's set of XML namespaces are the same as the given object's XML namespaces.

matchesSBMLNamespaces(SBase sb)   bool
The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core. A common approach to using libSBML's SBMLNamespaces facilities is to create an SBMLNamespaces object somewhere in a program once, then hand that object as needed to object constructors that accept SBMLNamespaces as arguments.
Parameters
sban object to compare with respect to namespaces.
Returns
boolean, True if this object's collection of namespaces is the same as sb's, False otherwise.
def libsbml.UnitDefinition.printUnits (   ud,
  compact = False 
)

Expresses the given definition in a plain-text form.

printUnits(UnitDefinition ud, bool compact)   string
printUnits(UnitDefinition ud)   string

For example, UnitDefinition.printUnits() applied to

 <unitDefinition>
  <listOfUnits>
    <unit kind='metre' exponent='1'/>
    <unit kind='second' exponent='-2'/>
  </listOfUnits>
 <unitDefinition>

will return the string 'metre (exponent = 1, multiplier = 1, scale = 0) second (exponent = -2, multiplier = 1, scale = 0)' or, if the optional parameter compact is given the value True, the string '(1 metre)^1 (1 second)^-2'. This method may be useful for printing unit information to human users, or in debugging software, or other situations.

Parameters
udthe UnitDefinition object.
compactboolean indicating whether the compact form should be used (defaults to false).
Returns
a string expressing the unit definition defined by the given UnitDefinition object ud.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.SBase.removeFromParentAndDelete (   self)
inherited

Removes this object from its parent.

removeFromParentAndDelete()   int

If the parent was storing this object as a pointer, it is deleted. If not, it is simply cleared (as in ListOf objects). This is a pure virtual method, as every SBase element has different parents, and therefore different methods of removing itself. Will fail (and not delete itself) if it has no parent object. This function is designed to be overridden, but for all objects whose parent is of the class ListOf, the default implementation will work.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.removeTopLevelAnnotationElement (   self,
  args 
)
inherited

Removes the top-level element within the 'annotation' subelement of this SBML object with the given name and optional URI.

removeTopLevelAnnotationElement(string elementName, string elementURI, bool removeEmpty)   int
removeTopLevelAnnotationElement(string elementName, string elementURI)   int
removeTopLevelAnnotationElement(string elementName)   int

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Calling this method allows a particular annotation element to be removed whilst the remaining annotations remain intact.

Parameters
elementNamea string representing the name of the top level annotation element that is to be removed.
elementURIan optional string that is used to check both the name and URI of the top level element to be removed.
removeEmptyif after removing of the element, the annotation is empty, and the removeEmpty argument is true, the annotation node will be deleted (default).
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
replaceTopLevelAnnotationElement()
replaceTopLevelAnnotationElement()
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.
def libsbml.UnitDefinition.removeUnit (   self,
  n 
)

Removes the nth Unit object from this UnitDefinition object and returns a pointer to it.

removeUnit(long  n)   Unit

The caller owns the returned object and is responsible for deleting it.

Parameters
nthe index of the Unit object to remove.
Returns
the Unit object removed, or None if the given index is out of range.
def libsbml.SBase.renameMetaIdRefs (   self,
  oldid,
  newid 
)
inherited

Replaces all uses of a given meta identifier attribute value with another value.

renameMetaIdRefs(string oldid, string newid)
In SBML, object 'meta' identifiers are of the XML data type ID; the SBML object attribute itself is typically named metaid. All attributes that hold values referring to values of type ID are of the XML data type IDREF. They are also sometimes informally referred to as 'metaid refs', in analogy to the SBML-defined type SIdRef.

This method works by looking at all meta-identifier attribute values, comparing the identifiers to the value of oldid. If any matches are found, the matching identifiers are replaced with newid. The method does not descend into child elements.

Parameters
oldidthe old identifier.
newidthe new identifier.
def libsbml.SBase.renameSIdRefs (   self,
  oldid,
  newid 
)
inherited

Replaces all uses of a given SIdRef type attribute value with another value.

renameSIdRefs(string oldid, string newid)
In SBML, object identifiers are of a data type called SId. In SBML Level 3, an explicit data type called SIdRef was introduced for attribute values that refer to SId values; in previous Levels of SBML, this data type did not exist and attributes were simply described to as 'referring to an identifier', but the effective data type was the same as SIdRef in Level 3. These and other methods of libSBML refer to the type SIdRef for all Levels of SBML, even if the corresponding SBML specification did not explicitly name the data type.

This method works by looking at all attributes and (if appropriate) mathematical formulas in MathML content, comparing the referenced identifiers to the value of oldid. If any matches are found, the matching values are replaced with newid. The method does not descend into child elements.

Parameters
oldidthe old identifier.
newidthe new identifier.
def libsbml.SBase.renameUnitSIdRefs (   self,
  oldid,
  newid 
)
inherited

Replaces all uses of a given UnitSIdRef type attribute value with another value.

renameUnitSIdRefs(string oldid, string newid)
In SBML, unit definitions have identifiers of type UnitSId. In SBML Level 3, an explicit data type called UnitSIdRef was introduced for attribute values that refer to UnitSId values; in previous Levels of SBML, this data type did not exist and attributes were simply described to as 'referring to a unit identifier', but the effective data type was the same as UnitSIdRef in Level 3. These and other methods of libSBML refer to the type UnitSIdRef for all Levels of SBML, even if the corresponding SBML specification did not explicitly name the data type.

This method works by looking at all unit identifier attribute values (including, if appropriate, inside mathematical formulas), comparing the referenced unit identifiers to the value of oldid. If any matches are found, the matching values are replaced with newid. The method does not descend into child elements.

Parameters
oldidthe old identifier.
newidthe new identifier.
def libsbml.UnitDefinition.reorder (   ud)

Alphabetically orders the Unit objects within the ListOfUnits of a UnitDefinition.

reorder(UnitDefinition ud)
Parameters
udthe UnitDefinition object whose units are to be reordered.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
def libsbml.SBase.replaceTopLevelAnnotationElement (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

replaceTopLevelAnnotationElement(XMLNode annotation)   int
replaceTopLevelAnnotationElement(string annotation)   int

Each variant is described separately below.


Method variant with the following signature:
replaceTopLevelAnnotationElement(XMLNode annotation)

Replaces the given top-level element within the 'annotation' subelement of this SBML object and with the annotation element supplied.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

This method determines the name of the element to be replaced from the annotation argument. Functionally it is equivalent to calling removeTopLevelAnnotationElement(name) followed by calling appendAnnotation(annotation_with_name), with the exception that the placement of the annotation element remains the same.

Parameters
annotationXMLNode representing the replacement top level annotation.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
removeTopLevelAnnotationElement()
replaceTopLevelAnnotationElement()

Method variant with the following signature:
replaceTopLevelAnnotationElement(string annotation)

Replaces the given top-level element within the 'annotation' subelement of this SBML object and with the annotation element supplied.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

This method determines the name of the element to be replaced from the annotation argument. Functionally it is equivalent to calling removeTopLevelAnnotationElement(name) followed by calling appendAnnotation(annotation_with_name), with the exception that the placement of the annotation element remains the same.

Parameters
annotationstring representing the replacement top level annotation.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
removeTopLevelAnnotationElement()
replaceTopLevelAnnotationElement()
def libsbml.SBase.setAnnotation (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

setAnnotation(XMLNode annotation)   int
setAnnotation(string annotation)   int

Each variant is described separately below.


Method variant with the following signature:
setAnnotation(XMLNode annotation)

Sets the value of the 'annotation' subelement of this SBML object.

The content of annotation is copied, and any previous content of this object's 'annotation' subelement is deleted.

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Call this method will result in any existing content of the 'annotation' subelement to be discarded. Unless you have taken steps to first copy and reconstitute any existing annotations into the annotation that is about to be assigned, it is likely that performing such wholesale replacement is unfriendly towards other software applications whose annotations are discarded. An alternative may be to use SBase.appendAnnotation() or SBase.appendAnnotation().

Parameters
annotationan XML structure that is to be used as the new content of the 'annotation' subelement of this object.
Returns
integer value indicating success/failure of the function. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value:
See also
getAnnotationString()
isSetAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
unsetAnnotation()

Method variant with the following signature:
setAnnotation(string annotation)

Sets the value of the 'annotation' subelement of this SBML object.

The content of annotation is copied, and any previous content of this object's 'annotation' subelement is deleted.

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Call this method will result in any existing content of the 'annotation' subelement to be discarded. Unless you have taken steps to first copy and reconstitute any existing annotations into the annotation that is about to be assigned, it is likely that performing such wholesale replacement is unfriendly towards other software applications whose annotations are discarded. An alternative may be to use SBase.appendAnnotation() or SBase.appendAnnotation().

Parameters
annotationan XML string that is to be used as the content of the 'annotation' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getAnnotationString()
isSetAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
unsetAnnotation()
def libsbml.UnitDefinition.setId (   self,
  sid 
)

Sets the value of the 'id' attribute of this UnitDefinition.

setId(string sid)   int
The string sid is copied.
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Parameters
sidthe string to use as the identifier of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getIdAttribute()
setIdAttribute()
isSetIdAttribute()
unsetIdAttribute()
def libsbml.SBase.setIdAttribute (   self,
  sid 
)
inherited

Sets the value of the 'id' attribute of this SBML object.

setIdAttribute(string sid)   int
The string sid is copied.
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Parameters
sidthe string to use as the identifier of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getIdAttribute()
setIdAttribute()
isSetIdAttribute()
unsetIdAttribute()
def libsbml.SBase.setMetaId (   self,
  metaid 
)
inherited

Sets the value of the meta-identifier attribute of this SBML object.

setMetaId(string metaid)   int
The optional attribute named 'metaid', present on every major SBML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each 'metaid' value must be globally unique within an SBML file. The latter point is important, because the uniqueness criterion applies across any attribute with type ID anywhere in the file, not just the 'metaid' attribute used by SBML—something to be aware of if your application-specific XML content inside the 'annotation' subelement happens to use the XML ID type. Although SBML itself specifies the use of XML ID only for the 'metaid' attribute, SBML-compatible applications should be careful if they use XML ID's in XML portions of a model that are not defined by SBML, such as in the application-specific content of the 'annotation' subelement. Finally, note that LibSBML does not provide an explicit XML ID data type; it uses ordinary character strings, which is easier for applications to support.

The string metaid is copied.

Parameters
metaidthe identifier string to use as the value of the 'metaid' attribute.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getMetaId()
isSetMetaId()
def libsbml.SBase.setModelHistory (   self,
  history 
)
inherited

Sets the ModelHistory of this object.

setModelHistory(ModelHistory history)   int

The content of history is copied, and this object's existing model history content is deleted.

Parameters
historyModelHistory of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
Note
In SBML Level 2, model history annotations were only permitted on the Model element. In SBML Level 3, they are permitted on all SBML components derived from SBase.
def libsbml.UnitDefinition.setName (   self,
  name 
)

Sets the value of the 'name' attribute of this UnitDefinition.

setName(string name)   int

The string in name is copied.

Parameters
namethe new name for the SBML object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.setNamespaces (   self,
  xmlns 
)
inherited

Sets the namespaces relevant of this SBML object.

setNamespaces(XMLNamespaces xmlns)   int

The content of xmlns is copied, and this object's existing namespace content is deleted.

The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core.

Parameters
xmlnsthe namespaces to set.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.setNotes (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

setNotes(XMLNode notes)   int
setNotes(string notes, bool addXHTMLMarkup)   int
setNotes(string notes)   int

Each variant is described separately below.


Method variant with the following signature:
setNotes(string notes, bool addXHTMLMarkup = false)

Sets the value of the 'notes' subelement of this SBML object to a copy of the string notes.

The content of notes is copied, and any existing content of this object's 'notes' subelement is deleted.

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

The following code illustrates a very simple way of setting the notes using this method. Here, the object being annotated is the whole SBML document, but that is for illustration purposes only; you could of course use this same approach to annotate any other SBML component.

1 try:
2  sbmlDoc = SBMLDocument(3, 1)
3 except ValueError:
4  print('Could not create SBMLDocument object')
5  sys.exit(1)
6 
7 note = '<body xmlns='http://www.w3.org/1999/xhtml'><p>here is my note</p></body>'
8 
9 status = sbmlDoc.setNotes(note)
10 if status != LIBSBML_OPERATION_SUCCESS:
11  # Do something to handle the error here.
12  print('Unable to set notes on the SBML document object')
13  sys.exit(1)
Parameters
notesan XML string that is to be used as the content of the 'notes' subelement of this object.
addXHTMLMarkupa boolean indicating whether to wrap the contents of the notes argument with XHTML paragraph (<p>) tags. This is appropriate when the string in notes does not already containg the appropriate XHTML markup.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getNotesString()
isSetNotes()
setNotes()
appendNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
Note
Owing to the way that language interfaces are created in libSBML, this documentation may show methods that define default values for parameters with text that has the form parameter = value. This is not to be intepreted as a Python keyword argument; the use of a parameter name followed by an equals sign followed by a value is only meant to indicate a default value if the argument is not provided at all. It is not a keyword in the Python sense.

Method variant with the following signature:
setNotes(XMLNode notes)

Sets the value of the 'notes' subelement of this SBML object.

The content of notes is copied, and any existing content of this object's 'notes' subelement is deleted.

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

Parameters
notesan XML structure that is to be used as the content of the 'notes' subelement of this object.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getNotesString()
isSetNotes()
setNotes()
appendNotes()
appendNotes()
unsetNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.SBase.setSBOTerm (   self,
  args 
)
inherited

This method has multiple variants; they differ in the arguments they accept.

setSBOTerm(int value)   int
setSBOTerm(string sboid)   int

Each variant is described separately below.


Method variant with the following signature:
setSBOTerm(int value)

Sets the value of the 'sboTerm' attribute.

Beginning with SBML Level 2 Version 2, objects derived from SBase have an optional attribute named 'sboTerm' for supporting the use of the Systems Biology Ontology. In SBML proper, the data type of the attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a seven digit integer number; libSBML simplifies the representation by only storing the 'NNNNNNN' integer portion. Thus, in libSBML, the 'sboTerm' attribute on SBase has data type int, and SBO identifiers are stored simply as integers.
SBO terms are a type of optional annotation, and each different class of SBML object derived from SBase imposes its own requirements about the values permitted for 'sboTerm'. More details can be found in SBML specifications for Level 2 Version 2 and above.
Parameters
valuethe NNNNNNN integer portion of the SBO identifier.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
setSBOTerm()

Method variant with the following signature:
setSBOTerm(string sboid)

Sets the value of the 'sboTerm' attribute by string.

Beginning with SBML Level 2 Version 2, objects derived from SBase have an optional attribute named 'sboTerm' for supporting the use of the Systems Biology Ontology. In SBML proper, the data type of the attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a seven digit integer number; libSBML simplifies the representation by only storing the 'NNNNNNN' integer portion. Thus, in libSBML, the 'sboTerm' attribute on SBase has data type int, and SBO identifiers are stored simply as integers.
SBO terms are a type of optional annotation, and each different class of SBML object derived from SBase imposes its own requirements about the values permitted for 'sboTerm'. More details can be found in SBML specifications for Level 2 Version 2 and above.
Parameters
sboidthe SBO identifier string of the form 'SBO:NNNNNNN'.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
setSBOTerm()
def libsbml.UnitDefinition.simplify (   ud)

Simplifies the UnitDefinition such that any given kind of Unit object occurs only once in the ListOfUnits.

simplify(UnitDefinition ud)

For example, the following definition,

 <unitDefinition>
  <listOfUnits>
    <unit kind='metre' exponent='1'/>
    <unit kind='metre' exponent='2'/>
  </listOfUnits>
 <unitDefinition>

will be simplified to

 <unitDefinition>
   <listOfUnits>
     <unit kind='metre' exponent='3'/>
   </listOfUnits>
 <unitDefinition>
Parameters
udthe UnitDefinition object to be simplified.
Note
Because this is a static method on a class, the Python language interface for libSBML will contain two variants. One will be the expected, normal static method on the class (i.e., a regular methodName), and the other will be a standalone top-level function with the name ClassName_methodName(). This is merely an artifact of how the language interfaces are created in libSBML. The methods are functionally identical.
def libsbml.SBase.toSBML (   self)
inherited

Returns a string consisting of a partial SBML corresponding to just this object.

toSBML()   string
Returns
the partial SBML that describes this SBML object.
Warning
This is primarily provided for testing and debugging purposes. It may be removed in a future version of libSBML.
def libsbml.SBase.toXMLNode (   self)
inherited

Returns this element as an XMLNode.

toXMLNode()   XMLNode
Returns
this element as an XMLNode.
Warning
This operation is computationally expensive, because the element has to be fully serialized to a string and then parsed into the XMLNode structure. Attempting to convert a large tree structure (e.g., a large Model) may consume significant computer memory and time.
def libsbml.SBase.unsetAnnotation (   self)
inherited

Unsets the value of the 'annotation' subelement of this SBML object.

unsetAnnotation()   int

Whereas the SBase 'notes' subelement is a container for content to be shown directly to humans, the 'annotation' element is a container for optional software-generated content not meant to be shown to humans. Every object derived from SBase can have its own value for 'annotation'. The element's content type is XML type 'any', allowing essentially arbitrary well-formed XML data content.

SBML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the SBML specifications for more details.

Returns
integer value indicating success/failure of the function. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value:
See also
getAnnotation()
getAnnotationString()
isSetAnnotation()
setAnnotation()
setAnnotation()
appendAnnotation()
appendAnnotation()
def libsbml.SBase.unsetCVTerms (   self)
inherited

Clears the list of CVTerm objects attached to this SBML object.

unsetCVTerms()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.unsetId (   self)
inherited

Unsets the value of the 'id' attribute of this SBML object.

unsetId()   int
The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:
letter ::= 'a'..'z','A'..'Z'
digit  ::= '0'..'9'
idChar ::= letter | digit | '_'
SId    ::= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. This applies to all uses of SId, SIdRef, and derived types.

Users need to be aware of some important API issues that are the result of the history of SBML and libSBML. Prior to SBML Level 3 Version 2, SBML defined 'id' and 'name' attributes on only a subset of SBML objects. To simplify the work of programmers, libSBML's API provided get, set, check, and unset on the SBase object class itself instead of on individual subobject classes. This made the get/set/etc. methods uniformly available on all objects in the libSBML API. LibSBML simply returned empty strings or otherwise did not act when the methods were applied to SBML objects that were not defined by the SBML specification to have 'id' or 'name' attributes. Additional complications arose with the rule and assignment objects: InitialAssignment, EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, the rule object hierarchy was different, and in addition, then as now, they possess different attributes: 'variable' (for the rules and event assignments), 'symbol' (for initial assignments), or neither (for algebraic rules). Prior to SBML Level 3 Version 2, getId() would always return an empty string, and isSetId() would always return False for objects of these classes.

With the addition of 'id' and 'name' attributes on SBase in Level 3 Version 2, it became necessary to introduce a new way to interact with the attributes more consistently in libSBML to avoid breaking backward compatibility in the behavior of the original 'id' methods. For this reason, libSBML provides four functions (getIdAttribute(), setIdAttribute(), isSetIdAttribute(), and unsetIdAttribute()) that always act on the actual 'id' attribute inherited from SBase, regardless of the object's type. These new methods should be used instead of the older getId()/setId()/etc. methods unless the old behavior is somehow necessary. Regardless of the Level and Version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getIdAttribute()
setIdAttribute()
isSetIdAttribute()
unsetIdAttribute()
def libsbml.SBase.unsetIdAttribute (   self)
inherited

Unsets the value of the 'id' attribute of this SBML object.

unsetIdAttribute()   int

Most (but not all) objects in SBML include two common attributes: 'id' and 'name'. The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getIdAttribute()
setIdAttribute()
isSetIdAttribute()
def libsbml.SBase.unsetMetaId (   self)
inherited

Unsets the value of the 'metaid' attribute of this SBML object.

unsetMetaId()   int
The optional attribute named 'metaid', present on every major SBML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each 'metaid' value must be globally unique within an SBML file. The latter point is important, because the uniqueness criterion applies across any attribute with type ID anywhere in the file, not just the 'metaid' attribute used by SBML—something to be aware of if your application-specific XML content inside the 'annotation' subelement happens to use the XML ID type. Although SBML itself specifies the use of XML ID only for the 'metaid' attribute, SBML-compatible applications should be careful if they use XML ID's in XML portions of a model that are not defined by SBML, such as in the application-specific content of the 'annotation' subelement. Finally, note that LibSBML does not provide an explicit XML ID data type; it uses ordinary character strings, which is easier for applications to support.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.unsetModelHistory (   self)
inherited

Unsets the ModelHistory object attached to this object.

unsetModelHistory()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
Note
In SBML Level 2, model history annotations were only permitted on the Model element. In SBML Level 3, they are permitted on all SBML components derived from SBase.
def libsbml.UnitDefinition.unsetName (   self)

Unsets the value of the 'name' attribute of this UnitDefinition.

unsetName()   int
In SBML Level 3 Version 2, the 'id' and 'name' attributes were moved to SBase directly, instead of being defined individually for many (but not all) objects. LibSBML has for a long time provided functions defined on SBase itself to get, set, and unset those attributes, which would fail or otherwise return empty strings if executed on any object for which those attributes were not defined. Now that all SBase objects define those attributes, those functions now succeed for any object with the appropriate level and version.

The 'name' attribute is optional and is not intended to be used for cross-referencing purposes within a model. Its purpose instead is to provide a human-readable label for the component. The data type of 'name' is the type string defined in XML Schema. SBML imposes no restrictions as to the content of 'name' attributes beyond those restrictions defined by the string type in XML Schema.

The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)

As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read; and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.

An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.

Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
See also
getName()
setName()
isSetName()
def libsbml.SBase.unsetNotes (   self)
inherited

Unsets the value of the 'notes' subelement of this SBML object.

unsetNotes()   int

The optional SBML element named 'notes', present on every major SBML component type, is intended as a place for storing optional information intended to be seen by humans. An example use of the 'notes' element would be to contain formatted user comments about the model element in which the 'notes' element is enclosed. Every object derived directly or indirectly from type SBase can have a separate value for 'notes', allowing users considerable freedom when adding comments to their models.

The format of 'notes' elements must be XHTML 1.0. To help verify the formatting of 'notes' content, libSBML provides the static utility method SyntaxChecker.hasExpectedXHTMLSyntax(); however, readers are urged to consult the appropriate SBML specification document for the Level and Version of their model for more in-depth explanations. The SBML Level 2 and 3 specifications have considerable detail about how 'notes' element content must be structured.

Returns
integer value indicating success/failure of the function. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value:
See also
getNotesString()
isSetNotes()
setNotes()
setNotes()
appendNotes()
appendNotes()
SyntaxChecker.hasExpectedXHTMLSyntax()
def libsbml.SBase.unsetSBOTerm (   self)
inherited

Unsets the value of the 'sboTerm' attribute of this SBML object.

unsetSBOTerm()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBase.unsetUserData (   self)
inherited

Unsets the user data of this element.

unsetUserData()   int
The user data associated with an SBML object can be used by an application developer to attach custom information to that object in the model. In case of a deep copy, this data will passed as-is. The data attribute will never be interpreted by libSBML.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are: