modules/rdf/parser/trig.zzm

rdf-0.0.3 documentation

NAME

rdf/parser/trig - TriG parser.

SYNOPSIS

  from rdf/parser/trig import TriGParser;

  let quads := (new TriGParser()).parse_string("""
  @prefix ex: <http://example.com/> .
  ex:s ex:p "default graph" .
  GRAPH ex:g { ex:s ex:p "named graph" . }
  """);

DESCRIPTION

TriGParser parses RDF 1.1 TriG into RDF quads. It accepts default graph triples outside braces, wrapped default graph blocks, named graph blocks with or without the GRAPH keyword, and graph labels written as IRIs, prefixed names, or blank node labels.

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

EXPORTS

Classes

  • TriGParser
    • 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/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.