Skip to main content

Module rdf_serializers

Module rdf_serializers 

Source
Expand description

RDF Format Serializers for QualiaDB

Serializes NQuin data to standard RDF formats: N-Triples, Turtle, N-Quads, TriG, N3, JSON-LD.

Terms are resolved through the shared resolver primitives (write_iri_term / write_object_term), so subjects/predicates render as <iri> and objects render as <iri> or a typed literal ("42"^^<…#integer>) exactly as in the N-Triples path. The grouped formats (Turtle/TriG/N3) additionally produce valid surface syntax — subject joined to its predicate–object list with ; separators and a single trailing ., not the previous malformed “subject .” per line.

Known boundary (shared by every path here, including N-Triples): a plain or language-tagged string literal that was interned into the lexicon at ingest is indistinguishable from an IRI at this layer and renders as <…>. Inline-typed literals (integer/decimal/boolean/float) are distinguished and render correctly. Resolving interned string literals to "…"@lang output is an ingest-layer concern (the term must carry its literal flag) tracked separately; it is not silently faked here.

Functions§

serialize_to_cborld
Serialize Quins to CBOR-LD: a CBOR array of JSON-LD-shaped node maps ({"@id": <subject>, <predicate>: <object>}), one map per triple.
serialize_to_jsonld
Serialize Quins to JSON-LD (expanded node objects, grouped by subject).
serialize_to_n3
Serialize Quins to N3 format.
serialize_to_nquads
Serialize Quins to N-Quads format (zero-heap via resolver).
serialize_to_ntriples
Serialize Quins to N-Triples format (zero-heap via resolver).
serialize_to_trig
Serialize Quins to TriG format (named graphs of Turtle blocks).
serialize_to_turtle
Serialize Quins to Turtle format.