modules/rdf/serializer/trig.zzm

rdf-0.0.3 documentation

NAME

rdf/serializer/trig - Pretty TriG serializer.

SYNOPSIS

  from rdf/serializer/trig import TriGSerializer;

  let text := (new TriGSerializer()).serialize(quads);

DESCRIPTION

TriGSerializer serializes RDF datasets as RDF 1.1 TriG. It is based on the pretty Turtle serializer, so graph contents use the same prefix, QName, predicate ordering, RDF list, and blank-node nesting behaviour.

By default, default-graph triples are serialized without wrapping braces, and named graphs are serialized using the GRAPH keyword. These defaults match the shape shown in example 3 of section 2.2 of the RDF 1.1 TriG specification. Pass wrap_default: true to wrap the default graph in braces, or graph_keyword: false to omit GRAPH before named graph blocks.

EXPORTS

Classes

  • TriGSerializer
    • serialize(Array quads)

      Returns pretty TriG for quads.

    • serialize_each(Array quads, Function emit)

      Calls emit with the serialized TriG text when there is output. Returns the serializer.

COPYRIGHT AND LICENCE

rdf/serializer/trig is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.