PublicShow sourcerdf_ntriples.pl -- Process files in the RDF N-Triples format

The library(semweb/rdf_ntriples) provides a fast reader for the RDF N-Triples and N-Quads format. N-Triples is a simple format, originally used to support the W3C RDF test suites. The current format has been extended and is a subset of the Turtle format (see library(semweb/turtle)).

The API of this library is almost identical to library(semweb/turtle). This module provides a plugin into rdf_load/2, making this predicate support the format ntriples and nquads.

See also
- http://www.w3.org/TR/n-triples/
To be done
- Sync with RDF 1.1. specification.
Source read_ntriple(+Stream, -Triple) is det
Read the next triple from Stream as Triple. Stream must have UTF-8 encoding.
Arguments:
Triple- is a term triple(Subject,Predicate,Object). Arguments follow the normal conventions of the RDF libraries. NodeID elements are mapped to node(Id). If end-of-file is reached, Triple is unified with end_of_file.
Errors
- syntax_error(Message) on syntax errors
Source read_nquad(+Stream, -Quad) is det
Read the next quad from Stream as Quad. Stream must have UTF-8 encoding.
Arguments:
Quad- is a term quad(Subject,Predicate,Object,Graph). Arguments follow the normal conventions of the RDF libraries. NodeID elements are mapped to node(Id). If end-of-file is reached, Quad is unified with end_of_file.
Errors
- syntax_error(Message) on syntax errors
Source read_ntuple(+Stream, -Tuple) is det
Read the next triple or quad from Stream as Tuple. Tuple is one of the terms below. See read_ntriple/2 and read_nquad/2 for details.
  • triple(Subject,Predicate,Object)
  • quad(Subject,Predicate,Object,Graph).
Source rdf_read_ntriples(+Input, -Triples, +Options) is det
Source rdf_read_nquads(+Input, -Quads, +Options) is det
True when Triples/Quads is a list of triples/quads from Input. Options:
anon_prefix(+AtomOrNode)
Prefix nodeIDs with this atom. If AtomOrNode is the term node(_), bnodes are returned as node(Id).
base_uri(+Atom)
Defines the default anon_prefix as _:<baseuri>_
on_error(Action)
One of warning (default) or error
error_count(-Count)
If on_error is warning, unify Count with th number of errors.
graph(+Graph)
For rdf_read_nquads/3, this defines the graph associated to triples loaded from the input. For rdf_read_ntriples/3 this opion is ignored.
Arguments:
Triples- is a list of rdf(Subject, Predicate, Object)
Quads- is a list of rdf(Subject, Predicate, Object, Graph)
Source rdf_process_ntriples(+Input, :CallBack, +Options)
Call-back interface, compatible with the other triple readers. In addition to the options from rdf_read_ntriples/3, this processes the option graph(Graph).
Arguments:
CallBack- is called as call(CallBack, Triples, Graph), where Triples is a list holding a single rdf(S,P,O) triple. Graph is passed from the graph option and unbound if this option is omitted.
Source rdf_db:rdf_load_stream(+Format, +Stream, :Options) is semidet[multifile]
Plugin rule that supports loading the ntriples and nquads formats.
Source rdf_db:rdf_file_type(+Extension, -Format)[multifile]
Bind the ntriples reader to files with the extensions nt, ntriples and nquads.