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

Detailed Description

comp An interface to be used in composition.

The Port class was introduced by the SBML Level 3 Hierarchical Model Composition package (“comp”) to allow a Model to define a standard interface between it and other models that might use it as a submodel. It derives from the SBaseRef class, and the elements defined there refer to elements in the same parent Model as the Port object. A Port object instance therefore uses those attributes to define a port for a component in a model. When other SBaseRef or SBaseRef-derived classes refer to a Port object using a 'portRef' attribute, the element being referenced is the element the Port object itself points to.

In the present formulation of the Hierarchical Model Composition package, the use of ports is not enforced, nor is there any mechanism to restrict which ports may be used in what ways—they are only an advisory construct. Future versions of this SBML package may provide additional functionality to support explicit restrictions on port use. For the present definition of Hierarchical Model Composition, users of models containing ports are encouraged to respect the modeler's intention in defining ports, and use the port definitions to interact with components through their ports (when they have ports defined) rather than interact directly with the components.

The required attribute 'id' is used to give an identifier to a Port object so that other objects can refer to it. The attribute has type PortSId and is essentially identical to the SBML primitive type SId, except that its namespace is limited to the identifiers of Port objects defined within a Model object. In parallel, the PortSId type has a companion type, PortSIdRef, that corresponds to the SBML primitive type SIdRef; the value space of PortSIdRef is limited to PortSId values.

Public Member Functions

def __init__ (self, args)
 comp An interface to be used in composition. More...
 
def clearReferencedElement (self)
 Removes the saved referenced element, if it had been saved earlier. More...
 
def clone (self)
 Creates and returns a deep copy of this Port object. More...
 
def connectToChild (self)
 
def createSBaseRef (self)
 Creates a new, empty SBaseRef, adds it to this SBaseRef and returns the created SBaseRef. More...
 
def getElementByMetaId (self, metaid)
 Returns the first child element it can find with the given metaid, or itself if it has 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 SBML object. More...
 
def getId (self)
 Returns the value of the 'id' attribute of this Port. More...
 
def getIdRef (self)
 Returns the value of the 'idRef' attribute of this SBaseRef. More...
 
def getMetaIdRef (self)
 Returns the value of the 'metaIdRef' attribute of this SBaseRef. More...
 
def getName (self)
 Returns the value of the 'name' attribute of this Port. More...
 
def getNumReferents (self)
 Returns how many elements are being referred to by this SBaseRef. More...
 
def getPortRef (self)
 Returns the value of the 'portRef' attribute of this SBaseRef. More...
 
def getReferencedElement (self)
 Returns the object pointed to by this element. More...
 
def getReferencedElementFrom (self, model)
 Examines the referenced Model for the referenced object, and returns it, if found. More...
 
def getSBaseRef (self, args)
 Get the child sBaseRef of this sBaseRef. More...
 
def getTypeCode (self)
 Returns the libSBML type code of this object instance. More...
 
def getUnitRef (self)
 Returns the value of the 'unitRef' attribute of this SBaseRef. More...
 
def hasRequiredAttributes (self)
 Returns true if the 'id' attribute is set, and if exactly one of the optional attributes of SBaseRef (portRef, idRef, metaIdRef, and unitRef)are set. More...
 
def isSetId (self)
 Predicate returning True or False depending on whether this Port's 'id' attribute has been set. More...
 
def isSetIdRef (self)
 Predicate returning True or False depending on whether this SBaseRef's 'idRef' attribute has been set. More...
 
def isSetMetaIdRef (self)
 Predicate returning True or False depending on whether this SBaseRef's 'metaIdRef' attribute has been set. More...
 
def isSetName (self)
 Predicate returning True or False depending on whether this Port's 'name' attribute has been set. More...
 
def isSetPortRef (self)
 Predicate returning True or False depending on whether this SBaseRef's 'portRef' attribute has been set. More...
 
def isSetSBaseRef (self)
 Predicate for testing whether the sBaseRef for this SBaseRef is set. More...
 
def isSetUnitRef (self)
 Predicate returning True or False depending on whether this SBaseRef's 'unitRef' attribute has been set. More...
 
def performDeletion (self)
 DEPRECATED FUNCTION: DO NOT USE. More...
 
def removeFromParentAndDelete (self)
 Finds this SBaseRef's parent, which can either be a List or can be another SBaseRef, and tells it to remove this. 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 saveReferencedElement (self)
 Finds and stores the referenced object by finding its Model parent, calling 'getReferencedElementFrom()' on that model, and storing the result. More...
 
def setId (self, id)
 Sets the value of the 'id' attribute of this Port. More...
 
def setIdRef (self, id)
 Sets the value of the 'idRef' attribute of this SBaseRef. More...
 
def setMetaIdRef (self, id)
 Sets the value of the 'metaIdRef' attribute of this SBaseRef. More...
 
def setName (self, name)
 Sets the value of the 'name' attribute of this Port. More...
 
def setPortRef (self, id)
 Overrides SBaseRef::setPortRef to always fail, because Port objects themselves cannot refer to model elements by PortSId. More...
 
def setSBaseRef (self, sBaseRef)
 Sets the sBaseRef definition of this SBaseRef to a copy of the given SBaseRef object instance. More...
 
def setUnitRef (self, id)
 Sets the value of the 'unitRef' attribute of this SBaseRef. More...
 
def unsetId (self)
 Unsets the value of the 'id' attribute of this Port. More...
 
def unsetIdRef (self)
 Unsets the value of the 'idRef' attribute of this SBaseRef. More...
 
def unsetMetaIdRef (self)
 Unsets the value of the 'metaIdRef' attribute of this SBaseRef. More...
 
def unsetName (self)
 Unsets the value of the 'name' attribute of this Port. More...
 
def unsetPortRef (self)
 Unsets the value of the 'portRef' attribute of this SBaseRef. More...
 
def unsetSBaseRef (self)
 Unsets the child SBaseRef of this SBaseRef. More...
 
def unsetUnitRef (self)
 Unsets the value of the 'unitRef' attribute of this SBaseRef. More...
 

Member Function Documentation

def libsbml.SBaseRef.clearReferencedElement (   self)
inherited

Removes the saved referenced element, if it had been saved earlier.

clearReferencedElement()
def libsbml.Port.clone (   self)

Creates and returns a deep copy of this Port object.

clone()   Port
Returns
a (deep) copy of this Port object
def libsbml.SBaseRef.connectToChild (   self)
inherited
connectToChild()
def libsbml.SBaseRef.createSBaseRef (   self)
inherited

Creates a new, empty SBaseRef, adds it to this SBaseRef and returns the created SBaseRef.

createSBaseRef()   SBaseRef
Returns
the newly created SBaseRef object instance.
def libsbml.SBaseRef.getElementByMetaId (   self,
  metaid 
)
inherited

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

getElementByMetaId(string metaid)   SBase
Parameters
metaidstring representing the metaid of objects to find
Returns
a pointer to the SBase element with the given metaid.
def libsbml.SBaseRef.getElementBySId (   self,
  id 
)
inherited

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 objects to find
Returns
a pointer to the SBase element with the given id.
def libsbml.Port.getElementName (   self)

Returns the XML element name of this SBML object.

getElementName()   string
Returns
the name of this element, as a text string.
def libsbml.Port.getId (   self)

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

getId()   string
Returns
the value of the 'id' attribute of this Port.
def libsbml.SBaseRef.getIdRef (   self)
inherited

Returns the value of the 'idRef' attribute of this SBaseRef.

getIdRef()   string
Returns
the value of the 'idRef' attribute of this SBaseRef.
def libsbml.SBaseRef.getMetaIdRef (   self)
inherited

Returns the value of the 'metaIdRef' attribute of this SBaseRef.

getMetaIdRef()   string
Returns
the value of the 'metaIdRef' attribute of this SBaseRef.
def libsbml.Port.getName (   self)

Returns the value of the 'name' attribute of this Port.

getName()   string
Returns
the value of the 'name' attribute of this Port.
def libsbml.SBaseRef.getNumReferents (   self)
inherited

Returns how many elements are being referred to by this SBaseRef.

getNumReferents()   int

A valid SBaseRef will have exactly one. Possible referents are portRef, idRef, unitRef, and metaIdRef.

Returns
integer value between 0 and 4: the number of different ways this element points to its referent.
def libsbml.SBaseRef.getPortRef (   self)
inherited

Returns the value of the 'portRef' attribute of this SBaseRef.

getPortRef()   string
Returns
the value of the 'portRef' attribute of this SBaseRef.
def libsbml.SBaseRef.getReferencedElement (   self)
inherited

Returns the object pointed to by this element.

getReferencedElement()   SBase

If that element was previously found and set with 'saveReferencedElement', that element is returned; otherwise, 'saveReferencedElement' is called first, and the found element is returned.

def libsbml.SBaseRef.getReferencedElementFrom (   self,
  model 
)
inherited

Examines the referenced Model for the referenced object, and returns it, if found.

getReferencedElementFrom(Model model)   SBase
Parameters
modelthe Model in which to look for the object referenced by this SBaseRef.
Returns
the element in the referenced Model to which this SBaseRef refers. If this object references an object in a Submodel, the returned object will be in the instantiated Model in that Submodel.
def libsbml.SBaseRef.getSBaseRef (   self,
  args 
)
inherited

Get the child sBaseRef of this sBaseRef.

getSBaseRef()   SBaseRef
Returns
the SBaseRef child of this SBaseRef, or None if none exists.
def libsbml.Port.getTypeCode (   self)

Returns the libSBML type code of 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 getPackageName() method on the object.
Returns
the SBML type code for this object: SBML_COMP_PORT
Warning
The specific integer values of the possible type codes may be reused by different Level 3 package plug-ins. Thus, to identifiy the correct code, it is necessary to invoke both getTypeCode() and getPackageName().
See also
getElementName()
getPackageName()
def libsbml.SBaseRef.getUnitRef (   self)
inherited

Returns the value of the 'unitRef' attribute of this SBaseRef.

getUnitRef()   string
Returns
the value of the 'unitRef' attribute of this SBaseRef.
def libsbml.Port.hasRequiredAttributes (   self)

Returns true if the 'id' attribute is set, and if exactly one of the optional attributes of SBaseRef (portRef, idRef, metaIdRef, and unitRef)are set.

hasRequiredAttributes()   bool
Returns
boolean: 'true' if the attributes are correctly set; 'false' if not.
def libsbml.Port.isSetId (   self)

Predicate returning True or False depending on whether this Port's 'id' attribute has been set.

isSetId()   bool
Returns
True if this Port's 'id' attribute has been set, otherwise False is returned.
def libsbml.SBaseRef.isSetIdRef (   self)
inherited

Predicate returning True or False depending on whether this SBaseRef's 'idRef' attribute has been set.

isSetIdRef()   bool
Returns
True if this SBaseRef's 'idRef' attribute has been set, otherwise False is returned.
def libsbml.SBaseRef.isSetMetaIdRef (   self)
inherited

Predicate returning True or False depending on whether this SBaseRef's 'metaIdRef' attribute has been set.

isSetMetaIdRef()   bool
Returns
True if this SBaseRef's 'metaIdRef' attribute has been set, otherwise False is returned.
def libsbml.Port.isSetName (   self)

Predicate returning True or False depending on whether this Port's 'name' attribute has been set.

isSetName()   bool
Returns
True if this Port's 'name' attribute has been set, otherwise False is returned.
def libsbml.SBaseRef.isSetPortRef (   self)
inherited

Predicate returning True or False depending on whether this SBaseRef's 'portRef' attribute has been set.

isSetPortRef()   bool
Returns
True if this SBaseRef's 'portRef' attribute has been set, otherwise False is returned.
def libsbml.SBaseRef.isSetSBaseRef (   self)
inherited

Predicate for testing whether the sBaseRef for this SBaseRef is set.

isSetSBaseRef()   bool
Returns
True if the sBaseRef of this SBaseRef is set, False otherwise.
def libsbml.SBaseRef.isSetUnitRef (   self)
inherited

Predicate returning True or False depending on whether this SBaseRef's 'unitRef' attribute has been set.

isSetUnitRef()   bool
Returns
True if this SBaseRef's 'unitRef' attribute has been set, otherwise False is returned.
def libsbml.SBaseRef.performDeletion (   self)
inherited

DEPRECATED FUNCTION: DO NOT USE.

Deletes the referenced object, plus any other elements that element points to through ReplacedElement or ReplacedBy children.

performDeletion()   int

Instead of calling this function directly, use 'CompModelPlugin::instantiateSubmodels' instead, which deals with all the intricacies of replacements and deletions, and gives you access to the non-flattened hierarchical form of the model.

def libsbml.SBaseRef.removeFromParentAndDelete (   self)
inherited

Finds this SBaseRef's parent, which can either be a List or can be another SBaseRef, and tells it to remove this.

removeFromParentAndDelete()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.Port.renameMetaIdRefs (   self,
  oldid,
  newid 
)

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.Port.renameSIdRefs (   self,
  oldid,
  newid 
)

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 SIdRefin 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.Port.renameUnitSIdRefs (   self,
  oldid,
  newid 
)

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.Port.saveReferencedElement (   self)

Finds and stores the referenced object by finding its Model parent, calling 'getReferencedElementFrom()' on that model, and storing the result.

saveReferencedElement()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.Port.setId (   self,
  id 
)

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

setId(string id)   int

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

Parameters
idthe identifier for the port
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBaseRef.setIdRef (   self,
  id 
)
inherited

Sets the value of the 'idRef' attribute of this SBaseRef.

setIdRef(string id)   int

This method fails if the id is not a valid syntax for an SIdRef (LIBSBML_INVALID_ATTRIBUTE_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). A sBaseRef must use exactly one method to point to a submodel element.

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

Sets the value of the 'metaIdRef' attribute of this SBaseRef.

setMetaIdRef(string id)   int

This method fails if the id is not a valid syntax for an IDREF (LIBSBML_INVALID_ATTRIBUTE_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). An sBaseRef must use exactly one method to point to a submodel element.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.Port.setName (   self,
  name 
)

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

setName(string name)   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.Port.setPortRef (   self,
  id 
)

Overrides SBaseRef::setPortRef to always fail, because Port objects themselves cannot refer to model elements by PortSId.

setPortRef(string id)   int
Parameters
idthe identifier to set for the port reference
Returns
integer value indicating failure of the function. The possible value returned by this function is:
def libsbml.SBaseRef.setSBaseRef (   self,
  sBaseRef 
)
inherited

Sets the sBaseRef definition of this SBaseRef to a copy of the given SBaseRef object instance.

setSBaseRef(SBaseRef sBaseRef)   int

This method fails if the added sBaseRef does not match the level/version/package of the parent object or if the added sBaseRef cannot be copied.

Parameters
sBaseRefthe SBaseRef object instance to use.
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.SBaseRef.setUnitRef (   self,
  id 
)
inherited

Sets the value of the 'unitRef' attribute of this SBaseRef.

setUnitRef(string id)   int

This method fails if the id is not a valid syntax for a UnitSIdRef (LIBSBML_INVALID_ATTRIBUTE_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). A sBaseRef must use exactly one method to point to a submodel element.

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

Unsets the value of the 'id' attribute of this Port.

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

Unsets the value of the 'idRef' attribute of this SBaseRef.

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

Unsets the value of the 'metaIdRef' attribute of this SBaseRef.

unsetMetaIdRef()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.Port.unsetName (   self)

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

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

Unsets the value of the 'portRef' attribute of this SBaseRef.

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

Unsets the child SBaseRef of this SBaseRef.

unsetSBaseRef()   int

Deletes the former SBaseRef child, if one existed.

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

Unsets the value of the 'unitRef' attribute of this SBaseRef.

unsetUnitRef()   int
Returns
integer value indicating success/failure of the function. The possible values returned by this function are: