bento_meta.objects

This module contains the subclasses of Entity which are used in representing the models contained in the MDB.

Classes

Node

Subclass that models a data node.

Property

Subclass that models a property of a node or relationship (edge).

Edge

Subclass that models a relationship between model nodes.

Term

Subclass that models a term from a terminology.

ValueSet

Subclass that models an enumerated set of Property values.

Concept

Subclass that models a semantic concept.

Predicate

Subclass that models a semantic link between concepts.

Origin

Subclass that models a Term 's authoritative source.

Tag

Subclass that allows simple key-value tagging of a model at arbitrary points.

Model

Subclass with information regarding data model.

Functions

mergespec(→ tuple[dict[str, str], dict[str, ...)

Merge subclass attribute and mapping specification dicts with the base class's.

Module Contents

bento_meta.objects.mergespec(clsname: str, attspec: dict[str, str], mapspec: dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]) tuple[dict[str, str], dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]][source]

Merge subclass attribute and mapping specification dicts with the base class’s.

Not for human consumption.

class bento_meta.objects.Node(init: dict | neo4j.graph.Node | Node | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a data node.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
property annotations: dict | None

Return Term`s if the `Node is annotated by Term`s via a `Concept.

get_key_prop() Property | list[Property] | None[source]

Return the Property entity with is_key=True for this Node if it exists.

If multiple key props exist, return a list of them; if none exist, return None.

Returns:

Single Property if one key property exists, list of Properties if multiple exist, None if no key properties found.

class bento_meta.objects.Property(init: dict | neo4j.graph.Node | Property | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a property of a node or relationship (edge).

pvt_attr: ClassVar[list[str]] = ['pvt', 'neoid', 'dirty', 'removed_entities', 'attspec', 'mapspec', 'belongs', 'value_types']
attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
defaults: ClassVar[dict[str, str]]
value_types = []
property annotations: dict | None

If the Property is annotated by Term`s via a `Concept, return the `Term`s.

property terms: list[Term] | None

Return the Term objects of Property with a value_set domain.

property values: list[str] | None

Return Property’s term values as a list of str if it has a value_set domain.

Returns:

List of term values, or None if no value_set.

class bento_meta.objects.Edge(init: dict | neo4j.graph.Node | Edge | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a relationship between model nodes.

defaults: ClassVar[dict[str, str]]
attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
property annotations: dict | None

Return Term`s if the `Edge is annotated by Term`s via a `Concept.

property triplet: tuple[str, str, str] | None

Return a 3-tuple that fully qualifies the edge.

Returns (edge.handle, src.handle, dst.handle).

src and dst attributes must be set. If not, return None.

Returns:

Tuple of (edge.handle, src.handle, dst.handle) or None.

class bento_meta.objects.Term(init: dict | neo4j.graph.Node | Term | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a term from a terminology.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
class bento_meta.objects.ValueSet(init: dict | neo4j.graph.Node | ValueSet | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models an enumerated set of Property values.

Essentially a container for Term instances.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
__setattr__(name: str, value: Any) None[source]

Set the attribute of the entity.

class bento_meta.objects.Concept(init: dict | neo4j.graph.Node | Concept | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a semantic concept.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
class bento_meta.objects.Predicate(init: dict | neo4j.graph.Node | Predicate | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a semantic link between concepts.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
class bento_meta.objects.Origin(init: dict | neo4j.graph.Node | Origin | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that models a Term ‘s authoritative source.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
class bento_meta.objects.Tag(init: dict | neo4j.graph.Node | Tag | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass that allows simple key-value tagging of a model at arbitrary points.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
class bento_meta.objects.Model(init: dict | neo4j.graph.Node | Model | None = None)[source]

Bases: bento_meta.entity.Entity

Subclass with information regarding data model.

attspec_: ClassVar[dict[str, str]]
mapspec_: ClassVar[dict[str, str | dict[str, str] | dict[str, dict[str, str | set[str]]] | None]]
defaults: ClassVar[dict[str, bool]]