public class ExternalModelDefinition extends CompBase
The ExternalModelDefinition
class was introduced by the SBML Level 3
'Hierarchical Model Composition'
package (&ldquocomp&rdquo) to define references to Model
objects defined in other files.
ExternalModelDefinition
objects are model definitions&mdashin 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.
Constructor and Description |
---|
ExternalModelDefinition()
Creates a new
ExternalModelDefinition with the given level, version, and
package version. |
ExternalModelDefinition(CompPkgNamespaces compns)
Creates a new
ExternalModelDefinition with the given CompPkgNamespaces
object. |
ExternalModelDefinition(ExternalModelDefinition source)
Copy constructor.
|
ExternalModelDefinition(long level)
Creates a new
ExternalModelDefinition with the given level, version, and
package version. |
ExternalModelDefinition(long level,
long version)
Creates a new
ExternalModelDefinition with the given level, version, and
package version. |
ExternalModelDefinition(long level,
long version,
long pkgVersion)
Creates a new
ExternalModelDefinition with the given level, version, and
package version. |
Modifier and Type | Method and Description |
---|---|
SBase |
cloneObject()
Creates and returns a deep copy of this
ExternalModelDefinition object. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getElementName()
Returns the XML element name of this SBML object.
|
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
ExternalModelDefinition . |
java.lang.String |
getMd5()
Returns the value of the 'md5' attribute of this
ExternalModelDefinition . |
java.lang.String |
getModelRef()
Returns the value of the 'modelRef' attribute of this
ExternalModelDefinition . |
java.lang.String |
getName()
Returns the value of the 'name' attribute of this
ExternalModelDefinition . |
Model |
getReferencedModel()
Resolves and returns the referenced
Model object of this ExternalModelDefinition . |
java.lang.String |
getSource()
Returns the value of the 'source' attribute of this
ExternalModelDefinition . |
int |
getTypeCode()
Returns the libSBML type code of this object instance.
|
boolean |
hasRequiredAttributes()
Returns true if the 'modelRef' and 'id' attributes are set, and false if not.
|
boolean |
isSetId()
Predicate returning
true or false depending on whether this
object's 'id' attribute has been set. |
boolean |
isSetMd5()
Predicate returning
true or false depending on whether this
ExternalModelDefinition 's 'md5' attribute has been set. |
boolean |
isSetModelRef()
Predicate returning
true or false depending on whether this
ExternalModelDefinition 's 'modelRef' attribute has been set. |
boolean |
isSetName()
Predicate returning
true or false depending on whether this
object's 'name' attribute has been set. |
boolean |
isSetSource()
Predicate returning
true or false depending on whether this
ExternalModelDefinition 's 'source' attribute has been set. |
int |
setId(java.lang.String id)
Sets the value of the 'id' attribute of this
ExternalModelDefinition . |
int |
setMd5(java.lang.String md5)
Sets the value of the 'md5' attribute of this
ExternalModelDefinition . |
int |
setModelRef(java.lang.String id)
Sets the value of the 'modelRef' attribute of this
ExternalModelDefinition . |
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this
ExternalModelDefinition . |
int |
setSource(java.lang.String source)
Sets the value of the 'source' attribute of this
ExternalModelDefinition . |
int |
unsetId()
Unsets the value of the 'id' attribute of this
ExternalModelDefinition . |
int |
unsetMd5()
Unsets the value of the 'md5' attribute of this
ExternalModelDefinition . |
int |
unsetModelRef()
Unsets the value of the 'modelRef' attribute of this
ExternalModelDefinition . |
int |
unsetName()
Unsets the value of the 'name' attribute of this
ExternalModelDefinition . |
int |
unsetSource()
Unsets the value of the 'source' attribute of this
ExternalModelDefinition . |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, connectToChild, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm, unsetUserData
public ExternalModelDefinition(long level, long version, long pkgVersion) throws SBMLConstructorException
ExternalModelDefinition
with the given level, version, and
package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public ExternalModelDefinition(long level, long version) throws SBMLConstructorException
ExternalModelDefinition
with the given level, version, and
package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public ExternalModelDefinition(long level) throws SBMLConstructorException
ExternalModelDefinition
with the given level, version, and
package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public ExternalModelDefinition() throws SBMLConstructorException
ExternalModelDefinition
with the given level, version, and
package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public ExternalModelDefinition(CompPkgNamespaces compns) throws SBMLConstructorException
ExternalModelDefinition
with the given CompPkgNamespaces
object.
compns
- the namespace to use.SBMLConstructorException
public ExternalModelDefinition(ExternalModelDefinition source) throws SBMLConstructorException
source
- the object to copy.SBMLConstructorException
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the ExternalModelDefinition.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke ExternalModelDefinition.delete()
themselves.
public SBase cloneObject()
ExternalModelDefinition
object.
cloneObject
 in class SBase
ExternalModelDefinition
objectpublic int setId(java.lang.String id)
ExternalModelDefinition
.
This method fails if the id
is not a valid syntax for an SId.
public java.lang.String getId()
ExternalModelDefinition
.
getId
 in class SBase
ExternalModelDefinition
.public boolean isSetId()
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 set
Attribute(...)
,
unset
Attribute()
, and
isSet
Attribute()
, where Attribute is the the name of the optional
attribute in question.
public int unsetId()
ExternalModelDefinition
.
public int setName(java.lang.String name)
ExternalModelDefinition
.
The string in name
is copied.
setName
 in class SBase
name
- the new name for the ExternalModelDefinition
public java.lang.String getName()
ExternalModelDefinition
.
getName
 in class SBase
ExternalModelDefinition
.public boolean isSetName()
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 set
Attribute(...)
,
unset
Attribute()
, and
isSet
Attribute()
, where Attribute is the the name of the optional
attribute in question.
public int unsetName()
ExternalModelDefinition
.
public java.lang.String getModelRef()
ExternalModelDefinition
.
ExternalModelDefinition
.public boolean isSetModelRef()
true
or false
depending on whether this
ExternalModelDefinition
's 'modelRef' attribute has been set.
true
if this ExternalModelDefinition
's 'modelRef' attribute
has been set, otherwise false
is returned.public int setModelRef(java.lang.String id)
ExternalModelDefinition
. Fails if the id
is not a valid syntax for an
SIdRef.
public int unsetModelRef()
ExternalModelDefinition
.
public java.lang.String getMd5()
ExternalModelDefinition
.
ExternalModelDefinition
.public boolean isSetMd5()
true
or false
depending on whether this
ExternalModelDefinition
's 'md5' attribute has been set.
true
if this ExternalModelDefinition
's 'md5' attribute has
been set, otherwise false
is returned.public int setMd5(java.lang.String md5)
ExternalModelDefinition
.
public int unsetMd5()
ExternalModelDefinition
.
public java.lang.String getSource()
ExternalModelDefinition
.
ExternalModelDefinition
.public boolean isSetSource()
true
or false
depending on whether this
ExternalModelDefinition
's 'source' attribute has been set.
true
if this ExternalModelDefinition
's 'source' attribute has
been set, otherwise false
is returned.public int setSource(java.lang.String source)
ExternalModelDefinition
.
source
- the value to use for the 'source' attribute.
public int unsetSource()
ExternalModelDefinition
.
public boolean hasRequiredAttributes()
This method does not check to see if the referred-to model actually exists.
hasRequiredAttributes
 in class SBase
true
if the attributes are correctly set false
if not.public java.lang.String getElementName()
getElementName
 in class SBase
public int getTypeCode()
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 Java language interface for libSBML, the
type codes are defined as static integer constants in the interface class
libsbmlConstants
. 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.
getTypeCode
 in class SBase
SBML_COMP_EXTERNALMODELDEFINITION
ExternalModelDefinition.getElementName()
,
CompBase.getPackageName()
public Model getReferencedModel()
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.