- Documentation
- Reference manual
- Packages
- SWI-Prolog Semantic Web Library 3.0
- Introduction
- Scalability
- Two RDF APIs
- Plugin modules for rdf_db
- library(semweb/turtle): Turtle: Terse RDF Triple Language
- library(semweb/rdf_ntriples): Process files in the RDF N-Triples format
- library(semweb/rdfa): Extract RDF from an HTML or XML DOM
- library(semweb/rdfs): RDFS related queries
- Managing RDF input files
- library(semweb/sparql_client): SPARQL client library
- library(semweb/rdf_compare): Compare RDF graphs
- library(semweb/rdf_portray): Portray RDF resources
- Related packages
- Version 3 release notes
- SWI-Prolog Semantic Web Library 3.0
6 library(semweb/rdf_ntriples): Process files in the RDF N-Triples format
- See also
- http://www.w3.org/TR/n-triples/
- To be done
- Sync with RDF 1.1. specification.
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
.
- [det]read_ntriple(+Stream, -Triple)
- Read the next triple from Stream as Triple. Stream
must have UTF-8 encoding.
Triple is a term triple(Subject,Predicate,Object)
. Arguments follow the normal conventions of the RDF libraries. NodeID elements are mapped tonode(Id)
. If end-of-file is reached, Triple is unified withend_of_file
.- Errors
syntax_error(Message)
on syntax errors
- [det]read_nquad(+Stream, -Quad)
- Read the next quad from Stream as Quad. Stream
must have UTF-8 encoding.
Quad is a term quad(Subject,Predicate,Object,Graph)
. Arguments follow the normal conventions of the RDF libraries. NodeID elements are mapped tonode(Id)
. If end-of-file is reached, Quad is unified withend_of_file
.- Errors
syntax_error(Message)
on syntax errors
- [det]read_ntuple(+Stream, -Tuple)
- 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)
.
- [det]rdf_read_ntriples(+Input, -Triples, +Options)
- [det]rdf_read_nquads(+Input, -Quads, +Options)
- 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.
Triples is a list of rdf(Subject, Predicate, Object)
Quads is a list of rdf(Subject, Predicate, Object, Graph)
- 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)
.CallBack is called as call(CallBack, Triples, Graph)
, where Triples is a list holding a singlerdf(S,P,O)
triple. Graph is passed from thegraph
option and unbound if this option is omitted. - [semidet,multifile]rdf_db:rdf_load_stream(+Format, +Stream, :Options)
- Plugin rule that supports loading the
ntriples
andnquads
formats. - [multifile]rdf_db:rdf_file_type(+Extension, -Format)
- Bind the ntriples reader to files with the extensions
nt
,ntriples
andnquads
.