hydra.rdf.serde module

Serialization functions for converting RDF graphs to N-Triples format expressions.

hydra.rdf.serde.blank_node_to_expr(bnode: BlankNode) Expr

Convert a blank node to an expression.

hydra.rdf.serde.escape_iri_char(c: int) str

Escape a single IRI character code to a string.

hydra.rdf.serde.escape_iri_str(s: str) str

Escape a string for use in an N-Triples IRI. Disallowed characters are emitted as 4-digit UCHAR escapes.

hydra.rdf.serde.escape_literal_char(c: int) str

Escape a single literal character code to a string.

hydra.rdf.serde.escape_literal_string(s: str) str

Escape a string for use in an N-Triples literal.

hydra.rdf.serde.graph_to_expr(g: Graph) Expr

Convert an RDF graph to an expression.

hydra.rdf.serde.hex_digit(n: int) int

Convert a value 0-15 to an uppercase hex digit code point.

hydra.rdf.serde.iri_to_expr(iri: Iri) Expr

Convert an IRI to an expression.

hydra.rdf.serde.language_tag_to_expr(lang: LanguageTag) Expr

Convert a language tag to an expression.

hydra.rdf.serde.literal_to_expr(lit: Literal) Expr

Convert a literal to an expression.

hydra.rdf.serde.node_to_expr(n: Node_) Expr

Convert a node to an expression.

hydra.rdf.serde.rdf_graph_to_ntriples(g: Graph) str

Convert an RDF graph to an N-Triples string.

hydra.rdf.serde.resource_to_expr(r: Resource) Expr

Convert a resource to an expression.

hydra.rdf.serde.triple_to_expr(t: Triple) Expr

Convert a triple to an expression.

hydra.rdf.serde.uchar4(c: int) str

Format a code point as a 4-digit UCHAR escape sequence.