Relationship

class pronto.Relationship[source]

A relationship, constitute the edges of the ontology graph.

Also sometimes referede as typedefs, relationship types, properties or predicates. Formally equivalent to a property (either ObjectProperty or AnnotationProperty) in OWL2.

__eq__(other: Any) → bool

Return self==value.

__ge__(other)

Return self>=value.

__gt__(other)

Return self>value.

__hash__()

Return hash(self).

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

__repr__()

Return repr(self).

add_synonym(description: str, scope: Optional[str] = None, type: Optional[pronto.synonym.SynonymType] = None, xrefs: Optional[Iterable[pronto.xref.Xref]] = None) → pronto.synonym.Synonym

Add a new synonym to the current entity.

Parameters
  • description (str) – The alternate definition of the entity, or a related human-readable synonym.

  • scope (str or None) – An optional synonym scope. Must be either EXACT, RELATED, BROAD or NARROW if given.

  • type (SynonymType or None) – An optional synonym type. Must be declared in the header of the current ontology.

  • xrefs (iterable of Xref, or None) – A collections of database cross-references backing the origin of the synonym.

Raises

ValueError – when given an invalid synonym type or scope.

Returns

Synonym – A new synonym for the terms. The synonym is already added to the Entity.synonyms collection.

property alternate_ids

A set of alternate IDs for this entity.

Type

frozenset of str

property annotations

Annotations relevant to the entity.

Type

frozenset of PropertyValue

property anonymous

Whether or not the entity has an anonymous id.

Semantics of anonymous entities are the same as B-Nodes in RDF.

Type

bool

property builtin

Whether or not the entity is built-in to the OBO format.

pronto uses this tag on the is_a relationship, which is the axiomatic to the OBO language but treated as a relationship in the library.

Type

bool

property comment

A comment about the current entity.

Comments in comment clauses are guaranteed to be conserved by OBO parsers and serializers, unlike bang comments. A non None comment is semantically equivalent to a rdfs:comment in OWL2. When parsing from OWL, several RDF comments will be merged together into a single comment clause spanning over multiple lines.

Type

str or None

property created_by

the name of the creator of the entity, if any.

This property gets translated to a dc:creator annotation in OWL2, which has very broad semantics. Some OBO ontologies may instead use other annotation properties such as the ones found in Information Interchange Ontology, which can be accessed in the annotations attribute of the entity, if any.

Type

str or None

property creation_date

the date the entity was created.

Type

datetime or None

property definition

the textual definition of the current entity.

Definitions in OBO are intended to be human-readable text describing the entity, with some additional cross-references if possible.

Type

str or None

property disjoint_from

The entities declared as disjoint from this entity.

Two entities are disjoint if they have no instances in common. Two entities that are disjoint cannot share any subentities, but the opposite is not always true.

Type

EntitySet

property equivalent_to

The entities declared as equivalent to this entity.

Type

EntitySet

property id

The OBO identifier of the entity.

Identifiers can be either prefixed (e.g. MS:1000031), unprefixed (e.g. part_of) or given as plain URLs. Identifiers cannot be edited.

Type

str

property name

The name of the entity.

Names are formally equivalent to rdf:label in OWL2. The OBO format version 1.4 made names optional to improve OWL interoperability, as labels are optional in OWL.

Type

str or None

property namespace

the namespace this entity is defined in.

Type

str or None

property obsolete

whether or not the entity is obsolete.

Type

bool

property subsets

the subsets containing this entity.

Type

frozenset of str

property synonyms

a set of synonyms for this entity.

Type

frozenset of Synonym

property xrefs

a set of database cross-references.

Xrefs can be used to describe an analogous entity in another vocabulary, such as a database or a semantic knowledge base.

Type

frozenset of Xref

subproperties(distance: Optional[int] = None, with_self: bool = True) → pronto.logic.lineage.SubpropertiesHandler[source]

Get an handle over the subproperties of this Relationship.

Parameters
  • distance (int, optional) – The maximum distance between this relationship and the yielded subproperties (0 for the relationship itself, 1 for its immediate children, etc.). Use None to explore the entire directed graph transitively.

  • with_self (bool) – Whether or not to include the current term in the terms being yielded. RDF semantics state that the rdfs:subClassOf property is reflexive (and therefore is rdfs:subPropertyOf reflexive too by transitivity), so this is enabled by default, but in most practical cases only the distinct subproperties are desired.

superproperties(distance: Optional[int] = None, with_self: bool = True) → pronto.logic.lineage.SuperpropertiesHandler[source]

Get an handle over the superproperties of this Relationship.

In order to follow the semantics of rdf:subPropertyOf, which in turn respects the mathematical definition of subset inclusion, is_a is defined as a transitive relationship, hence the inverse relationship is also transitive by closure property.

Parameters
  • distance (int, optional) – The maximum distance between this relationship and the yielded subperoperties (0 for the relationship itself, 1 for its immediate parents, etc.). Use None to explore the entire directed graph transitively.

  • with_self (bool) – Whether or not to include the current term in the terms being yielded. RDF semantics state that the rdfs:subClassOf property is transitive (and therefore is rdfs:subPropertyOf transitive too), so this is enabled by default, but in most practical cases only the distinct subproperties are desired.

property antisymmetric

whether this relationship is anti-symmetric.

Type

bool

property asymmetric

whether this relationship is asymmetric.

Type

bool