cemento.draw_io package#

Submodules#

cemento.draw_io.constants module#

class cemento.draw_io.constants.Connector(connector_id: str, source_id: str, target_id: str, connector_label_id: str, connector_val: str, rel_x_pos: float = 0, rel_y_pos: float = 0, start_pos_x: float = 0.5, start_pos_y: float = 1, end_pos_x: float = 0.5, end_pos_y: float = 0, is_dashed: bool = 0, is_curved: bool = 0, template_key: str = 'connector')#

Bases: DiagramObject

static compute_dynamic_position(source_shape_x: float, source_shape_y: float, target_shape_x: float, target_shape_y: float) tuple[float, float, float, float]#
connector_id: str#
connector_label_id: str#
connector_val: str#
end_pos_x: float = 0.5#
end_pos_y: float = 0#
is_curved: bool = 0#
is_dashed: bool = 0#
rel_x_pos: float = 0#
rel_y_pos: float = 0#
resolve_position(source_shape_pos: tuple[float, float], target_shape_pos: tuple[float, float], classes_only: bool = False, horizontal_tree: bool = False) None#
source_id: str#
start_pos_x: float = 0.5#
start_pos_y: float = 1#
target_id: str#
template_key: str = 'connector'#
class cemento.draw_io.constants.ConnectorType(*values)#

Bases: Enum

PROPERTY_CONNECTOR = 'property'#
RANK_CONNECTOR = 'rank'#
class cemento.draw_io.constants.DiagramInfo(diagram_name: int, diagram_id: int, modify_date: str = <factory>, grid_dx: int = 1600, grid_dy: int = 850, grid_size: int = 10, page_width: int = 1100, page_height: int = 850, diagram_content: int = None, template_key: str = 'scaffold')#

Bases: DiagramObject

diagram_content: int = None#
diagram_id: int#
diagram_name: int#
grid_dx: int = 1600#
grid_dy: int = 850#
grid_size: int = 10#
modify_date: str#
page_height: int = 850#
page_width: int = 1100#
template_key: str = 'scaffold'#
class cemento.draw_io.constants.DiagramKey(*values)#

Bases: Enum

LABEL = 'label'#
TERM_ID = 'term_id'#
class cemento.draw_io.constants.DiagramObject#

Bases: object

class cemento.draw_io.constants.GhostConnector(connector_id: str, source_id: str, target_id: str, connector_label_id: str, connector_val: str, rel_x_pos: float = 0, rel_y_pos: float = 0, start_pos_x: float = 0.5, start_pos_y: float = 1, end_pos_x: float = 0.5, end_pos_y: float = 0, is_dashed: bool = 1, is_curved: bool = 1, template_key: str = 'connector')#

Bases: Connector

is_curved: bool = 1#
is_dashed: bool = 1#
class cemento.draw_io.constants.NxEdge(subj, obj, pred)#

Bases: NamedTuple

obj: any#

Alias for field number 1

pred: any#

Alias for field number 2

subj: any#

Alias for field number 0

class cemento.draw_io.constants.NxStringEdge(subj: any, obj: any, pred: any)#

Bases: NxEdge

class cemento.draw_io.constants.Shape(shape_id: str, shape_content: str, fill_color: str, x_pos: float, y_pos: float, shape_width: int, shape_height: int, template_key: str = 'shape')#

Bases: object

fill_color: str#
shape_content: str#
shape_height: int#
shape_id: str#
shape_width: int#
template_key: str = 'shape'#
x_pos: float#
y_pos: float#
cemento.draw_io.constants.get_timestamp_str()#

cemento.draw_io.io module#

cemento.draw_io.io.get_diagram_headers(file_path: str | Path) dict[str, str]#
cemento.draw_io.io.get_template_files() dict[str, str | Path]#

cemento.draw_io.preprocessing module#

cemento.draw_io.preprocessing.clean_term(term: str) str#
cemento.draw_io.preprocessing.remove_html_quote(input_str: str) str#
cemento.draw_io.preprocessing.remove_literal_connector_id(connector: Connector) Connector#
cemento.draw_io.preprocessing.remove_literal_id(literal_content: str) str#
cemento.draw_io.preprocessing.remove_literal_shape_id(shape: Shape) Shape#
cemento.draw_io.preprocessing.remove_predicate_quotes(edges: Iterable[NxEdge]) Iterable[NxEdge]#
cemento.draw_io.preprocessing.remove_quotes(input_str: str) str#
cemento.draw_io.preprocessing.replace_quotes(input_str: str) str#
cemento.draw_io.preprocessing.replace_shape_html_quotes(shape: Shape) Shape#
cemento.draw_io.preprocessing.replace_term_quotes(graph: DiGraph) DiGraph#

cemento.draw_io.read_diagram module#

cemento.draw_io.read_diagram.read_drawio(input_path: str | Path, onto_ref_folder: str | Path = None, prefixes_folder: str | Path = None, defaults_folder: str | Path = None, relabel_key: DiagramKey = DiagramKey.LABEL, inverted_rank_arrow: bool = False) DiGraph#

cemento.draw_io.transforms module#

cemento.draw_io.transforms.compute_draw_positions(tree: DiGraph, root_node: any, horizontal_tree: bool = False) DiGraph#
cemento.draw_io.transforms.compute_grid_allocations(tree: DiGraph, root_node: any) DiGraph#
cemento.draw_io.transforms.extract_elements(elements: dict[str, dict[str, any]]) tuple[set[dict[str, any], set[str]]]#
cemento.draw_io.transforms.flip_edges(graph: DiGraph, filter_func: Callable[[any, any, dict[str, any]], bool] = None) DiGraph#
cemento.draw_io.transforms.flip_edges_of_graphs(graphs: Iterable[DiGraph], filter_func: Callable[[any, any, dict[str, any]], bool] = None) Iterable[DiGraph]#
cemento.draw_io.transforms.generate_diagram_content(diagram_name: str, diagram_uid: str, *diagram_objects: list[DiagramObject]) str#
cemento.draw_io.transforms.generate_graph(elements: dict[str, dict[str, any]], term_ids: set[str], relationship_ids: set[str], strat_terms: set[str] = None, inverted_rank_arrow: bool = False) DiGraph#
cemento.draw_io.transforms.generate_shapes(graph: DiGraph, diagram_uid: str, offset_x: int = 0, offset_y: int = 0, idx_start: int = 0, shape_color: str = '#f2f3f4', shape_height: int = 80, shape_width: int = 200) list[Shape]#
cemento.draw_io.transforms.get_connectors(edges: list[~cemento.draw_io.constants.NxStringEdge | tuple[str, str, str]], shape_positions: dict[str, tuple[float, float]], shape_ids: dict[str, str], diagram_uid: str, entity_idx_start: int = 0, connector_type: type[~cemento.draw_io.constants.Connector] = <class 'cemento.draw_io.constants.Connector'>) list[Connector]#
cemento.draw_io.transforms.get_graph_edges(graph: DiGraph, data_filter: Callable[[dict[str, any]], bool] = None) Iterable[NxEdge]#
cemento.draw_io.transforms.get_graph_root_nodes(graph: DiGraph) list[any]#
cemento.draw_io.transforms.get_non_ranked_strat_edges(graph: DiGraph) Iterable[tuple[any, any]]#
cemento.draw_io.transforms.get_predicate_connectors(graph: DiGraph, shape_positions: dict[str, tuple[float, float]], shape_ids: dict[str, str], diagram_uid: str, entity_idx_start: int = 0) list[Connector]#
cemento.draw_io.transforms.get_rank_connectors(graph: DiGraph, shape_positions: dict[str, tuple[float, float]], shape_ids: dict[str, str], diagram_uid: str, entity_idx_start: int = 0) list[Connector]#
cemento.draw_io.transforms.get_rank_connectors_from_trees(trees: list[DiGraph], shape_positions: dict[str, tuple[float, float]], shape_ids: dict[str, str], diagram_uid: str, entity_idx_start: int = 0) list[Connector]#
cemento.draw_io.transforms.get_ranked_subgraph(graph: DiGraph) DiGraph#
cemento.draw_io.transforms.get_shape_ids(shapes: list[Shape]) dict[str, str]#
cemento.draw_io.transforms.get_shape_positions(shapes: list[Shape]) dict[str, tuple[float, float]]#
cemento.draw_io.transforms.get_shape_positions_by_id(shapes: list[Shape]) dict[str, tuple[float, float]]#
cemento.draw_io.transforms.get_shapes_from_trees(trees: list[DiGraph], diagram_uid: str, entity_idx_start: int = 0, horizontal_tree: bool = False) list[Shape]#
cemento.draw_io.transforms.get_subgraphs(graph: DiGraph) list[DiGraph]#
cemento.draw_io.transforms.get_tree_size(tree: DiGraph) tuple[int, int]#
cemento.draw_io.transforms.parse_elements(file_path: str | Path) dict[str, dict[str, any]]#
cemento.draw_io.transforms.relabel_graph_nodes_with_node_attr(graph: DiGraph, new_attr_label: str = 'term_id') DiGraph#
cemento.draw_io.transforms.split_multiple_inheritances(graph: DiGraph) tuple[list[DiGraph], list[tuple[any, any]]]#
cemento.draw_io.transforms.translate_coords(x_pos: float, y_pos: float, origin_x: float = 0, origin_y: float = 0) tuple[int, int]#

cemento.draw_io.write_diagram module#

cemento.draw_io.write_diagram.draw_tree(graph: DiGraph, diagram_output_path: str | Path, translate_x: int = 0, translate_y: int = 0, classes_only: bool = False, horizontal_tree: bool = False) None#

Module contents#