raesl.compile.instantiating.edge_building#

Edge building for the instantiated output graph.

Reference: https://ratio-case.gitlab.io/docs/reference/esl_reference/dependency-derivations.html

Module Contents#

Classes#

EdgeStore

Edge storage with multiple categories for quicker access to specific subsets.

EdgeFactory

Functions#

_generate_evbc(→ Generator[ragraph.edge.Edge, None, None])

Compute logical dependencies between variables for a behavior case specification.

_get_component_behavior_dependency(...)

Check if two component nodes have a behavior dependency.

_get_paths_between_all(→ List[List[str]])

Compute paths between nodes. Based on depth first search.

_get_paths(→ List[List[str]])

Collection all paths (list of node names) between the source node and the set of

_get_function_behavior_dependency(...)

Check if two function spec nodes have a behavior dependency.

class raesl.compile.instantiating.edge_building.EdgeStore#

Edge storage with multiple categories for quicker access to specific subsets.

categories = ['edges']#
clear()#

Clear all edge categories.

add(edge: ragraph.edge.Edge, *args)#

Add node to self.nodes and any other specified maps in args.

consume(edges: Iterable[ragraph.edge.Edge], *args)#

Add any edges from an iterable to given categories.

class raesl.compile.instantiating.edge_building.EdgeFactory(diag_store: raesl.compile.diagnostics.DiagnosticStore, node_store: raesl.compile.instantiating.node_building.NodeStore | None = None)#
_add(edge: ragraph.edge.Edge, *args)#

Proxy for EdgeStore.add.

_consume(edges: Iterable[ragraph.edge.Edge], *args)#

Proxy for EdgeStore.consume.

_make(cat: str) List[ragraph.edge.Edge]#

Make an edge category if it is still empty and return it for quick access.

make_edges(node_store: raesl.compile.instantiating.node_building.NodeStore | None = None) List[ragraph.edge.Edge]#

Derive edges from a NodeStore object.

_make_evf()#

Compute functional dependencies between variable nodes.

_make_evb()#

Compute logical dependencies between variables for behavior specs.

_make_evd()#

Compute design dependencies between variables.

_make_ecf()#

Compute function dependencies between component nodes.

_make_ecb()#

Compute logical dependencies between components.

_make_ecd()#

Create design dependencies between components.

_make_eft()#

Create traceability dependencies between function specifications.

_make_eff()#

Creating all functional dependencies between between goals and transforms.

_make_efb()#

Compute behavior dependencies between goal- and transformation specs.

_make_ehb()#

Creating logical dependencies between behavior specifications.

_make_ehc()#

Creating coordination dependencies between behavior specifications.

_make_edc()#

Create coordination dependencies between design specifications.

_make_enc()#

Create coordination dependencies between needs.

_make_erc()#

Create coordination dependencies between relations.

_make_mcf()#

Compute mapping relations between components and functions.

_make_mcv()#

Create mapping relations between components and variables.

_make_mcb()#

Create mapping dependencies between components and behavior specs.

_make_mfb()#

Create mapping dependencies between function specs and behavior specs.

_make_mbv()#

Create mapping relations between behavior specifications and variables.

_make_mcd()#

Create mapping relations between components and design requirements.

_make_mcr()#

Create mapping relations between components and relations.

_make_mfv()#

Construct mapping dependencies between function specs and variables.

_make_mfd()#

Construct mapping dependencies between function specs and design specs.

_make_mfr()#

Create mapping dependencies between functions specs and relation specs.

_make_mbd()#

Create mapping dependencies between behavior requirements and design specifications.

_make_mbr()#

Create mapping dependencies between behavior requirements and relation specifications.

_make_mvd()#

Create mapping dependencies between variables and design specifications.

_make_mvr()#

Create mapping relations between variables and relation specifications.

_make_mdr()#

Create mapping dependencies between design specs and relation specs.

_make_mnx()#

Create mapping dependencies between needs and all other elements.

raesl.compile.instantiating.edge_building._generate_evbc(behavior: ragraph.node.Node, case: Dict[str, Any], nodes: Dict[str, ragraph.node.Node]) Generator[ragraph.edge.Edge, None, None]#

Compute logical dependencies between variables for a behavior case specification.

Parameters:
  • behavior – Behavior specification that contains the case from which the logical dependencies must be derived.

  • case – The case from which the logical dependencies must be derived.

  • nodes – Dictionary of node name to Node object.

Yields:

Corresponding edges.

raesl.compile.instantiating.edge_building._get_component_behavior_dependency(nodes: Dict[str, ragraph.node.Node], src: ragraph.node.Node, trg: ragraph.node.Node, ev_dict: Dict[Tuple[ragraph.node.Node, ragraph.node.Node], List[ragraph.edge.Edge]], vf_dict: Dict[str, List[ragraph.node.Node]]) ragraph.edge.Edge | None#

Check if two component nodes have a behavior dependency.

Parameters:
  • nodes – Dictionary from node to node name.

  • src – The source node for which the dependency must be checked.

  • trg – THe target node for which the dependency must be checked.

  • ev_dict – Dictionary of node pairs to list of edges.

  • vf_dict – Dictionary of variable name to function spec nodes.

Returns:

An Edge if a behavior dependency exists. Otherwise None.

raesl.compile.instantiating.edge_building._get_paths_between_all(srcs=List[Node], trgs=List[Node], edges=List[Edge]) List[List[str]]#

Compute paths between nodes. Based on depth first search.

Parameters:
  • srcs – List of starting nodes of paths.

  • trgs – Set of ending nodes of path.

  • edges – List of edges between nodes.

Yields:

List of lists of node names.

raesl.compile.instantiating.edge_building._get_paths(src: ragraph.node.Node, edge_dct: Dict[ragraph.node.Node, Dict[ragraph.node.Node, ragraph.edge.Edge]], trgs: Set[ragraph.node.Node], visited: List[ragraph.node.Node] = []) List[List[str]]#

Collection all paths (list of node names) between the source node and the set of target nodes.

Parameters:
  • src – The source nodes where all paths should start.

  • edge_dct – Dictionary of Node to Node to Edge. Contains the edges to be considered when searching for paths.

  • trgs – Set of node where the paths should end.

  • visited – List of nodes already visited. Required to prevent running in cycles.

Returns:

List of lists of node names.

raesl.compile.instantiating.edge_building._get_function_behavior_dependency(nodes: Dict[str, ragraph.node.Node], src: ragraph.node.Node, trg: ragraph.node.Node, ev_dict: Dict[Tuple[ragraph.node.Node, ragraph.node.Node], ragraph.edge.Edge], vf_dict: Dict[str, List[ragraph.node.Node]]) ragraph.edge.Edge | None#

Check if two function spec nodes have a behavior dependency.

Parameters:
  • nodes – Dictionary from node to node name.

  • src – The source node for which the dependency must be checked.

  • trg – THe target node for which the dependency must be checked.

  • ev_dict – Dictionary of node pairs to edge.

  • vf_dict – Dictionary of variable names to function specs.

Returns:

An Edge if a behavior dependency exists. Otherwise None.