eta.plan.PlanNode

class PlanNode(step)[source]

Bases: object

A node in the doubly linked list that represents the system’s plan.

Parameters:

step (PlanStep) – The plan step contained within this node.

step

The plan step contained within this node.

Type:

PlanStep

prev

The next plan node in the linked list.

Type:

PlanNode

next

The previous plan node in the linked list.

Type:

PlanNode

Methods

add_schema_to_subplan

Add the given schema to each plan step in the subplan headed by this node.

add_superstep_to_subplan

Add the step of a given plan node as a superstep of each node within the subplan headed by this node.

add_supersteps

Given a subplan bounded between a given start and end node, add each as a superstep of this node.

bind

Bind the given variable symbol to the given value throughout the entire plan structure.

get_all_roots

Get all root plan steps (i.e., the most abstract steps) reachable from the current plan.

get_schemas

Get all schemas of this plan.

serialize_from_roots

Format a string representing the subtrees of the plan structure reachable from each root step.

serialize_subtree

Format a string representing the subtree of the plan structure reachable from this node.

status

Format the plan structure as a status string showing the current, past, and future surface steps.

to_graph

Convert a plan structure to a standard graph object, i.e., a list of vertices and edges.

unbind

Unbind the given variable symbol throughout the entire plan structure.

add_superstep_to_subplan(node)[source]

Add the step of a given plan node as a superstep of each node within the subplan headed by this node.

Parameters:

node (PlanNode) – The node whose step should be added as a superstep.

add_supersteps(start_node, end_node)[source]

Given a subplan bounded between a given start and end node, add each as a superstep of this node.

Parameters:
  • start_node (PlanNode) – The beginning of the subplan whose steps should be added as a superstep.

  • end_node (PlanNode) – The end of the subplan whose steps should be added as a superstep.

add_schema_to_subplan(schema)[source]

Add the given schema to each plan step in the subplan headed by this node.

Parameters:

schema (Schema) – The schema object to add to the schema lists for each plan step.

get_schemas()[source]

Get all schemas of this plan.

get_all_roots()[source]

Get all root plan steps (i.e., the most abstract steps) reachable from the current plan.

bind(var, val)[source]

Bind the given variable symbol to the given value throughout the entire plan structure.

unbind(var)[source]

Unbind the given variable symbol throughout the entire plan structure.

status(before=3, after=5, schemas=False)[source]

Format the plan structure as a status string showing the current, past, and future surface steps.

Parameters:
  • before (int, default=3) – The number of past surface steps to show.

  • after (int, default=5) – The number of future surface steps to show.

  • schemas (bool, default=False) – Whether to also display schema predicates for each step.

Return type:

str

serialize_subtree(schemas=False)[source]

Format a string representing the subtree of the plan structure reachable from this node.

Parameters:

schemas (bool, default=False) – Whether to also display schema predicates for each step.

Return type:

str

serialize_from_roots(schemas=False)[source]

Format a string representing the subtrees of the plan structure reachable from each root step.

Parameters:

schemas (bool, default=False) – Whether to also display schema predicates for each step.

Return type:

str

to_graph(before=3, after=5, schemas=False)[source]

Convert a plan structure to a standard graph object, i.e., a list of vertices and edges.

Parameters:
  • before (int, default=3) – The number of past surface steps to include in the graph.

  • after (int, default=5) – The number of future surface steps to include in the graph.

  • schemas (bool, default=False) – Whether to also display schema predicates in the labels for each step.

Returns:

  • nodes (list[tuple[str, str]]) – A list of vertices/nodes in the resulting graph, where each node is an (<id>, <label>) tuple.

  • edges (list[tuple[str, str]]) – A list of edges in the resulting graph, where each edge is an (<id1>, <id2>) tuple.

__str__()[source]

Return str(self).