PhysicalEntity
- class pyomexmeta.PhysicalEntity(physical_entity_ptr: ctypes.c_longlong)
Interface for creating PhysicalEntity composite annotations.
PhysicalEntity
implements the Builder pattern, so methods always return a reference to self, so that method calls can be chained together.From section 2.3.7.1 of the OmexMeta specification:
Consider a CellML variable that simulates blood volume in the left coronary artery. The physical property simulated is volume; more precisely, fluid volume. This fluid volume is a property of blood in the lumen of the left coronary artery. Because there is no existing knowledge resource term that represents “blood volume in the left coronary artery”, we instead construct a composite annotation using a combination of existing knowledge resource terms. For the physical property portions, we recommend using terms from the Ontology of Physics for Biology (OPB [13]) because the OPB provides a comprehensive, formally- structured hierarchy of physical properties. In this case, we would use the OPB term “Fluid volume” (OPB:OPB 00154). The second part of the composite annotation, blood in the left ventricle, can be created by linking two terms from the Foundational Model of Anatomy (FMA [14]), namely “Portion of blood” (FMA:9670) and “Lumen of left coronary artery” (FMA:18228). We link these two FMA terms using the isPartOf BioModels.net qualifier to produce a composite physical entity. Thus, the composite annotation links the model element being annotated to the physical property it represents (via the isVersionOf BioModels.net qualifier) as well as to the composite physical entity that bears the property (via the isPropertyOf BioModels.net qualifier).
Encoded as RDF (turtle format), this example would be serialized as:
- myOMEX:MyModel.cellml#VLV bqbiol:isVersionOf opb:OPB_00154 ;
bqbiol:isPropertyOf local:entity_0 .
- local:entity_0 bqbiol:is fma:9670 ;
bqbiol:isPartOf fma:18228 .
Note that the local RDF resource entity 0 needs to be created when encoding the CSA. This is required because there are no structures in the CellML schema that represent physical entities, so they are instantiated as RDF resources in the OMEX metadata document. Such instantiation is often not needed for SBML models, since SBML provides explicit XML elements for representing the bearers of physical properties including chemical species, compartments and reactions, and these elements can have unique metadata identifiers assigned to them.
However, instantiation of a resource that represents the full concept described by the composite annotation is needed for the properties of species, compartments, and reactions in SBML models. Although SBML uses XML structures for declaring physical entities (<compartment> and <species> elements) as well as processes (<reaction> elements), it does not declare XML elements that represent the properties of those entities and processes. Instead, the property is indicated by an XML attribute on the entities and processes. Therefore, to ensure that these properties are searchable in OMEX annotations, we rec- ommend instantiating a generic RDF resource for each physical property that is implicitly represented in an SBML model. Note that this does not have to be done when annotating an SBML parameter because the SBML parameter element includes a metadata ID that can be explicitly referenced in the OMEX metadata file.
- __init__(physical_entity_ptr: ctypes.c_longlong)
Constructor for
PhysicalEntity
.This constructor is not designed to be used directly by users. Instead users should create a
PhysicalEntity
directly from the an instance ofEditor
.- Parameters
physical_entity_ptr – A ctypes int64 integer representing the memory address (pointer) of this PhysicalEntity.
- __weakref__
list of weak references to the object (if defined)
- about(about: str, type: pyomexmeta.pyomexmeta_api.eUriType) → pyomexmeta.pyomexmeta.PhysicalEntity
Sets the about (subject) portion of the PhysicalEntity.
- i.e:
- local:EntityProperty0000 <– Not this. This is the PhysicalProperty “about”
bqbiol:isPropertyOf <http://omex-library.org/NewOmex.omex/NewModel.xml#species0000> ; bqbiol:isVersionOf <https://identifiers.org/opb:OPB_12345> .
- <http://omex-library.org/NewOmex.omex/NewModel.xml#species0000> <– this
bqbiol:is <https://identifiers.org/uniprot:PD12345> ; bqbiol:isPartOf <https://identifiers.org/fma:1234> .
- This can either be
a uri of a metaid that exists in the model xml, such as the case with sbml
could need creating in this local namespace (i.e. internal to the RDF graph), such as the case with CellML
Users need to know which use case they need for their annotation language.
- Parameters
about – The string to use as the metaid. When type is eUriType.MODEL_URI then this string must be an existing metaid in the xml. When type is eUriType.LOCAL_URI, this name can be arbitrary, as long as its unique within the RDF graph.
type – either eUriType.MODEL_URI or eUriType.LOCAL_URI
- Returns
PhysicalEntity
. Reference to self
- delete() → None
Clear up resources used by this
PhysicalEntity
- get_identity() → str
Return the string currently being used for the identity portion of
PhysicalEntity
- get_locations() → List[str]
Returns a list of location uris used in this
PhysicalEntity
- get_num_locations() → int
Returns the number of location portions that exist in this
PhysicalEntity
- get_ptr() → ctypes.c_longlong
Returns the memory address that points to this PhysicalEntity
- has_part(part: str) → pyomexmeta.pyomexmeta.PhysicalEntity
Adds an entry in the list of bqbiol:hasPart predicates
This method can be called an arbitrary number of times for situations where you are adding items to complex.
- Parameters
part – String to use for resource portion of the hasPart triple. Will be expanded into an identifiers.org identifier if the string has the format “name:id:
- Returns
PhysicalEntity
. Reference to self
- has_property(property_about: Optional[str] = None, about_uri_type: Optional[pyomexmeta.pyomexmeta_api.eUriType] = None, is_version_of: Optional[str] = None, property: Optional[pyomexmeta.pyomexmeta.PhysicalProperty] = None) → pyomexmeta.pyomexmeta._PropertyBearer
Create a PhysicalProperty associated with a PhysicalEntity, EnergyDiff or PhysicalProcess.
This method has 3 signatures in the underlying C++ library. This method unpacks the user supplied arguments and passes them to the correct signature, depending on what is supplied.
The first signature is used with sbml models and requires only the is_version_of arument. This is commonly used for annotating sbml models and therefore, when only one string argument is passed to
has_property()
the argument is used for the is_version_of argument (see example below).- Parameters
is_version_of – (str) represents an OPB term from the Ontology of Physical Biology.
In the above case, the necessary local identifiers are created automatically and are guarenteed to be unique throughout your RDF graph. In some circumstances, you might want to have control over the metaids used for local uri’s. The above would create a
PhysicalProperty
with the subject or “about” portion equal to local:EntityProperty0000. We can set this ourselves using the second overload, which requires three arguments:- Parameters
property_about – The subject or “about” portion of the
PhysicalProperty
triples.eUriType.LOCAL_URI if the uri for property_about should be local to the (about_uri_type) – annotation (rdf) graph or eUriType.MODEL_URI if it instead points to a element of the model (which is common in CellML).
The OPB term to use for the "isVersionOf" predicate (is_version_of) –
Finally, you can create the
Property
yourself and pass that tohas_property()
instead. This is often more useful in CellML models.
- identity(identity: str) → pyomexmeta.pyomexmeta.PhysicalEntity
The bqbiol:is part of a PhysicalEntity type composite annotation
- Parameters
identity – (str) when identity has the format “name:id”, the resulting resource uri will be expanded to https://identifiers.org/name:id. When identity begins with the characters “http” the uri will be assumed already a full uri and is used as is.
- Returns
PhysicalEntity
. Reference to self
- is_part_of(is_part_of: str, type: pyomexmeta.pyomexmeta_api.eUriType = 3) → pyomexmeta.pyomexmeta.PhysicalEntity
Adds an entry in the list of bqbiol:isPartOf predicates for this
PhysicalEntity
This method can be called an arbitrary number of times since the number of entries in this list can be any. The level of organisation is assumed to get smaller with successive entries. i.e. start big and get smaller as smaller things are part of bigger things.
- Parameters
is_part_of – The string to use for bqbiol:isPartOf. If this string has the format “name:id” and type is eUriType.IDENTIFIERS_URI the string will be expanded into “https://identifiers.org/name:id”. If it instead begins with “https” then the string will be used as is.
type – A eUriType.
- Returns
PhysicalEntity
. Reference to self