rdf_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
.
- read_ntriple(+Stream, -Triple) is det
- Read the next triple from Stream as Triple. Stream must have UTF-8 encoding.
- read_nquad(+Stream, -Quad) is det
- Read the next quad from Stream as Quad. Stream must have UTF-8 encoding.
- 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)
.
- rdf_read_ntriples(+Input, -Triples, +Options) is det
- 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 asnode(Id)
. - base_uri(+Atom)
- Defines the default anon_prefix as _:<baseuri>_
- on_error(Action)
- One of
warning
(default) orerror
- error_count(-Count)
- If
on_error
iswarning
, 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.
- 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)
. - rdf_db:rdf_load_stream(+Format, +Stream, :Options) is semidet[multifile]
- Plugin rule that supports loading the
ntriples
andnquads
formats. - rdf_db:rdf_file_type(+Extension, -Format)[multifile]
- Bind the ntriples reader to files with the extensions
nt
,ntriples
andnquads
.
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
- rdf_read_ntriples(+Input, -Triples, +Options) is det
- 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 asnode(Id)
. - base_uri(+Atom)
- Defines the default anon_prefix as _:<baseuri>_
- on_error(Action)
- One of
warning
(default) orerror
- error_count(-Count)
- If
on_error
iswarning
, 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.