libSBML Perl API  libSBML 5.13.0 Perl API
ExternalModelDefinition Class Reference
Inheritance diagram for ExternalModelDefinition:
[legend]

Detailed Description

{comp}

comp A reference to an externally-defined model.

The ExternalModelDefinition class was introduced by the SBML Level 3 Hierarchical Model Composition (“comp”) package to define references to Model objects defined in other files.

ExternalModelDefinition objects are model definitions—in and of themselves, they are definitions of models but not uses of those models. The class provides a way to declare and identify them so that Model objects in the present SBML document can use them in Submodel objects.

ExternalModelDefinition contains two required attributes ("source" and "id") and three optional attributes ("modelRef", "md5" and "name").

The "id" attribute serves to provide a handle for the external model reference so that Submodel objects can refer to it. Crucially, it is not the identifier of the model being referenced; rather, it is an identifier for this ExternalModelDefinition object within the current SBML document. The "id" attribute takes a required value of type SId, and must be unique across all Model and ExternalModelDefinition objects present in the document.

ExternalModelDefinition also has an optional "name" attribute, of type 'string'. The "name" attribute may be used to provide a human-readable description of the ExternalModelDefintion object.

The required attribute "source" is used to locate the SBML document containing an external model definition. The value of this attribute must be of type anyURI. Since URIs may be either URLs, URNs, or relative or absolute file locations, this offers flexibility in referencing SBML documents. In all cases, the "source" attribute value must refer specifically to an SBML Level 3 Version 1 document; prior Levels/Versions of SBML are not supported by this package. The entire file at the given location is referenced. The "source" attribute must have a value for every ExternalModelDefinition instance.

ExternalModelDefinition's optional attribute "modelRef", of type SIdRef, is used to identify a Model or ExternalModelDefinition object within the SBML document located at "source". The object referenced may be the main model in the document, or it may be a model definition contained in the SBML document's ListOfModelDefinitions or ListOfExternalModelDefinitions lists. Loops are not allowed: it must be possible to follow a chain of ExternalModelDefinition objects to its end in a Model object.

In core SBML, the "id" on Model is an optional attribute, and therefore, it is possible that the Model object in a given SBML document does not have an identifier. In that case, there is no value to give to the "modelRef" attribute in ExternalModelDefinition. If "modelRef" does not have a value, then the main model (i.e., the <model> element within the <sbml> element) in the referenced file is interpreted as being the model referenced by this ExternalModelDefinition instance.

Finally, the optional "md5" attribute takes a string value. If set, it must be an MD5 checksum value computed over the document referenced by "source". This checksum can serve as a data integrity check over the contents of the "source". Applications may use this to verify that the contents have not changed since the time that the ExternalModelDefinition reference was constructed.

Public Member Functions

virtual ExternalModelDefinitionclone () const
 Creates and returns a deep copy of this ExternalModelDefinition object. More...
 
 ExternalModelDefinition (unsigned int level=CompExtension::getDefaultLevel(), unsigned int version=CompExtension::getDefaultVersion(), unsigned int pkgVersion=CompExtension::getDefaultPackageVersion())
 Creates a new ExternalModelDefinition with the given level, version, and package version. More...
 
 ExternalModelDefinition (CompPkgNamespaces *compns)
 Creates a new ExternalModelDefinition with the given CompPkgNamespaces object. More...
 
 ExternalModelDefinition (const ExternalModelDefinition &source)
 Copy constructor. More...
 
virtual const std::string & getElementName () const
 Returns the XML element name of this SBML object. More...
 
virtual const std::string & getId () const
 Returns the value of the "id" attribute of this ExternalModelDefinition. More...
 
virtual const std::string & getMd5 () const
 Returns the value of the "md5" attribute of this ExternalModelDefinition. More...
 
virtual const std::string & getModelRef () const
 Returns the value of the "modelRef" attribute of this ExternalModelDefinition. More...
 
virtual const std::string & getName () const
 Returns the value of the "name" attribute of this ExternalModelDefinition. More...
 
virtual ModelgetReferencedModel ()
 Resolves and returns the referenced Model object of this ExternalModelDefinition. More...
 
virtual const std::string & getSource () const
 Returns the value of the "source" attribute of this ExternalModelDefinition. More...
 
virtual int getTypeCode () const
 Returns the libSBML type code of this object instance. More...
 
virtual bool hasRequiredAttributes () const
 Returns true if the "modelRef" and "id" attributes are set, and false if not. More...
 
virtual bool isSetId () const
 Predicate returning true or false depending on whether this object's "id" attribute has been set. More...
 
virtual bool isSetMd5 () const
 Predicate returning true or false depending on whether this ExternalModelDefinition's "md5" attribute has been set. More...
 
virtual bool isSetModelRef () const
 Predicate returning true or false depending on whether this ExternalModelDefinition's "modelRef" attribute has been set. More...
 
virtual bool isSetName () const
 Predicate returning true or false depending on whether this object's "name" attribute has been set. More...
 
virtual bool isSetSource () const
 Predicate returning true or false depending on whether this ExternalModelDefinition's "source" attribute has been set. More...
 
ExternalModelDefinitionoperator= (const ExternalModelDefinition &source)
 Assignment operator. More...
 
virtual int setId (const std::string &id)
 Sets the value of the "id" attribute of this ExternalModelDefinition. More...
 
virtual int setMd5 (const std::string &md5)
 Sets the value of the "md5" attribute of this ExternalModelDefinition. More...
 
virtual int setModelRef (const std::string &id)
 Sets the value of the "modelRef" attribute of this ExternalModelDefinition. More...
 
virtual int setName (const std::string &name)
 Sets the value of the "name" attribute of this ExternalModelDefinition. More...
 
virtual int setSource (const std::string &source)
 Sets the value of the "source" attribute of this ExternalModelDefinition. More...
 
virtual int unsetId ()
 Unsets the value of the "id" attribute of this ExternalModelDefinition. More...
 
virtual int unsetMd5 ()
 Unsets the value of the "md5" attribute of this ExternalModelDefinition. More...
 
virtual int unsetModelRef ()
 Unsets the value of the "modelRef" attribute of this ExternalModelDefinition. More...
 
virtual int unsetName ()
 Unsets the value of the "name" attribute of this ExternalModelDefinition. More...
 
virtual int unsetSource ()
 Unsets the value of the "source" attribute of this ExternalModelDefinition. More...
 
virtual ~ExternalModelDefinition ()
 Destructor. More...
 

Friends

class Submodel
 

Constructor & Destructor Documentation

◆ ExternalModelDefinition() [1/3]

ExternalModelDefinition::ExternalModelDefinition ( unsigned int  level = CompExtension::getDefaultLevel(),
unsigned int  version = CompExtension::getDefaultVersion(),
unsigned int  pkgVersion = CompExtension::getDefaultPackageVersion() 
)

Creates a new ExternalModelDefinition with the given level, version, and package version.

Parameters
levelthe SBML Level
versionthe Version within the SBML Level
pkgVersionthe version of the package

◆ ExternalModelDefinition() [2/3]

ExternalModelDefinition::ExternalModelDefinition ( CompPkgNamespaces compns)

Creates a new ExternalModelDefinition with the given CompPkgNamespaces object.

Parameters
compnsthe namespace to use.

◆ ExternalModelDefinition() [3/3]

ExternalModelDefinition::ExternalModelDefinition ( const ExternalModelDefinition source)

Copy constructor.

Parameters
sourcethe object to copy.

◆ ~ExternalModelDefinition()

ExternalModelDefinition::~ExternalModelDefinition ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

ExternalModelDefinition * ExternalModelDefinition::clone ( ) const
virtual

Creates and returns a deep copy of this ExternalModelDefinition object.

Returns
a (deep) copy of this ExternalModelDefinition object

◆ getElementName()

const std::string & ExternalModelDefinition::getElementName ( ) const
virtual

Returns the XML element name of this SBML object.

Returns
the name of this element, as a text string.

◆ getId()

const string & ExternalModelDefinition::getId ( ) const
virtual

Returns the value of the "id" attribute of this ExternalModelDefinition.

Returns
the name of this ExternalModelDefinition.

◆ getMd5()

const string & ExternalModelDefinition::getMd5 ( ) const
virtual

Returns the value of the "md5" attribute of this ExternalModelDefinition.

Returns
the value of the "md5" attribute of this ExternalModelDefinition.

◆ getModelRef()

const string & ExternalModelDefinition::getModelRef ( ) const
virtual

Returns the value of the "modelRef" attribute of this ExternalModelDefinition.

Returns
the value of the "modelRef" attribute of this ExternalModelDefinition.

◆ getName()

const string & ExternalModelDefinition::getName ( ) const
virtual

Returns the value of the "name" attribute of this ExternalModelDefinition.

Returns
the name of this ExternalModelDefinition.

◆ getReferencedModel()

Model * ExternalModelDefinition::getReferencedModel ( )
virtual

Resolves and returns the referenced Model object of this ExternalModelDefinition.

If none can be found, an error is set and NULL is returned. The returned Model is a non-owning pointer to the model; the original Model is saved (along with the SBMLDocument from which it comes) as a child of the CompSBMLDocumentPlugin of the SBMLDocument to which this Model belongs. If this ExternalModelDefinition is not part of any SBMLDocument, NULL will be returned.

◆ getSource()

const string & ExternalModelDefinition::getSource ( ) const
virtual

Returns the value of the "source" attribute of this ExternalModelDefinition.

Returns
the value of the "source" attribute of this ExternalModelDefinition.

◆ getTypeCode()

int ExternalModelDefinition::getTypeCode ( ) const
virtual

Returns the libSBML type code of this object instance.

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_. 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 getPackageName() method on the object.
Returns
the SBML type code for this object:

◆ hasRequiredAttributes()

bool ExternalModelDefinition::hasRequiredAttributes ( ) const
virtual

Returns true if the "modelRef" and "id" attributes are set, and false if not.

This method does not check to see if the referred-to model actually exists.

Returns
boolean: true if the attributes are correctly set; false if not.

◆ isSetId()

bool ExternalModelDefinition::isSetId ( ) const
virtual

Predicate returning true or false depending on whether this object's "id" attribute has been set.

Some words of explanation about the set/unset/isSet methods: The SBML specifications define certain attributes on some classes of objects as being optional. This requires an application to be careful about the distinction between two cases when reading a model: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value if one exists, and (2) a given attribute has been set to a value, but the value happens to be an empty string. The situation can be ambiguous when reading a model from a file or data stream and then examining the data objects that libSBML constructs as a result. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
Returns
true if the "id" attribute of this object has been set, false otherwise.

◆ isSetMd5()

bool ExternalModelDefinition::isSetMd5 ( ) const
virtual

Predicate returning true or false depending on whether this ExternalModelDefinition's "md5" attribute has been set.

Returns
true if this ExternalModelDefinition's "md5" attribute has been set, otherwise false is returned.

◆ isSetModelRef()

bool ExternalModelDefinition::isSetModelRef ( ) const
virtual

Predicate returning true or false depending on whether this ExternalModelDefinition's "modelRef" attribute has been set.

Returns
true if this ExternalModelDefinition's "modelRef" attribute has been set, otherwise false is returned.

◆ isSetName()

bool ExternalModelDefinition::isSetName ( ) const
virtual

Predicate returning true or false depending on whether this object's "name" attribute has been set.

Some words of explanation about the set/unset/isSet methods: The SBML specifications define certain attributes on some classes of objects as being optional. This requires an application to be careful about the distinction between two cases when reading a model: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value if one exists, and (2) a given attribute has been set to a value, but the value happens to be an empty string. The situation can be ambiguous when reading a model from a file or data stream and then examining the data objects that libSBML constructs as a result. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
Returns
true if the "name" attribute of this object has been set, false otherwise.

◆ isSetSource()

bool ExternalModelDefinition::isSetSource ( ) const
virtual

Predicate returning true or false depending on whether this ExternalModelDefinition's "source" attribute has been set.

Returns
true if this ExternalModelDefinition's "source" attribute has been set, otherwise false is returned.

◆ operator=()

ExternalModelDefinition & ExternalModelDefinition::operator= ( const ExternalModelDefinition source)

Assignment operator.

◆ setId()

int ExternalModelDefinition::setId ( const std::string &  id)
virtual

Sets the value of the "id" attribute of this ExternalModelDefinition.

This method fails if the id is not a valid syntax for an SId.

Parameters
idthe identifier to use

◆ setMd5()

int ExternalModelDefinition::setMd5 ( const std::string &  md5)
virtual

Sets the value of the "md5" attribute of this ExternalModelDefinition.

◆ setModelRef()

int ExternalModelDefinition::setModelRef ( const std::string &  id)
virtual

Sets the value of the "modelRef" attribute of this ExternalModelDefinition.

Fails if the id is not a valid syntax for an SIdRef.

◆ setName()

int ExternalModelDefinition::setName ( const std::string &  name)
virtual

Sets the value of the "name" attribute of this ExternalModelDefinition.

The string in name is copied.

Parameters
namethe new name for the ExternalModelDefinition

◆ setSource()

int ExternalModelDefinition::setSource ( const std::string &  source)
virtual

Sets the value of the "source" attribute of this ExternalModelDefinition.

Parameters
sourcethe value to use for the "source" attribute.

◆ unsetId()

int ExternalModelDefinition::unsetId ( )
virtual

Unsets the value of the "id" attribute of this ExternalModelDefinition.

◆ unsetMd5()

int ExternalModelDefinition::unsetMd5 ( )
virtual

Unsets the value of the "md5" attribute of this ExternalModelDefinition.

◆ unsetModelRef()

int ExternalModelDefinition::unsetModelRef ( )
virtual

Unsets the value of the "modelRef" attribute of this ExternalModelDefinition.

◆ unsetName()

int ExternalModelDefinition::unsetName ( )
virtual

Unsets the value of the "name" attribute of this ExternalModelDefinition.

◆ unsetSource()

int ExternalModelDefinition::unsetSource ( )
virtual

Unsets the value of the "source" attribute of this ExternalModelDefinition.

Friends And Related Function Documentation

◆ Submodel

friend class Submodel
friend