libSBML Python API  5.11.0
libsbml.CompExtension Class Reference
Inheritance diagram for libsbml.CompExtension:
[legend]

Detailed Description

comp Base extension class for the package.

Public Member Functions

def __init__ (self, args)
 This method has multiple variants; they differ in the arguments they accept. More...
 
def clone (self)
 Creates and returns a deep copy of this CompExtension object. More...
 
def getDefaultLevel ()
 Returns the default SBML Level used by this libSBML package extension. More...
 
def getDefaultPackageVersion ()
 Returns the default version of the SBML Level 3 package implemented by this libSBML extension. More...
 
def getDefaultVersion ()
 Returns the default SBML Version used by this libSBML package extension. More...
 
def getLevel (self, uri)
 Returns the SBML Level for the given URI of this package. More...
 
def getName (self)
 Returns the name of this package as a short-form label ("comp"). More...
 
def getNumOfSBasePlugins (self)
  Core class for SBML Level 3 package plug-ins. More...
 
def getNumOfSupportedPackageURI (self)
 Returns the number of supported package namespace URIs. More...
 
def getPackageName ()
 comp Base extension class for the package. More...
 
def getPackageVersion (self, uri)
 Returns the package version for the given URI of this package. More...
 
def getSBMLExtensionNamespaces (self, uri)
 Returns an CompPkgNamespaces object. More...
 
def getStringFromTypeCode (self, typeCode)
 Takes a type code of the “comp” package and returns a string describing the code. More...
 
def getSupportedPackageURI (self, args)
 Returns the nth XML namespace URI. More...
 
def getURI (self, sbmlLevel, sbmlVersion, pkgVersion)
 Returns the namespace URI corresponding to the combination of the given SBML Level, Version, and package version. More...
 
def getURI (self, args)
 Returns the XML namespace URI for a given Level and Version. More...
 
def getVersion (self, uri)
 Returns the SBML Version for the given URI of this package. More...
 
def getXmlnsL3V1V1 ()
 Returns the XML namespace URI of the SBML Level 3 package implemented by this libSBML extension. More...
 
def isEnabled (self)
 Returns True if this package is enabled. More...
 
def isInUse (self, args)
 Indicates whether this extension is being used by the given SBMLDocument. More...
 
def isSupported (self, args)
 Returns True if the given XML namespace URI is supported by this package extension. More...
 
def setEnabled (self, args)
 Enable or disable this package. More...
 

Constructor & Destructor Documentation

def libsbml.CompExtension.__init__ (   self,
  args 
)

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

__init__()   CompExtension
__init__(CompExtension arg2)   CompExtension

Each variant is described separately below.


Method variant with the following signature:
CompExtension(CompExtension)

Copy constructor.


Method variant with the following signature:
CompExtension()

Constructor

Member Function Documentation

def libsbml.CompExtension.clone (   self)

Creates and returns a deep copy of this CompExtension object.

clone()   CompExtension
Returns
a (deep) copy of this CompExtension object
def libsbml.CompExtension.getDefaultLevel ( )

Returns the default SBML Level used by this libSBML package extension.

getDefaultLevel()   long
Returns
the SBML Level.
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.CompExtension.getDefaultPackageVersion ( )

Returns the default version of the SBML Level 3 package implemented by this libSBML extension.

getDefaultPackageVersion()   long
Returns
the default version number of the SBML Level 3 package definition.
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.CompExtension.getDefaultVersion ( )

Returns the default SBML Version used by this libSBML package extension.

getDefaultVersion()   long
Returns
the Version within the default SBML Level.
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.CompExtension.getLevel (   self,
  uri 
)

Returns the SBML Level for the given URI of this package.

getLevel(string uri)   long
Parameters
urithe string of URI that represents one of versions of the “comp” package
Returns
the SBML Level with the given URI of this package, or 0 if the given URI is invalid.
def libsbml.CompExtension.getName (   self)

Returns the name of this package as a short-form label ("comp").

getName()   string
Returns
the name of this package.
def libsbml.SBMLExtension.getNumOfSBasePlugins (   self)
inherited

Core class for SBML Level 3 package plug-ins.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

The SBMLExtension class is a component of the libSBML package extension mechanism. It is an abstract class that is extended by each package extension implementation.

Special handling for SBML LevelĀ 2

Due to the historical background of the SBML Layout package, libSBML implements special behavior for that package: it always creates a Layout plugin object for any SBML Level 2 document it reads in, regardless of whether that document actually uses Layout constructs. This is unlike the case for SBML Level 3 documents that use Layout; for them, libSBML will not create a plugin object unless the document actually declares the use of the Layout package (via the usual Level 3 namespace declaration for Level 3 packages).

This has the following consequence. If an application queries for the presence of Layout in an SBML Level 2 document by testing only for the existence of the plugin object, it will always get a positive result; in other words, the presence of a Layout extension object is not an indication of whether a read-in Level 2 document does or does not use SBML Layout. Instead, callers have to query explicitly for the existence of layout information. An example of such a query is the following code:

1 # Assume 'doc' below is an SBMLDocument object.
2 m = doc.getModel()
3 if m != None:
4 layoutPlugin = m.getPlugin('layout')
5 if layoutPlugin != None:
6  numLayouts = layoutPlugin.getNumLayouts()
7  # If numLayouts is greater than zero, then the model uses Layout.

The special, always-available Level 2 Layout behavior was motivated by a desire to support legacy applications. In SBML Level 3, the Layout package uses the normal SBML Level 3 scheme of requiring declarations on the SBML document element. This means that upon reading a model, libSBML knows right away whether it contains layout information. In SBML Level 2, there is no top-level declaration because layout is stored as annotations in the body of the model. Detecting the presence of layout information when reading a Level 2 model requires parsing the annotations. For efficiency reasons, libSBML normally does not parse annotations automatically when reading a model. However, applications that predated the introduction of Level 3 Layout and the updated version of libSBML never had to do anything special to enable parsing layout; the facilities were always available for every Level 2 model as long as libSBML was compiled with Layout support. To avoid burdening developers of legacy applications with the need to modify their software, libSBML provides backward compatibility by always preloading the Layout package extension when reading Level 2 models. The same applies to the creation of Level 2 models: with the plugin-oriented libSBML, applications normally would have to take deliberate steps to activate package code, instantiate objects, manage namespaces, and so on. LibSBML again loads the Layout package plugin automatically when creating a Level 2 model, thereby making the APIs available to legacy applications without further work on their part.

Returns the number of SBasePluginCreatorBase objects stored in this object.

getNumOfSBasePlugins()   int
Returns
the total number of SBasePluginCreatorBase objects stored in this SBMLExtension-derived object.
def libsbml.SBMLExtension.getNumOfSupportedPackageURI (   self)
inherited

Returns the number of supported package namespace URIs.

getNumOfSupportedPackageURI()   long
Returns
the number of supported package XML namespace URIs of this package extension.
def libsbml.CompExtension.getPackageVersion (   self,
  uri 
)

Returns the package version for the given URI of this package.

getPackageVersion(string uri)   long
Parameters
urithe string of URI that represents one of versions of the “comp” package
Returns
the package version with the given URI of this package, or 0 if the given URI is invalid.
def libsbml.CompExtension.getSBMLExtensionNamespaces (   self,
  uri 
)

Returns an CompPkgNamespaces object.

getSBMLExtensionNamespaces(string uri)   SBMLNamespaces
Parameters
urithe string of URI that represents one of versions of the “comp” package
Returns
an CompPkgNamespace object corresponding to the given uri, or None if the URI is not defined in the Hierarchical Model Composition package.
def libsbml.CompExtension.getStringFromTypeCode (   self,
  typeCode 
)

Takes a type code of the “comp” package and returns a string describing the code.

getStringFromTypeCode(int typeCode)   string
def libsbml.SBMLExtension.getSupportedPackageURI (   self,
  args 
)
inherited

Returns the nth XML namespace URI.

getSupportedPackageURI(long n)   string
Parameters
nthe index number of the namespace URI being sought.
Returns
a string representing the XML namespace URI understood to be supported by this package. An empty string will be returned if there is no nth URI.
def libsbml.CompExtension.getURI (   self,
  sbmlLevel,
  sbmlVersion,
  pkgVersion 
)

Returns the namespace URI corresponding to the combination of the given SBML Level, Version, and package version.

getURI(long sbmlLevel, long sbmlVersion, long pkgVersion)   string
Parameters
sbmlLevelthe level of SBML
sbmlVersionthe version of SBML
pkgVersionthe version of package
Returns
a string of the package URI, or an empty string if no corresponding URI exists.
def libsbml.SBMLExtension.getURI (   self,
  args 
)
inherited

Returns the XML namespace URI for a given Level and Version.

getURI(long sbmlLevel, long sbmlVersion, long pkgVersion)   string
Parameters
sbmlLevelthe SBML Level.
sbmlVersionthe SBML Version.
pkgVersionthe version of the package.
Returns
a string, the XML namespace URI for the package for the given SBML Level, SBML Version, and package version.
Note
This is a method that package extension implementations must override. See the libSBML documentation on extending libSBML to support SBML packages for more information on this topic.
def libsbml.CompExtension.getVersion (   self,
  uri 
)

Returns the SBML Version for the given URI of this package.

getVersion(string uri)   long
Parameters
urithe string of URI that represents one of versions of the “comp” package
Returns
the SBML version with the given URI of this package, or 0 if the given URI is invalid.
def libsbml.CompExtension.getXmlnsL3V1V1 ( )

Returns the XML namespace URI of the SBML Level 3 package implemented by this libSBML extension.

getXmlnsL3V1V1()   string
Returns
the XML namespace as a string.
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.SBMLExtension.isEnabled (   self)
inherited

Returns True if this package is enabled.

isEnabled()   bool
Returns
True if this package is enabled, False otherwise.
def libsbml.SBMLExtension.isInUse (   self,
  args 
)
inherited

Indicates whether this extension is being used by the given SBMLDocument.

isInUse(SBMLDocument doc)   bool

The default implementation returns True. This means that when a document had this extension enabled, it will not be possible to convert it to SBML Level 2 as we cannot make sure that the extension can be converted.

Parameters
docthe SBML document to test.
Returns
a boolean indicating whether the extension is actually being used by the document.
def libsbml.SBMLExtension.isSupported (   self,
  args 
)
inherited

Returns True if the given XML namespace URI is supported by this package extension.

isSupported(string uri)   bool
Returns
True if the given XML namespace URI (equivalent to a package version) is supported by this package extension, False otherwise.
def libsbml.SBMLExtension.setEnabled (   self,
  args 
)
inherited

Enable or disable this package.

setEnabled(bool isEnabled)   bool
Parameters
isEnabledflag indicating whether to enable (if True) or disable (False) this package extension.
Returns
True if this call succeeded; False otherwise.