mbdlyb.functional.gdb ===================== .. py:module:: mbdlyb.functional.gdb .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: mbdlyb.functional.gdb.CLASS_ICONS mbdlyb.functional.gdb.LBL_AFFECTS mbdlyb.functional.gdb.LBL_COMMUNICATES_THROUGH mbdlyb.functional.gdb.LBL_INDICATED_BY mbdlyb.functional.gdb.LBL_OBSERVED mbdlyb.functional.gdb.LBL_REALIZES mbdlyb.functional.gdb.LBL_REPORTS_ERROR mbdlyb.functional.gdb.LBL_REQUIRED mbdlyb.functional.gdb.LBL_RESULTS_IN mbdlyb.functional.gdb.LBL_SUBFUNCTION mbdlyb.functional.gdb.LBL_YIELDS_ERROR Classes ------- .. autoapisummary:: mbdlyb.functional.gdb.GAffectsRelation mbdlyb.functional.gdb.GCPTEnabledNode mbdlyb.functional.gdb.GCluster mbdlyb.functional.gdb.GCommunicatesThroughRelation mbdlyb.functional.gdb.GDiagnosticTest mbdlyb.functional.gdb.GDiagnosticTestResult mbdlyb.functional.gdb.GDirectObservable mbdlyb.functional.gdb.GFunction mbdlyb.functional.gdb.GFunctionalNode mbdlyb.functional.gdb.GFunctionalRelation mbdlyb.functional.gdb.GHardware mbdlyb.functional.gdb.GIndicatedByRelation mbdlyb.functional.gdb.GObservableNode mbdlyb.functional.gdb.GObserved mbdlyb.functional.gdb.GObservedByRelation mbdlyb.functional.gdb.GObservedError mbdlyb.functional.gdb.GOperatingMode mbdlyb.functional.gdb.GRealizesRelation mbdlyb.functional.gdb.GReportsErrorRelation mbdlyb.functional.gdb.GRequiredForRelation mbdlyb.functional.gdb.GResultsInRelation mbdlyb.functional.gdb.GSubfunctionOfRelation mbdlyb.functional.gdb.GYieldsErrorRelation Functions --------- .. autoapisummary:: mbdlyb.functional.gdb.update_name Module Contents --------------- .. py:class:: GAffectsRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`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. .. py:method:: 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. :param from_uid: Hardware node UID. :type from_uid: str :param to_uid: Function node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: AffectsRelation .. py:method:: 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. :rtype: list[ValidationMessage] .. py:class:: GCPTEnabledNode(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate this node and its conditional probability table. :returns: Messages from node, relationships, and CPT validation. :rtype: list[ValidationMessage] .. py:method:: 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. :rtype: list[ValidationMessage] .. py:attribute:: cpt .. py:property:: cpt_url :type: str :abstractmethod: Return the URL at which a subclass's CPT can be edited. :returns: URL for the subclass's CPT editor. :rtype: str :raises NotImplementedError: This property must be implemented by subclasses. .. py:property:: has_cpt Indicate whether a CPT is stored for this node. :returns: True when the node's CPT data is non-empty. :rtype: bool .. py:class:: GCluster(*args: Any, **kwargs: Any) Bases: :py:obj:`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. :ivar __label__: Neo4j node label for network type. :ivar elements: All elements contained in this network. :ivar mbdnodes: All nodes contained in this network. :ivar subnets: All sub-networks contained in this network. .. py:method:: delete() Delete all elements in this cluster and then delete the cluster itself. .. py:method:: get_subnets() -> dict[str, GCluster] Return this cluster's direct subclusters keyed by name. :returns: Direct child clusters indexed by their names. :rtype: dict[str, GCluster] .. py:method:: load(node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: Optional[mbdlyb.MBDNet] = None) -> mbdlyb.functional.base.Cluster Load this database cluster and its elements into an in-memory model. :param node_map: Mapping populated with each database element and its in-memory counterpart. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param net: Parent in-memory network, if any. :type net: Optional[MBDNet] :returns: The loaded cluster, with its elements registered in ``node_map``. :rtype: Cluster .. py:method:: 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: Optional[multiprocessing.Queue] = None) -> GCluster :classmethod: Import a Capella architecture and optional CPT spreadsheets. :param architecture: Architecture name to import. :type architecture: str :param default_fn_tests: Whether to create default function tests. :type default_fn_tests: bool :param default_hl_fn_tests: Whether to create default high-level function tests. :type default_hl_fn_tests: bool :param default_hw_tests: Whether to create default hardware tests. :type default_hw_tests: bool :param default_ll_hw_tests: Whether to create default low-level hardware tests. :type default_ll_hw_tests: bool :param import_opms: Whether to import operating modes. :type import_opms: bool :param \*files: Capella and spreadsheet paths or glob patterns. :type \*files: Path :param queue: Optional queue passed to the Capella transformer. :type queue: Optional[Queue] :returns: Imported graph-database cluster. :rtype: GCluster .. py:method:: relation_kwargs(net: mbdlyb.functional.base.Cluster) -> dict[str, Any] Build shared keyword arguments used to load relations in this cluster. :param net: In-memory cluster whose operating modes and errors supply relation context. :type net: Cluster :returns: Parent relation arguments plus operating mode and error node lookup maps. :rtype: dict[str, Any] .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate cluster constraints, including root-level function cycles. :returns: Cyclic dependency errors and messages from the parent network validation. :rtype: list[ValidationMessage] .. py:attribute:: GDB_NODE_TRANSFORM_CLASSES :type: dict[Type[GFunctionalNode], tuple[Type[mbdlyb.functional.base.FunctionalNode], list[str]]] .. py:attribute:: GDB_RELATION_TRANSFORM_CLASSES :type: dict[Type[GFunctionalRelation], tuple[Type[mbdlyb.functional.base.FunctionalDependency], list[str]]] .. py:attribute:: XLS_NODE_CLASSES :type: dict[str, tuple[Type[GFunctionalNode], tuple]] .. py:attribute:: functions .. py:attribute:: hardware .. py:property:: is_abstract :type: 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. :rtype: bool .. py:property:: is_flat :type: bool Check whether this cluster contains no child clusters. :returns: True when the cluster has no subnets. :rtype: bool .. py:attribute:: net .. py:attribute:: observables .. py:attribute:: operating_modes .. py:attribute:: subnets .. py:attribute:: test_results .. py:attribute:: tests .. py:class:: GCommunicatesThroughRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` CommunicatesThrough relation in graph database: Function communicates_through Function. Persists error propagation through inter-function communication. :ivar error_codes: Error codes propagating through communication. :vartype error_codes: list[str] .. py:method:: load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, error_nodes: Optional[dict[str, mbdlyb.functional.base.ObservedError]] = None, **kwargs) -> mbdlyb.functional.base.CommunicatesThroughRelation Load a CommunicatesThroughRelation from graph database. :param from_uid: Source function UID. :type from_uid: str :param to_uid: Target function UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param error_nodes: Error nodes. Defaults to None. :type error_nodes: Optional[dict] :param \*\*kwargs: Additional parameters. :returns: Loaded relation with error codes. :rtype: CommunicatesThroughRelation .. py:attribute:: error_codes .. py:class:: GDiagnosticTest(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: delete() Delete all test results before deleting this diagnostic test. .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the test. :type root: Cluster :returns: The corresponding in-memory test. :rtype: DiagnosticTest .. py:method:: 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. :rtype: list[GMBDNode] .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate this test and each result it produces. :returns: Validation messages for the test and its results. :rtype: list[ValidationMessage] .. py:attribute:: RELATION_ATTRIBUTES :value: [('test_results', 'results_from')] .. py:attribute:: fixed_cost .. py:attribute:: preconditions .. py:attribute:: test_results .. py:class:: GDiagnosticTestResult(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: 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. :rtype: list[GFunctionalNode] .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the result. :type root: Cluster :returns: The result, including its stored CPT when present. :rtype: DiagnosticTestResult .. py:attribute:: RELATION_ATTRIBUTES :value: [('results_from', 'results_from'), ('indicated_functions', 'indicated_by'),... .. py:property:: cpt_url :type: str Return the URL for editing this test result's CPT. :returns: Test-result CPT endpoint. :rtype: str .. py:attribute:: fn_rate .. py:attribute:: fp_rate .. py:attribute:: indicated_functions .. py:attribute:: indicated_hardware .. py:attribute:: results_from .. py:property:: test :type: GDiagnosticTest Return the diagnostic test that produces this result. :returns: Related test node. :rtype: GDiagnosticTest .. py:class:: GDirectObservable(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: get_observed_nodes() -> list[GFunctionalNode] Return observed hardware and functions in fully qualified-name order. :returns: Components connected to this observable. :rtype: list[GFunctionalNode] .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the observable. :type root: Cluster :returns: The observable, including its stored CPT when present. :rtype: DirectObservable .. py:attribute:: RELATION_ATTRIBUTES :value: [('observed_functions', 'observed_by'), ('observed_hardware', 'observed_by')] .. py:property:: cpt_url :type: str Return the URL for editing this observable's CPT. :returns: Observable CPT endpoint. :rtype: str .. py:attribute:: fn_rate .. py:attribute:: fp_rate .. py:attribute:: observed_functions .. py:attribute:: observed_hardware .. py:class:: GFunction(*args: Any, **kwargs: Any) Bases: :py:obj:`GCPTEnabledNode`, :py:obj:`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. .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the function. :type root: Cluster :returns: The function, including its stored CPT when present. :rtype: Function .. py:method:: 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. :rtype: list[GFunctionalNode] .. py:attribute:: RELATION_ATTRIBUTES :value: [('subfunction_of', 'subfunctions'), ('subfunctions', 'subfunction_of'), ('realized_by',... .. py:attribute:: affected_by .. py:attribute:: communicates_from .. py:attribute:: communicates_through .. py:property:: cpt_url :type: str Return the URL for editing this function's CPT. :returns: Function CPT endpoint. :rtype: str .. py:property:: has_subfunctions :type: bool Check whether this function has any directly nested subfunctions. :returns: True when at least one subfunction is connected. :rtype: bool .. py:attribute:: realized_by .. py:attribute:: reports_error .. py:attribute:: required_for .. py:attribute:: requires .. py:property:: requires_cpt :type: bool Check whether custom states in this function's dependencies require a CPT. :returns: True if this function or a dependency has custom states. :rtype: bool .. py:attribute:: subfunction_of .. py:attribute:: subfunctions .. py:attribute:: yields_error .. py:class:: GFunctionalNode(*args: Any, **kwargs: Any) Bases: :py:obj:`mbdlyb.gdb.GMBDNode`\ [\ :py:obj:`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. .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate the node and its managed relationships. :returns: Validation messages from the node and each managed relationship. :rtype: list[ValidationMessage] .. py:attribute:: RELATION_ATTRIBUTES :type: list[tuple[str]] :value: [] .. py:property:: has_cpt :type: bool Indicate whether this node has a conditional probability table. :returns: False because generic functional nodes do not store CPTs. :rtype: bool .. py:attribute:: net .. py:property:: requires_cpt :type: bool Indicate whether this node requires a conditional probability table. :returns: False because generic functional nodes do not require CPTs. :rtype: bool .. py:class:: GFunctionalRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`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. :ivar weight: Strength/probability weight of the dependency. :vartype weight: float .. py:method:: 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 :abstractmethod: Load a relation from graph database to in-memory model. :param from_uid: UID of source node. :type from_uid: str :param to_uid: UID of target node. :type to_uid: str :param node_map: Mapping from UIDs to (GDB node, in-memory node) tuples. :type node_map: dict :param net: The cluster containing this relation. :type net: Cluster :param \*\*kwargs: Additional parameters for loading. :returns: Loaded in-memory dependency relation. :rtype: FunctionalDependency .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] :abstractmethod: Validate the relation for consistency constraints. :returns: List of validation errors and warnings. :rtype: list[ValidationMessage] .. py:attribute:: weight .. py:class:: GHardware(*args: Any, **kwargs: Any) Bases: :py:obj:`GFunctionalNode`, :py:obj:`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. .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the hardware. :type root: Cluster :returns: The corresponding in-memory hardware node. :rtype: Hardware .. py:method:: 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. :rtype: list[GMBDNode] .. py:attribute:: BASE_PRIOR .. py:attribute:: RELATION_ATTRIBUTES :value: [('realizes', 'realized_by'), ('affects', 'affected_by'), ('observed_by', 'observed_hardware'),... .. py:attribute:: affects .. py:attribute:: fault_rates .. py:property:: priors :type: dict[str, float] Calculate the prior probability assigned to each hardware state. :returns: Healthy-state probability and configured fault rates. :rtype: dict[str, float] .. py:attribute:: realizes .. py:property:: states :type: list[str] Return the healthy state followed by this hardware's fault states. :returns: All possible hardware states. :rtype: list[str] .. py:class:: GIndicatedByRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` IndicatedBy relation in graph database: Node indicated_by TestResult. Persists IndicatedByRelation between nodes and diagnostic test results. .. py:method:: 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. :param from_uid: Indicated node UID. :type from_uid: str :param to_uid: Test result node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: IndicatedByRelation .. py:class:: GObservableNode(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: get_observed_nodes() -> list[GFunctionalNode] :abstractmethod: Return the components observed by this observable. :returns: Components connected to this observable. :rtype: list[GFunctionalNode] :raises NotImplementedError: This method must be implemented by concrete observable node types. .. py:method:: parents() -> list[GFunctionalNode] Return the components observed by this node. :returns: Nodes whose states contribute to the observation. :rtype: list[GFunctionalNode] .. py:method:: reposition() -> Optional[tuple[mbdlyb.fqn.FQN, mbdlyb.fqn.FQN, mbdlyb.fqn.FQN]] 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. :rtype: Optional[tuple[FQN, FQN, FQN]] .. py:property:: requires_cpt :type: bool Check whether this observable's custom states require an explicit CPT. :returns: True if the observable or any observed node has custom states. :rtype: bool .. py:class:: GObserved .. py:attribute:: indicated_by .. py:attribute:: observed_by .. py:class:: GObservedByRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` ObservedBy relation in graph database: Node observed_by Observable. Persists ObservedByRelation between hardware/functions and observables. .. py:method:: 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. :param from_uid: Observed node UID. :type from_uid: str :param to_uid: Observable node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: ObservedByRelation .. py:class:: GObservedError(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: get_observed_nodes() -> list[GFunctionalNode] Return functions that yield this observed error. :returns: Functions connected through yields-error relations, in fully qualified-name order. :rtype: list[GFunctionalNode] .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused while creating this node. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the error. :type root: Cluster :returns: The error node, including its stored CPT when present. :rtype: ObservedError .. py:attribute:: RELATION_ATTRIBUTES :value: [('observed_function', 'reporting_function')] .. py:attribute:: error_code .. py:attribute:: fn_rate .. py:attribute:: fp_rate .. py:attribute:: observed_function .. py:attribute:: reporting_function .. py:class:: GOperatingMode(*args: Any, **kwargs: Any) Bases: :py:obj:`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. .. py:method:: 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. :param node_map: Mapping of database and in-memory elements; unused for this node type. :type node_map: dict[str, tuple[GMBDElement, MBDElement]] :param root: In-memory cluster to contain the operating mode. :type root: Cluster :returns: The corresponding in-memory node. :rtype: OperatingMode .. py:method:: on_delete() Remove this operating mode's values from dependent relations. .. py:method:: 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. :rtype: list[GMBDNode] .. py:method:: update_relations_with_operating_mode(updates: dict[str, Optional[str]]) :staticmethod: Update operating mode values stored on required-for relations. :param updates: Mapping from existing operating mode values to replacement values; ``None`` removes a value. :type updates: dict[str, Optional[str]] .. py:attribute:: operating_modes .. py:class:: GRealizesRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` Realizes relation in graph database: Hardware realizes Function. Persists RealizesRelation to graph database with validation that source is Hardware and target is Function. .. py:method:: 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. :param from_uid: Hardware node UID. :type from_uid: str :param to_uid: Function node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: RealizesRelation .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate Realizes relation constraints. :returns: Start must be Hardware, end must be Function. :rtype: list[ValidationMessage] .. py:class:: GReportsErrorRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` ReportsError relation in graph database: Function reports_error ObservedError. Persists relation enabling error reporting. :ivar error_code: Error code identifier. :vartype error_code: str .. py:method:: 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. :param from_uid: Enabling function node UID. :type from_uid: str :param to_uid: Error node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: ReportsErrorRelation .. py:attribute:: error_code .. py:class:: GRequiredForRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` RequiredFor relation in graph database: Function required_for Function. Persists RequiredForRelation with operating modes and error codes. :ivar operating_modes: Operating mode constraints. :vartype operating_modes: list[str] :ivar error_codes: Error codes propagating through relation. :vartype error_codes: list[str] .. py:method:: load(from_uid: str, to_uid: str, node_map: dict[str, tuple[mbdlyb.gdb.GMBDElement, mbdlyb.MBDElement]], net: mbdlyb.functional.base.Cluster, operating_modes: Optional[dict[mbdlyb.functional.operating_mode.OpmSet, mbdlyb.functional.base.OperatingMode]] = None, value_opm_map: Optional[dict[str, mbdlyb.functional.operating_mode.OpmSet]] = None, error_nodes: Optional[dict[str, mbdlyb.functional.base.ObservedError]] = None, **kwargs) -> mbdlyb.functional.base.RequiredForRelation Load a RequiredForRelation from graph database. :param from_uid: Source function UID. :type from_uid: str :param to_uid: Target function UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param operating_modes: Operating mode nodes. Defaults to None. :type operating_modes: Optional[dict] :param value_opm_map: Operating mode value mapping. Defaults to None. :type value_opm_map: Optional[dict] :param error_nodes: Error nodes. Defaults to None. :type error_nodes: Optional[dict] :param \*\*kwargs: Additional parameters. :returns: Loaded relation with operating modes and error codes. :rtype: RequiredForRelation .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate RequiredFor relation constraints. :returns: Both nodes must be Functions with no subfunctions. :rtype: list[ValidationMessage] .. py:attribute:: error_codes .. py:attribute:: operating_modes .. py:class:: GResultsInRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` ResultsIn relation in graph database: DiagnosticTest results_in DiagnosticTestResult. Persists ResultsInRelation between tests and their results. .. py:method:: 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. :param from_uid: Test node UID. :type from_uid: str :param to_uid: Test result node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: ResultsInRelation .. py:class:: GSubfunctionOfRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` Subfunction relation in graph database: Function subfunction_of Function. Persists SubfunctionOfRelation representing functional decomposition hierarchy. .. py:method:: 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. :param from_uid: Subfunction UID. :type from_uid: str :param to_uid: Superfunction UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: SubfunctionOfRelation .. py:method:: validate() -> list[mbdlyb.messages.ValidationMessage] Validate Subfunction relation constraints. :returns: Both nodes must be Functions. :rtype: list[ValidationMessage] .. py:class:: GYieldsErrorRelation(**kwargs: dict[str, Any]) Bases: :py:obj:`GFunctionalRelation` YieldsError relation in graph database: Function yields_error ObservedError. Persists relation between function failures and error codes. :ivar error_code: Error code identifier. :vartype error_code: str .. py:method:: 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. :param from_uid: Function node UID. :type from_uid: str :param to_uid: Error node UID. :type to_uid: str :param node_map: Node mapping. :type node_map: dict :param net: Container cluster. :type net: Cluster :param \*\*kwargs: Additional parameters. :returns: Loaded relation. :rtype: YieldsErrorRelation .. py:attribute:: error_code .. py:function:: 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. :param obj: Graph-database element whose name and fully qualified name are updated. .. py:data:: CLASS_ICONS .. py:data:: LBL_AFFECTS :value: 'AFFECTS' .. py:data:: LBL_COMMUNICATES_THROUGH :value: 'COMMUNICATES_THROUGH' .. py:data:: LBL_INDICATED_BY :value: 'INDICATED_BY' .. py:data:: LBL_OBSERVED :value: 'OBSERVED_BY' .. py:data:: LBL_REALIZES :value: 'REALIZES' .. py:data:: LBL_REPORTS_ERROR :value: 'REPORTS_ERROR' .. py:data:: LBL_REQUIRED :value: 'REQUIRED_FOR' .. py:data:: LBL_RESULTS_IN :value: 'RESULTS_IN' .. py:data:: LBL_SUBFUNCTION :value: 'SUBFUNCTION_OF' .. py:data:: LBL_YIELDS_ERROR :value: 'YIELDS_ERROR'