kapps_ogm.utils.pretty_print#

kapps_ogm.utils.pretty_print.format_triples_turtle(triples) → str[source]#

Format a set of RDF triples in a Turtle-like structure.

Parameters:

triples – Set or list of (subject, predicate, object) tuples.

Returns:

Formatted triples in Turtle-like syntax.

Return type:

str

kapps_ogm.utils.pretty_print.format_node_data(node_data: Dict[Any, List[Any]]) → Dict[str, Any][source]#

Convert Node.data with IRI keys and Node values to JSON-serializable format.

Recursively converts IRI and BNode objects to strings, enabling JSON serialization.

Parameters:

node_data – Node.data dictionary with IRI keys and mixed values.

Returns:

Dict with all IRI/BNode objects converted to strings.

kapps_ogm.utils.pretty_print.format_property_spec(prop_spec: PropertySpec, indent: int = 0) → str[source]#

Recursively converts a PropertySpec (with nested ClassSpec) into a formatted string.

Parameters:
  • prop_spec – PropertySpec instance to format.

  • indent – Indentation level for nested structures.

Returns:

Formatted PropertySpec representation.

Return type:

str

kapps_ogm.utils.pretty_print.format_class_spec(class_spec: ClassSpec, indent: int = 0) → str[source]#

Recursively converts a ClassSpec (with nested PropertySpec objects) into a formatted string.

Parameters:
  • class_spec – ClassSpec instance to format.

  • indent – Indentation level for nested structures.

Returns:

Formatted ClassSpec representation.

Return type:

str