{comp}
comp
A model instance inside another model.
The Submodel class was introduced by the SBML Level 3 Hierarchical Model Composition (“comp”) package as the principle way by which models are structured hierarchically. Submodels are instantiations of models contained within other models. They reference another Model that is to be instantiated within its parent Model, and additionally define how that Model is to be modified before instantiation.
The Submodel object class has a required attribute "modelRef", which must reference another Model or ExternalModelDefinition object present in the SBML Document. This referenced Model is the model to be instantiated.
It also has a required attribute, "id", to give the submodel a unique identifier by which other parts of an SBML model definition can refer to it, and an optional "name" attribute of type string
. Identifiers and names must be used according to the guidelines described in the SBML specification.
The Submodel class also provides constructs that define how the referenced Model object is to be modified before it is instantiated in the enclosing model. If numerical values in the referenced model must be changed in order to fit them into their new context as part of the submodel, the changes can be handled through conversion factors. If one or more structural features in the referenced model are undesirable and should be removed, the changes can be handled through deletions. (For example, an initial assignment or reaction may not be relevant in its new context and should be removed.)
In some cases, the referenced Model may have been written with different units than the containing model. For most model elements, this is not a problem: it is already possible to have Species and Parameter objects with different units in a single model, for example, so in this case the resulting hierarchical model would be treated in exactly the same way as any other model with Species and Parameters with different units.
However, two units in SBML models are fixed and must not vary between SBML elements: time and extent. The units of time are set once per model, and affect the core elements of RateRule, KineticLaw, Delay, and the csymbols 'time' and 'delay'. Even if the model does not explicitly state what the units of time actually are, they are defined to be consistent across the model, and therefore might differ from the units of time across a parent model. To correct this imbalance, the optional attribute "timeConversionFactor" may be used, which, if defined, must reference a constant parameter in the parent model. The value of the time conversion factor should be defined such that a single unit of time in the Submodel multiplied by the time conversion factor should equal a single unit of time in the parent model.
Extent is the unit in SBML that defines how the KineticLaw of a Reaction affects species quantities: kinetic laws are defined to be in units of extent/time. No other SBML core construct is defined in terms of extent. If the effective units of extent in a submodel differ from the effective units of extent in the parent model (regardless of whether either defined what those units actually are), the optional attribute "extentConversionFactor" may be used, which, if defined, must reference a constant parameter in the parent model. The value of the extent conversion factor should be defined such that a single unit of extent in the Submodel multiplied by the extent conversion factor should equal a single unit of extent in the parent model.
If features of the referenced model must be removed, a Deletion should be added to the Submodel object. A Submodel may contain a child ListOfDeletions, which in turn may contain one or more Deletion items. Each Deletion references a single element of the referenced Model that must be removed before instantiating that Model as a submodel of the parent Model.
- Examples:
- spec_example1.cpp, spec_example2.cpp, spec_example3.cpp, and spec_example4.cpp.
|
int | addDeletion (const Deletion *deletion) |
| Adds a copy of the given Deletion object to the list of deletions. More...
|
|
virtual void | clearInstantiation () |
| Delete the instantiated Model, if it exists. More...
|
|
virtual Submodel * | clone () const |
| Creates and returns a deep copy of this Submodel object. More...
|
|
virtual int | convertTimeAndExtent () |
| Convert all references to time and extent in the instantiated Model, according to the timeConversionFactor and extentConversionFactor attributes. More...
|
|
Deletion * | createDeletion () |
| Creates a Deletion object, adds it to the end of the deletion objects list and returns a pointer to the newly created object. More...
|
|
virtual List * | getAllElements (ElementFilter *filter=NULL) |
| Returns a List of all child SBase objects, including those nested to an arbitrary depth. More...
|
|
virtual List * | getAllInstantiatedElements () |
| Get all instantiated sub-elements, including any elements from instantiated submodels, etc. More...
|
|
Deletion * | getDeletion (unsigned int n) |
| Returns the deletion with the given index. More...
|
|
const Deletion * | getDeletion (unsigned int n) const |
| Returns the deletion with the given index. More...
|
|
Deletion * | getDeletion (std::string id) |
| Returns the deletion with the given id . More...
|
|
const Deletion * | getDeletion (std::string id) const |
| Returns the deletion with the given id . More...
|
|
virtual SBase * | getElementByMetaId (const std::string &metaid) |
| Returns the first child element it can find with the given metaid , or itself if it has the given metaid , or NULL if no such object is found. More...
|
|
virtual SBase * | getElementBySId (const std::string &id) |
| Returns the first child element found that has the given id in the model-wide SId namespace, or NULL if no such object is found. More...
|
|
virtual const std::string & | getElementName () const |
| Returns the XML element name of this SBML object. More...
|
|
virtual const std::string & | getExtentConversionFactor () const |
| Returns the value of the "extentConversionFactor" attribute of this Submodel. More...
|
|
virtual const std::string & | getId () const |
| Returns the value of the "id" attribute of this Submodel. More...
|
|
virtual Model * | getInstantiation () |
| Get the instantiated Model this Submodel contains rules to create. More...
|
|
virtual const Model * | getInstantiation () const |
| Get the instantiated Model this Submodel contains rules to create. More...
|
|
const ListOfDeletions * | getListOfDeletions () const |
| Returns the ListOf object that holds all deletions. More...
|
|
ListOfDeletions * | getListOfDeletions () |
| Returns the ListOf object that holds all deletions. More...
|
|
virtual const std::string & | getModelRef () const |
| Returns the value of the "modelRef" attribute of this Submodel. More...
|
|
virtual const std::string & | getName () const |
| Returns the value of the "name" attribute of this Submodel. More...
|
|
unsigned int | getNumDeletions () const |
| Returns the number of deletions for this Submodel. More...
|
|
virtual const std::string & | getSubstanceConversionFactor () const |
| Returns an empty string, since "substanceConversionFactor" is not a part of the comp spec. More...
|
|
virtual const std::string & | getTimeConversionFactor () const |
| Returns the value of the "timeConversionFactor" attribute of this Submodel. More...
|
|
virtual int | getTypeCode () const |
| Returns the libSBML type code of this object instance. More...
|
|
virtual bool | hasRequiredAttributes () const |
| Returns true if the 'submodel' attribute is set, and if getNumReferents() is exactly 1. More...
|
|
virtual int | instantiate () |
| Find and create a local copy of the Model object referenced by this Submodel. More...
|
|
virtual bool | isSetExtentConversionFactor () const |
| Predicate returning true or false depending on whether this Submodel's "extentConversionFactor" attribute has been set. More...
|
|
virtual bool | isSetId () const |
| Predicate returning true or false depending on whether this Submodel's "id" attribute has been set. More...
|
|
virtual bool | isSetModelRef () const |
| Predicate returning true or false depending on whether this Submodel's "modelRef" attribute has been set. More...
|
|
virtual bool | isSetName () const |
| Predicate returning true or false depending on whether this Submodel's "name" attribute has been set. More...
|
|
virtual bool | isSetSubstanceConversionFactor () const |
| Returns false , since "substanceConversionFactor" is not a part of the comp spec. More...
|
|
virtual bool | isSetTimeConversionFactor () const |
| Predicate returning true or false depending on whether this Submodel's "timeConversionFactor" attribute has been set. More...
|
|
Submodel & | operator= (const Submodel &source) |
| Assignment operator. More...
|
|
virtual int | performDeletions () |
| Delete elements in the instantiated submodel, based on any Deletions from this Submodel's listOfDeletions. More...
|
|
Deletion * | removeDeletion (unsigned int index) |
| Removes the deletion with the given index from the Submodel. More...
|
|
Deletion * | removeDeletion (const std::string &sid) |
| Removes the deletion with the given identifier from the Submodel. More...
|
|
virtual void | renameSIdRefs (const std::string &oldid, const std::string &newid) |
| Renames the conversion factor attributes on this element if oldid matches. More...
|
|
virtual int | replaceElement (SBase *toReplace, SBase *replacement) |
| Delete the element in question from the stored instantiated Model, and replace all references to it with references to the replacement object. More...
|
|
virtual int | setExtentConversionFactor (const std::string &id) |
| Sets the value of the "extentConversionFactor" attribute of this Submodel. More...
|
|
virtual int | setId (const std::string &id) |
| Sets the value of the "id" attribute of this Submodel. More...
|
|
virtual int | setModelRef (const std::string &modelRef) |
| Sets the value of the "modelRef" attribute of this Submodel. More...
|
|
virtual int | setName (const std::string &name) |
| Sets the value of the "name" attribute of this Submodel. More...
|
|
virtual int | setSubstanceConversionFactor (const std::string &id) |
| Automatically fails, since "substanceConversionFactor" is not a part of the comp spec. More...
|
|
virtual int | setTimeConversionFactor (const std::string &id) |
| Sets the value of the "timeConversionFactor" attribute of this Submodel. More...
|
|
| Submodel (unsigned int level=CompExtension::getDefaultLevel(), unsigned int version=CompExtension::getDefaultVersion(), unsigned int pkgVersion=CompExtension::getDefaultPackageVersion()) |
| Creates a new Submodel with the given level, version, and package version. More...
|
|
| Submodel (CompPkgNamespaces *compns) |
| Creates a new Submodel with the given CompPkgNamespaces object. More...
|
|
| Submodel (const Submodel &source) |
| Copy constructor. More...
|
|
virtual int | unsetExtentConversionFactor () |
| Unsets the value of the "extentConversionFactor" attribute of this Submodel. More...
|
|
virtual int | unsetId () |
| Unsets the value of the "id" attribute of this Submodel. More...
|
|
virtual int | unsetModelRef () |
| Unsets the value of the "modelRef" attribute of this Submodel. More...
|
|
virtual int | unsetName () |
| Unsets the value of the "name" attribute of this Submodel. More...
|
|
virtual int | unsetSubstanceConversionFactor () |
| Automatically fails, since "substanceConversionFactor" is not a part of the comp spec. More...
|
|
virtual int | unsetTimeConversionFactor () |
| Unsets the value of the "timeConversionFactor" attribute of this Submodel. More...
|
|
virtual | ~Submodel () |
| Destructor. More...
|
|