mbdlyb.functional.gdb

Graph database (GDB) integration for functional models.

This module provides Neomodel classes for persisting functional models to graph databases. It includes graph database node types for all functional model elements and relation types, enabling distributed and persistent storage of functional analysis models.

The module includes:
  • GFunctionalRelation: Base class for functional dependency relations in GDB

  • GRealizesRelation, GAffectsRelation: Hardware-function relations

  • GRequiredForRelation, GSubfunctionOfRelation: Function dependency relations

  • GObservedByRelation, GIndicatedByRelation: Observable relations

  • GYieldsErrorRelation, GReportsErrorRelation: Error propagation relations

  • GCommunicatesThroughRelation: Inter-function communication relations

  • GFunctionalNode: Base node for functional model elements in GDB

  • GFunction, GHardware, GOperatingMode: Node types for main components

  • GDirectObservable, GObservedError, GDiagnosticTest, GDiagnosticTestResult: Observable/test nodes

  • GCluster: Container for functional models in GDB

All classes integrate with Neomodel for ORM-like database access and include validation methods for constraint checking.

Attributes

CLASS_ICONS

LBL_AFFECTS

LBL_COMMUNICATES_THROUGH

LBL_INDICATED_BY

LBL_OBSERVED

LBL_REALIZES

LBL_REPORTS_ERROR

LBL_REQUIRED

LBL_RESULTS_IN

LBL_SUBFUNCTION

LBL_YIELDS_ERROR

Classes

GAffectsRelation

Affects relation in graph database: Hardware affects Function.

GCPTEnabledNode

Base class for functional nodes in graph database.

GCluster

Graph-backed MBD network with hierarchical structure support.

GCommunicatesThroughRelation

CommunicatesThrough relation in graph database: Function communicates_through Function.

GDiagnosticTest

Base class for functional nodes in graph database.

GDiagnosticTestResult

Base class for functional nodes in graph database.

GDirectObservable

Base class for functional nodes in graph database.

GFunction

Base class for functional nodes in graph database.

GFunctionalNode

Base class for functional nodes in graph database.

GFunctionalRelation

Base class for functional dependency relations in graph database.

GHardware

Base class for functional nodes in graph database.

GIndicatedByRelation

IndicatedBy relation in graph database: Node indicated_by TestResult.

GObservableNode

Base class for functional nodes in graph database.

GObserved

GObservedByRelation

ObservedBy relation in graph database: Node observed_by Observable.

GObservedError

Base class for functional nodes in graph database.

GOperatingMode

Base class for functional nodes in graph database.

GRealizesRelation

Realizes relation in graph database: Hardware realizes Function.

GReportsErrorRelation

ReportsError relation in graph database: Function reports_error ObservedError.

GRequiredForRelation

RequiredFor relation in graph database: Function required_for Function.

GResultsInRelation

ResultsIn relation in graph database: DiagnosticTest results_in DiagnosticTestResult.

GSubfunctionOfRelation

Subfunction relation in graph database: Function subfunction_of Function.

GYieldsErrorRelation

YieldsError relation in graph database: Function yields_error ObservedError.

Functions

update_name(obj)

Rename an element to avoid a duplicate among its sibling elements.

Module Contents

class mbdlyb.functional.gdb.GAffectsRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

Affects relation in graph database: Hardware affects Function.

Persists AffectsRelation with validation that source is Hardware, target is Function, and they are in different clusters.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.AffectsRelation

Load an AffectsRelation from graph database.

Parameters:
  • from_uid (str) – Hardware node UID.

  • to_uid (str) – Function node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

AffectsRelation

validate() → list[mbdlyb.messages.ValidationMessage]

Validate Affects relation constraints.

Returns:

Start must be Hardware, end must be Function,

and they must be in different clusters.

Return type:

list[ValidationMessage]

class mbdlyb.functional.gdb.GCPTEnabledNode(*args: Any, **kwargs: Any)

Bases: GFunctionalNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

validate() → list[mbdlyb.messages.ValidationMessage]

Validate this node and its conditional probability table.

Returns:

Messages from node, relationships, and CPT

validation.

Return type:

list[ValidationMessage]

validate_cpt() → list[mbdlyb.messages.ValidationMessage]

Check whether the stored CPT has the expected dimensions.

Returns:

Errors for a missing or incorrectly shaped

CPT; an empty list when the CPT is valid or not required.

Return type:

list[ValidationMessage]

cpt
property cpt_url: str
Abstractmethod:

Return the URL at which a subclass’s CPT can be edited.

Returns:

URL for the subclass’s CPT editor.

Return type:

str

Raises:

NotImplementedError – This property must be implemented by subclasses.

property has_cpt

Indicate whether a CPT is stored for this node.

Returns:

True when the node’s CPT data is non-empty.

Return type:

bool

class mbdlyb.functional.gdb.GCluster(*args: Any, **kwargs: Any)

Bases: mbdlyb.gdb.GMBDNet

Graph-backed MBD network with hierarchical structure support.

Represents a Bayesian network or sub-network stored in the graph database. Manages hierarchical decomposition through PART_OF relationships and handles loading of complete networks with all relations.

Variables:
  • __label__ – Neo4j node label for network type.

  • elements – All elements contained in this network.

  • mbdnodes – All nodes contained in this network.

  • subnets – All sub-networks contained in this network.

delete()

Delete all elements in this cluster and then delete the cluster itself.

get_subnets() → dict[str, GCluster]

Return this cluster’s direct subclusters keyed by name.

Returns:

Direct child clusters indexed by their names.

Return type:

dict[str, GCluster]

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.MBDNet | None = None) → mbdlyb.functional.base.Cluster

Load this database cluster and its elements into an in-memory model.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping populated with each database element and its in-memory counterpart.

  • net (Optional[MBDNet]) – Parent in-memory network, if any.

Returns:

The loaded cluster, with its elements registered in node_map.

Return type:

Cluster

classmethod load_capella(architecture: str, default_fn_tests: bool, default_hl_fn_tests: bool, default_hw_tests: bool, default_ll_hw_tests: bool, import_opms: bool, *files: pathlib.Path, queue: multiprocessing.Queue | None = None) → GCluster

Import a Capella architecture and optional CPT spreadsheets.

Parameters:
  • architecture (str) – Architecture name to import.

  • default_fn_tests (bool) – Whether to create default function tests.

  • default_hl_fn_tests (bool) – Whether to create default high-level function tests.

  • default_hw_tests (bool) – Whether to create default hardware tests.

  • default_ll_hw_tests (bool) – Whether to create default low-level hardware tests.

  • import_opms (bool) – Whether to import operating modes.

  • *files (Path) – Capella and spreadsheet paths or glob patterns.

  • queue (Optional[Queue]) – Optional queue passed to the Capella transformer.

Returns:

Imported graph-database cluster.

Return type:

GCluster

relation_kwargs(net: mbdlyb.functional.base.Cluster) → dict[str, Any]

Build shared keyword arguments used to load relations in this cluster.

Parameters:

net (Cluster) – In-memory cluster whose operating modes and errors supply relation context.

Returns:

Parent relation arguments plus operating mode and error

node lookup maps.

Return type:

dict[str, Any]

validate() → list[mbdlyb.messages.ValidationMessage]

Validate cluster constraints, including root-level function cycles.

Returns:

Cyclic dependency errors and messages from

the parent network validation.

Return type:

list[ValidationMessage]

GDB_NODE_TRANSFORM_CLASSES: dict[Type[GFunctionalNode], tuple[Type[mbdlyb.functional.base.FunctionalNode], list[str]]]
GDB_RELATION_TRANSFORM_CLASSES: dict[Type[GFunctionalRelation], tuple[Type[mbdlyb.functional.base.FunctionalDependency], list[str]]]
XLS_NODE_CLASSES: dict[str, tuple[Type[GFunctionalNode], tuple]]
functions
hardware
property is_abstract: bool

Check whether this cluster and all its subclusters are fully decomposed.

Returns:

True when its functions have no subfunctions and every subnet is

also abstract.

Return type:

bool

property is_flat: bool

Check whether this cluster contains no child clusters.

Returns:

True when the cluster has no subnets.

Return type:

bool

net
observables
operating_modes
subnets
test_results
tests
class mbdlyb.functional.gdb.GCommunicatesThroughRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

CommunicatesThrough relation in graph database: Function communicates_through Function.

Persists error propagation through inter-function communication.

Variables:

error_codes (list[str]) – Error codes propagating through communication.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, error_nodes: dict[str, mbdlyb.functional.base.ObservedError] | None = None, **kwargs) → mbdlyb.functional.base.CommunicatesThroughRelation

Load a CommunicatesThroughRelation from graph database.

Parameters:
  • from_uid (str) – Source function UID.

  • to_uid (str) – Target function UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • error_nodes (Optional[dict]) – Error nodes. Defaults to None.

  • **kwargs – Additional parameters.

Returns:

Loaded relation with error codes.

Return type:

CommunicatesThroughRelation

error_codes
class mbdlyb.functional.gdb.GDiagnosticTest(*args: Any, **kwargs: Any)

Bases: GFunctionalNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

delete()

Delete all test results before deleting this diagnostic test.

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.DiagnosticTest

Create the in-memory diagnostic test represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the test.

Returns:

The corresponding in-memory test.

Return type:

DiagnosticTest

parents() → list[mbdlyb.gdb.GMBDNode]

Return the parent nodes used to determine this test’s state.

Returns:

Empty because diagnostic tests have no model parents.

Return type:

list[GMBDNode]

validate() → list[mbdlyb.messages.ValidationMessage]

Validate this test and each result it produces.

Returns:

Validation messages for the test and its results.

Return type:

list[ValidationMessage]

RELATION_ATTRIBUTES = [('test_results', 'results_from')]
fixed_cost
preconditions
test_results
class mbdlyb.functional.gdb.GDiagnosticTestResult(*args: Any, **kwargs: Any)

Bases: GObservableNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

get_observed_nodes() → list[GFunctionalNode]

Return hardware and functions indicated by this test result.

Returns:

Indicated components, grouped by hardware and

function and ordered by fully qualified name.

Return type:

list[GFunctionalNode]

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.DiagnosticTestResult

Create the in-memory test result represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the result.

Returns:

The result, including its stored CPT when present.

Return type:

DiagnosticTestResult

RELATION_ATTRIBUTES = [('results_from', 'results_from'), ('indicated_functions', 'indicated_by'),...
property cpt_url: str

Return the URL for editing this test result’s CPT.

Returns:

Test-result CPT endpoint.

Return type:

str

fn_rate
fp_rate
indicated_functions
indicated_hardware
results_from
property test: GDiagnosticTest

Return the diagnostic test that produces this result.

Returns:

Related test node.

Return type:

GDiagnosticTest

class mbdlyb.functional.gdb.GDirectObservable(*args: Any, **kwargs: Any)

Bases: GObservableNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

get_observed_nodes() → list[GFunctionalNode]

Return observed hardware and functions in fully qualified-name order.

Returns:

Components connected to this observable.

Return type:

list[GFunctionalNode]

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.DirectObservable

Create the in-memory observable represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the observable.

Returns:

The observable, including its stored CPT when present.

Return type:

DirectObservable

RELATION_ATTRIBUTES = [('observed_functions', 'observed_by'), ('observed_hardware', 'observed_by')]
property cpt_url: str

Return the URL for editing this observable’s CPT.

Returns:

Observable CPT endpoint.

Return type:

str

fn_rate
fp_rate
observed_functions
observed_hardware
class mbdlyb.functional.gdb.GFunction(*args: Any, **kwargs: Any)

Bases: GCPTEnabledNode, GObserved

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.Function

Create the in-memory function represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the function.

Returns:

The function, including its stored CPT when present.

Return type:

Function

parents() → list[GFunctionalNode]

Return the functional nodes contributing to this function’s state.

Returns:

Subfunctions, realizing hardware, required

functions, and affecting hardware, in sorted groups.

Return type:

list[GFunctionalNode]

RELATION_ATTRIBUTES = [('subfunction_of', 'subfunctions'), ('subfunctions', 'subfunction_of'), ('realized_by',...
affected_by
communicates_from
communicates_through
property cpt_url: str

Return the URL for editing this function’s CPT.

Returns:

Function CPT endpoint.

Return type:

str

property has_subfunctions: bool

Check whether this function has any directly nested subfunctions.

Returns:

True when at least one subfunction is connected.

Return type:

bool

realized_by
reports_error
required_for
requires
property requires_cpt: bool

Check whether custom states in this function’s dependencies require a CPT.

Returns:

True if this function or a dependency has custom states.

Return type:

bool

subfunction_of
subfunctions
yields_error
class mbdlyb.functional.gdb.GFunctionalNode(*args: Any, **kwargs: Any)

Bases: mbdlyb.gdb.GMBDNode[str]

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

validate() → list[mbdlyb.messages.ValidationMessage]

Validate the node and its managed relationships.

Returns:

Validation messages from the node and each

managed relationship.

Return type:

list[ValidationMessage]

RELATION_ATTRIBUTES: list[tuple[str]] = []
property has_cpt: bool

Indicate whether this node has a conditional probability table.

Returns:

False because generic functional nodes do not store CPTs.

Return type:

bool

net
property requires_cpt: bool

Indicate whether this node requires a conditional probability table.

Returns:

False because generic functional nodes do not require CPTs.

Return type:

bool

class mbdlyb.functional.gdb.GFunctionalRelation(**kwargs: dict[str, Any])

Bases: mbdlyb.gdb.GMBDDependency

Base class for functional dependency relations in graph database.

Represents dependencies between functional nodes with weight and operating mode constraints. Subclasses implement loading and validation specific to each relation type.

Variables:

weight (float) – Strength/probability weight of the dependency.

abstractmethod load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.FunctionalDependency

Load a relation from graph database to in-memory model.

Parameters:
  • from_uid (str) – UID of source node.

  • to_uid (str) – UID of target node.

  • node_map (dict) – Mapping from UIDs to (GDB node, in-memory node) tuples.

  • net (Cluster) – The cluster containing this relation.

  • **kwargs – Additional parameters for loading.

Returns:

Loaded in-memory dependency relation.

Return type:

FunctionalDependency

abstractmethod validate() → list[mbdlyb.messages.ValidationMessage]

Validate the relation for consistency constraints.

Returns:

List of validation errors and warnings.

Return type:

list[ValidationMessage]

weight
class mbdlyb.functional.gdb.GHardware(*args: Any, **kwargs: Any)

Bases: GFunctionalNode, GObserved

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.Hardware

Create the in-memory hardware represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the hardware.

Returns:

The corresponding in-memory hardware node.

Return type:

Hardware

parents() → list[mbdlyb.gdb.GMBDNode]

Return the parent nodes used to determine this hardware’s state.

Returns:

Empty because hardware states are defined by fault rates.

Return type:

list[GMBDNode]

BASE_PRIOR
RELATION_ATTRIBUTES = [('realizes', 'realized_by'), ('affects', 'affected_by'), ('observed_by', 'observed_hardware'),...
affects
fault_rates
property priors: dict[str, float]

Calculate the prior probability assigned to each hardware state.

Returns:

Healthy-state probability and configured fault rates.

Return type:

dict[str, float]

realizes
property states: list[str]

Return the healthy state followed by this hardware’s fault states.

Returns:

All possible hardware states.

Return type:

list[str]

class mbdlyb.functional.gdb.GIndicatedByRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

IndicatedBy relation in graph database: Node indicated_by TestResult.

Persists IndicatedByRelation between nodes and diagnostic test results.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.IndicatedByRelation

Load an IndicatedByRelation from graph database.

Parameters:
  • from_uid (str) – Indicated node UID.

  • to_uid (str) – Test result node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

IndicatedByRelation

class mbdlyb.functional.gdb.GObservableNode(*args: Any, **kwargs: Any)

Bases: GCPTEnabledNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

abstractmethod get_observed_nodes() → list[GFunctionalNode]

Return the components observed by this observable.

Returns:

Components connected to this observable.

Return type:

list[GFunctionalNode]

Raises:

NotImplementedError – This method must be implemented by concrete observable node types.

parents() → list[GFunctionalNode]

Return the components observed by this node.

Returns:

Nodes whose states contribute to the observation.

Return type:

list[GFunctionalNode]

reposition() → tuple[mbdlyb.fqn.FQN, mbdlyb.fqn.FQN, mbdlyb.fqn.FQN] | None

Move this observable to the deepest common cluster of its observed nodes.

Returns:

The observable FQN, its former cluster

FQN, and its new cluster FQN; None if no move is needed.

Return type:

Optional[tuple[FQN, FQN, FQN]]

property requires_cpt: bool

Check whether this observable’s custom states require an explicit CPT.

Returns:

True if the observable or any observed node has custom states.

Return type:

bool

class mbdlyb.functional.gdb.GObserved
indicated_by
observed_by
class mbdlyb.functional.gdb.GObservedByRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

ObservedBy relation in graph database: Node observed_by Observable.

Persists ObservedByRelation between hardware/functions and observables.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.ObservedByRelation

Load an ObservedByRelation from graph database.

Parameters:
  • from_uid (str) – Observed node UID.

  • to_uid (str) – Observable node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

ObservedByRelation

class mbdlyb.functional.gdb.GObservedError(*args: Any, **kwargs: Any)

Bases: GObservableNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

get_observed_nodes() → list[GFunctionalNode]

Return functions that yield this observed error.

Returns:

Functions connected through yields-error relations,

in fully qualified-name order.

Return type:

list[GFunctionalNode]

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.ObservedError

Create the in-memory observed error represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused while creating this node.

  • root (Cluster) – In-memory cluster to contain the error.

Returns:

The error node, including its stored CPT when present.

Return type:

ObservedError

RELATION_ATTRIBUTES = [('observed_function', 'reporting_function')]
error_code
fn_rate
fp_rate
observed_function
reporting_function
class mbdlyb.functional.gdb.GOperatingMode(*args: Any, **kwargs: Any)

Bases: GFunctionalNode

Base class for functional nodes in graph database.

All functional model node types (functions, hardware, observables, tests) inherit from this class and integrate with Neomodel for GDB persistence.

load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], root: mbdlyb.functional.base.Cluster) → mbdlyb.functional.base.OperatingMode

Create the in-memory operating mode represented by this database node.

Parameters:
  • node_map (dict[str, tuple[GMBDElement, MBDElement]]) – Mapping of database and in-memory elements; unused for this node type.

  • root (Cluster) – In-memory cluster to contain the operating mode.

Returns:

The corresponding in-memory node.

Return type:

OperatingMode

on_delete()

Remove this operating mode’s values from dependent relations.

parents() → list[mbdlyb.gdb.GMBDNode]

Return the parent nodes used to determine this node’s state.

Returns:

Empty because an operating mode has no parents.

Return type:

list[GMBDNode]

static update_relations_with_operating_mode(updates: dict[str, str | None])

Update operating mode values stored on required-for relations.

Parameters:

updates (dict[str, Optional[str]]) – Mapping from existing operating mode values to replacement values; None removes a value.

operating_modes
class mbdlyb.functional.gdb.GRealizesRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

Realizes relation in graph database: Hardware realizes Function.

Persists RealizesRelation to graph database with validation that source is Hardware and target is Function.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.RealizesRelation

Load a RealizesRelation from graph database.

Parameters:
  • from_uid (str) – Hardware node UID.

  • to_uid (str) – Function node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

RealizesRelation

validate() → list[mbdlyb.messages.ValidationMessage]

Validate Realizes relation constraints.

Returns:

Start must be Hardware, end must be Function.

Return type:

list[ValidationMessage]

class mbdlyb.functional.gdb.GReportsErrorRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

ReportsError relation in graph database: Function reports_error ObservedError.

Persists relation enabling error reporting.

Variables:

error_code (str) – Error code identifier.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.ReportsErrorRelation

Load a ReportsErrorRelation from graph database.

Parameters:
  • from_uid (str) – Enabling function node UID.

  • to_uid (str) – Error node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

ReportsErrorRelation

error_code
class mbdlyb.functional.gdb.GRequiredForRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

RequiredFor relation in graph database: Function required_for Function.

Persists RequiredForRelation with operating modes and error codes.

Variables:
  • operating_modes (list[str]) – Operating mode constraints.

  • error_codes (list[str]) – Error codes propagating through relation.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, operating_modes: dict[mbdlyb.functional.operating_mode.OpmSet, mbdlyb.functional.base.OperatingMode] | None = None, value_opm_map: dict[str, mbdlyb.functional.operating_mode.OpmSet] | None = None, error_nodes: dict[str, mbdlyb.functional.base.ObservedError] | None = None, **kwargs) → mbdlyb.functional.base.RequiredForRelation

Load a RequiredForRelation from graph database.

Parameters:
  • from_uid (str) – Source function UID.

  • to_uid (str) – Target function UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • operating_modes (Optional[dict]) – Operating mode nodes. Defaults to None.

  • value_opm_map (Optional[dict]) – Operating mode value mapping. Defaults to None.

  • error_nodes (Optional[dict]) – Error nodes. Defaults to None.

  • **kwargs – Additional parameters.

Returns:

Loaded relation with operating modes and error codes.

Return type:

RequiredForRelation

validate() → list[mbdlyb.messages.ValidationMessage]

Validate RequiredFor relation constraints.

Returns:

Both nodes must be Functions with no subfunctions.

Return type:

list[ValidationMessage]

error_codes
operating_modes
class mbdlyb.functional.gdb.GResultsInRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

ResultsIn relation in graph database: DiagnosticTest results_in DiagnosticTestResult.

Persists ResultsInRelation between tests and their results.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.ResultsInRelation

Load a ResultsInRelation from graph database.

Parameters:
  • from_uid (str) – Test node UID.

  • to_uid (str) – Test result node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

ResultsInRelation

class mbdlyb.functional.gdb.GSubfunctionOfRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

Subfunction relation in graph database: Function subfunction_of Function.

Persists SubfunctionOfRelation representing functional decomposition hierarchy.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.SubfunctionOfRelation

Load a SubfunctionOfRelation from graph database.

Parameters:
  • from_uid (str) – Subfunction UID.

  • to_uid (str) – Superfunction UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

SubfunctionOfRelation

validate() → list[mbdlyb.messages.ValidationMessage]

Validate Subfunction relation constraints.

Returns:

Both nodes must be Functions.

Return type:

list[ValidationMessage]

class mbdlyb.functional.gdb.GYieldsErrorRelation(**kwargs: dict[str, Any])

Bases: GFunctionalRelation

YieldsError relation in graph database: Function yields_error ObservedError.

Persists relation between function failures and error codes.

Variables:

error_code (str) – Error code identifier.

load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, **kwargs) → mbdlyb.functional.base.YieldsErrorRelation

Load a YieldsErrorRelation from graph database.

Parameters:
  • from_uid (str) – Function node UID.

  • to_uid (str) – Error node UID.

  • node_map (dict) – Node mapping.

  • net (Cluster) – Container cluster.

  • **kwargs – Additional parameters.

Returns:

Loaded relation.

Return type:

YieldsErrorRelation

error_code
mbdlyb.functional.gdb.update_name(obj)

Rename an element to avoid a duplicate among its sibling elements.

The element is assigned its existing name when unique, or the first available numbered suffix, and its fully qualified name is refreshed.

Parameters:

obj – Graph-database element whose name and fully qualified name are updated.

mbdlyb.functional.gdb.CLASS_ICONS
mbdlyb.functional.gdb.LBL_AFFECTS = 'AFFECTS'
mbdlyb.functional.gdb.LBL_COMMUNICATES_THROUGH = 'COMMUNICATES_THROUGH'
mbdlyb.functional.gdb.LBL_INDICATED_BY = 'INDICATED_BY'
mbdlyb.functional.gdb.LBL_OBSERVED = 'OBSERVED_BY'
mbdlyb.functional.gdb.LBL_REALIZES = 'REALIZES'
mbdlyb.functional.gdb.LBL_REPORTS_ERROR = 'REPORTS_ERROR'
mbdlyb.functional.gdb.LBL_REQUIRED = 'REQUIRED_FOR'
mbdlyb.functional.gdb.LBL_RESULTS_IN = 'RESULTS_IN'
mbdlyb.functional.gdb.LBL_SUBFUNCTION = 'SUBFUNCTION_OF'
mbdlyb.functional.gdb.LBL_YIELDS_ERROR = 'YIELDS_ERROR'