hydra.pg.graphson.utils module

Utility functions for GraphSON encoding and property graph conversion.

hydra.pg.graphson.utils.elements_to_vertices_with_adjacent_edges(els: Sequence[object]) Sequence[VertexWithAdjacentEdges[T0]]

Convert a list of property graph elements to a list of vertices with their adjacent edges.

hydra.pg.graphson.utils.encode_literal_value(lit: Literal) object

Encode a Hydra Literal as a GraphSON Value.

hydra.pg.graphson.utils.encode_string_value(s: str) object

Encode a String value as a GraphSON Value.

hydra.pg.graphson.utils.encode_term_value(term: Term) object

Encode a Hydra Term as a GraphSON Value. Supports literals and unit values.

hydra.pg.graphson.utils.pg_elements_to_graphson(encode_value: Callable[[T0], object], els: Sequence[object]) object

Convert property graph elements to a list of GraphSON JSON values.