PhysicalEntity

class omexmeta::PhysicalEntity : public omexmeta::PropertyBearer

The PhysicalEntity type of PhysicalPhenomenon

Public Functions

PhysicalEntity() = delete

default constructor for PhysicalEntity

deliberately deleted. If you try using the builder interface (chaining setter methods) from a default instantiated PhysicalEntity you will get an error, because there will be no model assicated with PhysicalEntity. Instead, always instantiate a PhysicalEntity from the Editor::addPhysicalEntity() method.

PhysicalEntity(LibrdfModel &model, UriHandler &uriHandler, PhysicalProperty physicalProperty, std::string is, std::vector<std::string> is_part_of)

constructor for instantiating a PhysicalEntity object

Users should not need to use this constructor directly as it is embedded in the builder interface. The

Parameters
  • model – the model being used by the current rdf graph.

  • about – The subject portion of the PhysicalEntity representing the metaid for the PhysicalEntity

  • physicalProperty – A term from the ontology of physical for biology of type PhysicalProperty.

  • is – The “what” portion of a PhysicalEntity object.

  • is_part_of – The “where” portion of the PhysicalEntity object.

  • is_part_of – parameter is actually a std::vector of LibrdfNode objects. It can be as long as needed.

~PhysicalEntity() = default
void free()

free resources uses by PhysicalEntity

PhysicalEntity objects are owned either by the caller or by a Triples object, depending on whether you have “given” the PhysicalEntity to a Triples object by calling “str” or “toTriples”.

explicit OMEXMETA_DEPRECATED PhysicalEntity(LibrdfModel &model)

constructor for PhysicalEntity object.

This alternative constructor is used when users use the builder interface (which should actually be most of the time). The PhysicalEntity is instantiated with only the model to allow for a better way of collecting necessary information from the user.

Parameters

model – the librdf_model object in use. Passed down from Editor class during instantiation.

explicit PhysicalEntity(LibrdfModel &model, UriHandler &uriHandler)

constructor for PhysicalEntity object.

This alternative constructor is used when users use the builder interface (which should actually be most of the time). The PhysicalEntity is instantiated with only the model to allow for a better way of collecting necessary information from the user. The PhysicalEntity also needs access to the model_uri, which we pass here.

Parameters
  • model – the librdf_model object in use. Passed down from Editor class during instantiation.

  • model_uri – the current localName argument. Passed down from Editor

virtual Triples toTriples() override

convert PhysicalEntity to a Triples object, which can then be passed to a model via the Editor::addPhysicalEntity method.

When using “toTriples” you are giving ownership of the nodes used by PhysicalEntity to the returned Triples object, which automatically cleans up after itself in its destructor. If you instantiate a PhysicalEntity and do not call toTriples (which will not be often), then the caller is responsible for calling PhysicalEntity::free when finished.

Returns

a Triples objects containing the Triple objects associated with this PhysicalEntity

const std::string &getIdentityResource() const

return the IdentityResource in use. I.e. the “what” portion of the PhysicalEntity

Returns

the identity LibrdfNode

const std::vector<std::string> &getLocationResources() const

return a vector of resources representing the “where” part of the PhysicalEntity

Returns

vector of LibrdfNode objects representing anatomical location of physical entity

OMEXMETA_DEPRECATED PhysicalEntity & setPhysicalProperty (std::string subject_metaid, const std::string &physicalProperty)

sets the physical property for a PhysicalEntity instance.

The OBP argument requires a string of the form “obp:opbxxx” where “xxx” is the id for the OPB term. An instance of PhysicalProperty is instantiated with

Parameters
  • physicalProperty – a string representing the OPB term used by the PhysicalEntity

  • physicalProperty – as its value.

Returns

a reference to this Physical entity. Allows chaining together builder commands.

OMEXMETA_DEPRECATED PhysicalEntity & setPhysicalProperty (PhysicalProperty physicalProperty)

sets the physical property for a PhysicalEntity instance

Prefer the alternative setPhysicalProperty instance, since you do not need to instantiate the PhysicalProperty yourself.

For developers. Consider removing.

Returns

a reference to this Physical entity. Allows chaining together builder commands.

PhysicalEntity &setIdentity(std::string resource)

sets the identity portion of the PhysicalEntity (the “What”).

The input string gets converted to a LibrdfNode automatically.

See LibrdfNode documentation for more details of valid input strings.

Parameters

resource – The resource to be used for the identity.

Returns

a reference to this Physical entity. Allows chaining together builder commands.

PhysicalEntity &identity(const std::string &resource)

alias for setIdentity

OMEXMETA_DEPRECATED PhysicalEntity & addLocation (const std::string &where)

add a location to the PhysicalEntity.

The input string gets converted to a LibrdfNode automatically. An arbitrary number of locations are allowed. The location is added to the back of a vector containing the Resources. Left most elements of this vector represent larger physiological locations which get smaller as the index of this vector increases via use of the “isPartOf” predicate. For example, a cytosolic TGFb molecule in a dermal fibroblast could have a locations vector first containing a reference to skin, then dermis, then fibroblast, then cytosol. This ends up being cytosol<isPartOf>fibroblast<isPartOf>dermis<isPartOf>skin.

See LibrdfNode documentation for more details of valid input strings.

Deprecated in favour of PhysicalEntity::isPartOf

Parameters

where – The resource representing a location.

Returns

a reference to this Physical entity. Allows chaining together builder commands.

int getNumLocations() const

returns the number of locations used by PhysicalEntity

Returns

the number of locations in a PhysicalEntity

bool operator==(const PhysicalEntity &rhs) const
bool operator!=(const PhysicalEntity &rhs) const
PhysicalEntity &propertyIsVersionOf(const std::string &property)

Set the isVersionOf portion of the PhysicalEntity composite annotation.

Should be of the form OPB:OPB_12345 or OPB/OPB_12345. This function will set the LibrdfNode resource_ property on the PhysicalProperty associated with this PhysicalEntity.

Parameters

property – an opb term

PhysicalEntity &isPropertyOf(const std::string &is_property_of, eUriType type)
virtual PhysicalEntity &about(const std::string &about, eUriType type) override

Set the about portion of the PhysicalEntity composite annotation.

This function will set the LibrdfNode subject_ property on the PhysicalProperty associated with this PhysicalEntity

Parameters

about – The string to put in rdf:about

virtual PhysicalEntity &about(const std::string &about) override

Since we can’t have default arguments on a virutal member function we instead have an overload where the absent eUriType parameter is assumed to be the default value of NONE. Note, it may be prudent to figure out which of LOCAL or MODEL uri would be a better default.

PhysicalEntity &is(const std::string &is)

Set the is portion of the PhysicalEntity composite annotation.

This function calls the PhysicalEntity::setIdentity method and can be used as an alternative. For developers, consider which (or both? )sets of methods to keep, is or setIdentity

Parameters

is – the string to be used for is. This should be of the form OPB:OPB_00134

PhysicalEntity &isPartOf(std::string isPartOf, eUriType type = NONE)

Set the location (isPartOf) portion of the PhysicalEntity composite annotation.

This function calls the PhysicalEntity::addLocation method and can be used as an alternative. For developers, consider which (or both? )sets of methods to keep, addLocation or isPartOf

Parameters

isPartOf – the string to be used for isPartOf predicate. This should be of the form fma:FMA:12345 or fma/FMA:12345

PhysicalEntity &hasPart(const std::string &part)

Add item to an “hasPart” triple on the PhysicalEntity composite annotation.

used in the case of annotating complexes which have no identity but several parts.

Parameters

part – the string to be used for hasPart predicate.

OMEXMETA_DEPRECATED PhysicalEntity & variableMetaId (const std::string &metaid)

set the metaid of variable such as kinetic parameter

virtual OMEXMETA_DEPRECATED const std::string & getPropertyMetaidBase () const override
virtual PhysicalEntity &hasProperty(const PhysicalProperty &property) override
virtual PhysicalEntity &hasProperty(const std::string &is_version_of) override
virtual PhysicalEntity &hasProperty(const std::string &property_about, eUriType about_uri_type, const std::string &is_version_of) override

Private Members

std::string identity_resource_
std::vector<std::string> location_resources_
std::vector<std::string> part_resources_
std::string physical_entity_property_id_
std::string property_metaid_base_ = "EntityProperty"