Skip to content

gds_interchange.owl.serialize

RDF serialization utilities (Turtle format).

Serialization convenience functions — Graph to Turtle/JSON-LD/N-Triples.

Also provides high-level shortcuts that combine export + serialization.

to_turtle(graph)

Serialize an RDF graph to Turtle format.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def to_turtle(graph: Graph) -> str:
    """Serialize an RDF graph to Turtle format."""
    return graph.serialize(format="turtle")

to_jsonld(graph)

Serialize an RDF graph to JSON-LD format.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def to_jsonld(graph: Graph) -> str:
    """Serialize an RDF graph to JSON-LD format."""
    return graph.serialize(format="json-ld")

to_ntriples(graph)

Serialize an RDF graph to N-Triples format.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def to_ntriples(graph: Graph) -> str:
    """Serialize an RDF graph to N-Triples format."""
    return graph.serialize(format="nt")

spec_to_turtle(spec, **kwargs)

Export a GDSSpec directly to Turtle string.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def spec_to_turtle(spec: GDSSpec, **kwargs: Any) -> str:
    """Export a GDSSpec directly to Turtle string."""
    return to_turtle(spec_to_graph(spec, **kwargs))

system_ir_to_turtle(system, **kwargs)

Export a SystemIR directly to Turtle string.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def system_ir_to_turtle(system: SystemIR, **kwargs: Any) -> str:
    """Export a SystemIR directly to Turtle string."""
    return to_turtle(system_ir_to_graph(system, **kwargs))

canonical_to_turtle(canonical, **kwargs)

Export a CanonicalGDS directly to Turtle string.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def canonical_to_turtle(canonical: CanonicalGDS, **kwargs: Any) -> str:
    """Export a CanonicalGDS directly to Turtle string."""
    return to_turtle(canonical_to_graph(canonical, **kwargs))

report_to_turtle(report, **kwargs)

Export a VerificationReport directly to Turtle string.

Source code in packages/gds-interchange/gds_interchange/owl/serialize.py
def report_to_turtle(report: VerificationReport, **kwargs: Any) -> str:
    """Export a VerificationReport directly to Turtle string."""
    return to_turtle(report_to_graph(report, **kwargs))