modules/rdf/parser/turtle.zzm

rdf-0.0.3 documentation

NAME

rdf/parser/turtle - Turtle parser.

SYNOPSIS

  from rdf/parser/turtle import TurtleParser;

  let parser := new TurtleParser();
  let quads := parser.parse_string("""
  @prefix ex: <http://example.com/> .
  ex:s ex:p "value" .
  """);

DESCRIPTION

TurtleParser parses RDF 1.1 Turtle into default-graph quads. It supports Turtle directives, SPARQL-style PREFIX and BASE, relative IRI resolution, blank node property lists, collections, object lists, language tags, datatypes, numerics, booleans, and single, double, and long string forms.

Parser options are base, used to resolve relative IRIs, and into, used to load parsed quads directly into a store.

EXPORTS

Classes

  • TurtleParser
    • parse_string(String text, ... options)

      Parses text. Returns an array of quads, or the supplied into store after adding the quads. Throws RDFSyntaxError on invalid input.

    • parse_file(path, ... options)

      Reads UTF-8 from path and parses it.

    • parse_lines(Array lines, ... options)

      Parses concatenated line chunks.

    • parse_chunks(Array chunks, ... options)

      Parses concatenated string or nested-array chunks.

COPYRIGHT AND LICENCE

rdf/parser/turtle 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.