TypeDef

class TypeDef(reference, is_anonymous=None, namespace=None, definition=None, comment=None, subsets=<factory>, synonyms=<factory>, xrefs=<factory>, _axioms=<factory>, properties=<factory>, domain=None, range=None, builtin=None, holds_over_chain=<factory>, is_anti_symmetric=None, is_cyclic=None, is_reflexive=None, is_symmetric=None, is_transitive=None, is_functional=None, is_inverse_functional=None, parents=<factory>, intersection_of=<factory>, union_of=<factory>, equivalent_to=<factory>, disjoint_from=<factory>, inverse=None, transitive_over=<factory>, equivalent_to_chain=<factory>, disjoint_over=<factory>, relationships=<factory>, is_obsolete=None, created_by=None, creation_date=None, predicate_type=None, is_class_level=None, type='TypeDef')[source]

Bases: Stanza

A type definition in OBO.

See the subsection of https://owlcollab.github.io/oboformat/doc/GO.format.obo-1_4.html#S.2.2.

Attributes Summary

builtin

comment

created_by

creation_date

definition

A description of the entity

disjoint_from

disjoint_over

From the OBO spec:

domain

equivalent_to

equivalent_to_chain

holds_over_chain

intersection_of

inverse

is_anonymous

is_anti_symmetric

is_class_level

is_cyclic

is_functional

is_inverse_functional

is_obsolete

An annotation for obsolescence.

is_reflexive

is_symmetric

is_transitive

namespace

parents

predicate_type

Whether this relationship is a metadata tag.

properties

range

reference

relationships

subsets

synonyms

transitive_over

type

union_of

xrefs

Methods Summary

default(prefix, identifier, *[, name])

Construct a default type definition from within the OBO namespace.

from_triple(prefix, identifier[, name])

Create a typedef from a reference.

iterate_obo_lines(ontology_prefix[, ...])

Iterate over the lines to write in an OBO file.

Attributes Documentation

Parameters:
  • reference (Annotated[Reference, 1])

  • is_anonymous (Annotated[bool | None, 2])

  • namespace (Annotated[str | None, 4])

  • definition (Annotated[str | None, 6])

  • comment (Annotated[str | None, 7])

  • subsets (Annotated[list[Reference], 8])

  • synonyms (Annotated[list[Synonym], 9])

  • xrefs (Annotated[list[Reference], 10])

  • _axioms (AnnotationsDict)

  • properties (Annotated[PropertiesHint, 11])

  • domain (Annotated[Reference | None, 12, 'typedef-only'])

  • range (Annotated[Reference | None, 13, 'typedef-only'])

  • builtin (Annotated[bool | None, 14])

  • holds_over_chain (Annotated[list[list[Reference]], 15, 'typedef-only'])

  • is_anti_symmetric (Annotated[bool | None, 16, 'typedef-only'])

  • is_cyclic (Annotated[bool | None, 17, 'typedef-only'])

  • is_reflexive (Annotated[bool | None, 18, 'typedef-only'])

  • is_symmetric (Annotated[bool | None, 19, 'typedef-only'])

  • is_transitive (Annotated[bool | None, 20, 'typedef-only'])

  • is_functional (Annotated[bool | None, 21, 'typedef-only'])

  • is_inverse_functional (Annotated[bool | None, 22, 'typedef-only'])

  • parents (Annotated[list[Reference], 23])

  • intersection_of (Annotated[IntersectionOfHint, 24])

  • union_of (Annotated[list[Reference], 25])

  • equivalent_to (Annotated[list[Reference], 26])

  • disjoint_from (Annotated[list[Reference], 27])

  • inverse (Annotated[Reference | None, 28, 'typedef-only'])

  • transitive_over (Annotated[list[Reference], 29, 'typedef-only'])

  • equivalent_to_chain (Annotated[list[list[Reference]], 30, 'typedef-only'])

  • disjoint_over (Annotated[list[Reference], 31])

  • relationships (Annotated[RelationsHint, 32])

  • is_obsolete (Annotated[bool | None, 33])

  • created_by (Annotated[str | None, 34])

  • creation_date (Annotated[datetime.datetime | None, 35])

  • predicate_type (Annotated[TypeDefType | None, 40, 'typedef-only'])

  • is_class_level (Annotated[bool | None, 41])

  • type (StanzaType)

builtin: Annotated[bool | None, 14] = None
comment: Annotated[str | None, 7] = None
created_by: Annotated[str | None, 34] = None
creation_date: Annotated[datetime.datetime | None, 35] = None
definition: Annotated[str | None, 6] = None

A description of the entity

disjoint_from: Annotated[list[Reference], 27] = <dataclasses._MISSING_TYPE object>
disjoint_over: Annotated[list[Reference], 31] = <dataclasses._MISSING_TYPE object>

From the OBO spec:

For example: spatially_disconnected_from is disjoint_over part_of, in that two disconnected entities have no parts in common. This can be translated to OWL as: disjoint_over(R S), R(A B) ==> (S some A) disjointFrom (S some B)

domain: Annotated[Reference | None, 12, 'typedef-only'] = None
equivalent_to: Annotated[list[Reference], 26] = <dataclasses._MISSING_TYPE object>
equivalent_to_chain: Annotated[list[list[Reference]], 30, 'typedef-only'] = <dataclasses._MISSING_TYPE object>
holds_over_chain: Annotated[list[list[Reference]], 15, 'typedef-only'] = <dataclasses._MISSING_TYPE object>
intersection_of: Annotated[IntersectionOfHint, 24] = <dataclasses._MISSING_TYPE object>
inverse: Annotated[Reference | None, 28, 'typedef-only'] = None
is_anonymous: Annotated[bool | None, 2] = None
is_anti_symmetric: Annotated[bool | None, 16, 'typedef-only'] = None
is_class_level: Annotated[bool | None, 41] = None
is_cyclic: Annotated[bool | None, 17, 'typedef-only'] = None
is_functional: Annotated[bool | None, 21, 'typedef-only'] = None
is_inverse_functional: Annotated[bool | None, 22, 'typedef-only'] = None
is_obsolete: Annotated[bool | None, 33] = None

An annotation for obsolescence. By default, is None, but this means that it is not obsolete.

is_reflexive: Annotated[bool | None, 18, 'typedef-only'] = None
is_symmetric: Annotated[bool | None, 19, 'typedef-only'] = None
is_transitive: Annotated[bool | None, 20, 'typedef-only'] = None
namespace: Annotated[str | None, 4] = None
parents: Annotated[list[Reference], 23] = <dataclasses._MISSING_TYPE object>
predicate_type: Annotated[TypeDefType | None, 40, 'typedef-only'] = None

Whether this relationship is a metadata tag. Properties that are marked as metadata tags are used to record object metadata. Object metadata is additional information about an object that is useful to track, but does not impact the definition of the object or how it should be treated by a reasoner. Metadata tags might be used to record special term synonyms or structured notes about a term, for example.

properties: Annotated[PropertiesHint, 11] = <dataclasses._MISSING_TYPE object>
range: Annotated[Reference | None, 13, 'typedef-only'] = None
reference: Annotated[Reference, 1] = <dataclasses._MISSING_TYPE object>
relationships: Annotated[RelationsHint, 32] = <dataclasses._MISSING_TYPE object>
subsets: Annotated[list[Reference], 8] = <dataclasses._MISSING_TYPE object>
synonyms: Annotated[list[Synonym], 9] = <dataclasses._MISSING_TYPE object>
transitive_over: Annotated[list[Reference], 29, 'typedef-only'] = <dataclasses._MISSING_TYPE object>
type: StanzaType = 'TypeDef'
union_of: Annotated[list[Reference], 25] = <dataclasses._MISSING_TYPE object>
xrefs: Annotated[list[Reference], 10] = <dataclasses._MISSING_TYPE object>

Methods Documentation

classmethod default(prefix, identifier, *, name=None, predicate_type)[source]

Construct a default type definition from within the OBO namespace.

Parameters:
  • prefix (str)

  • identifier (str)

  • name (str | None)

  • predicate_type (Literal['object', 'annotation', 'data'])

Return type:

Self

classmethod from_triple(prefix, identifier, name=None)[source]

Create a typedef from a reference.

Parameters:
  • prefix (str)

  • identifier (str)

  • name (str | None)

Return type:

TypeDef

iterate_obo_lines(ontology_prefix, synonym_typedefs=None, typedefs=None)[source]

Iterate over the lines to write in an OBO file.

Parameters:
  • ontology_prefix (str) – The prefix of the ontology into which the type definition is being written. This is used for compressing builtin identifiers

  • synonym_typedefs (Mapping[ReferenceTuple, SynonymTypeDef] | None)

  • typedefs (Mapping[ReferenceTuple, TypeDef] | None)

Yield:

The lines to write to an OBO file

Return type:

Iterable[str]

S.3.5.5 of the OBO Flat File Specification v1.4 says tags should appear in the following order:

  1. id

  2. is_anonymous

  3. name

  4. namespace

  5. alt_id

  6. def

  7. comment

  8. subset

  9. synonym

  10. xref

  11. property_value

  12. domain

  13. range

  14. builtin

  15. holds_over_chain

  16. is_anti_symmetric

  17. is_cyclic

  18. is_reflexive

  19. is_symmetric

  20. is_transitive

  21. is_functional

  22. is_inverse_functional

  23. is_a

  24. intersection_of

  25. union_of

  26. equivalent_to

  27. disjoint_from

  28. inverse_of

  29. transitive_over

  30. equivalent_to_chain

  31. disjoint_over

  32. relationship

  33. is_obsolete

  34. created_by

  35. creation_date

  36. replaced_by

  37. consider

  38. expand_assertion_to

  39. expand_expression_to

  40. is_metadata_tag

  41. is_class_level