modules/rdf/serializer/ntriples.zzm

rdf-0.0.3 documentation

NAME

rdf/serializer/ntriples - N-Triples serializer.

SYNOPSIS

  from rdf/serializer/ntriples import NTriplesSerializer;

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

DESCRIPTION

NTriplesSerializer serializes default-graph RDF quads as RDF 1.1 N-Triples. It escapes control characters, quotes, backslashes, and IRI characters that cannot be emitted directly. It throws if a term cannot be represented in N-Triples, such as an invalid blank node label.

EXPORTS

Classes

  • NTriplesSerializer
    • line(quad)

      Returns one N-Triples statement without a trailing newline. The graph term is ignored.

    • serialize_each(Array quads, Function emit)

      Calls emit once per serialized line, including the trailing newline. Returns the serializer.

    • serialize(Array quads)

      Returns the complete serialized string, ending with a newline when there is at least one quad.

COPYRIGHT AND LICENCE

rdf/serializer/ntriples 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.