|Did you know ...||Search Documentation:|
|Loading and saving to file|
The RDF library can read and write triples in RDF/XML and a
proprietary binary format. There is a plugin interface defined to
support additional formats. The
this plugin API to support loading Turtle files using rdf_load/2.
rdf_load(FileOrList, ). See rdf_load/2.
share(default), equivalent blank nodes are shared in the same resource.
library(semweb/turtle)extend the set of recognised extensions.
file://URL when loading a file or, if the specification is a URL, its normalized version without the optional #fragment.
false, do not use or create a cache file.
xmlnsnamespace declarations or Turtle
@prefixprefixes using rdf_register_prefix/3 if there is no conflict.
true, the message reporting completion is printed using level
silent. Otherwise the level is
informational. See also print_message/2.
Other options are forwarded to process_rdf/3. By default, rdf_load/2 only loads RDF/XML from files. It can be extended to load data from other formats and locations using plugins. The full set of plugins relevant to support different formats and locations is below:
:- use_module(library(semweb/turtle)). % Turtle and TriG :- use_module(library(semweb/rdf_ntriples)). :- use_module(library(semweb/rdf_zlib_plugin)). :- use_module(library(semweb/rdf_http_plugin)). :- use_module(library(http/http_ssl_plugin)).
rdf_save(Out, ). See rdf_save/2 for details.
true) do not save blank nodes that do not appear (indirectly) as object of a named resource.
xml:langsaved with rdf:RDF element.
false), inline resources when encountered for the first time. Normally, only bnodes are handled this way.
false), emit subjects sorted on the full URI. Useful to make file comparison easier.
false, do not include the
xml:basedeclaration that is written normally when using the
true), never use xml attributes to save plain literal attributes, i.e., always used an XML element as in
|Out||Location to save the data. This can also
be a file-url (|
Sometimes it is necessary to make more arbitrary selections of
material to be saved or exchange RDF descriptions over an open network
link. The predicates in this section provide for this. Character
encoding issues are derived from the encoding of the Stream,
providing support for
Save an RDF header, with the XML header, DOCTYPE, ENTITY and opening the rdf:RDF element with appropriate namespace declarations. It uses the primitives from section 3.5 to generate the required namespaces and desired short-name. Options is one of:
rdfsare added to the provided List. If a namespace is not declared, the resource is emitted in non-abreviated form.
Fast loading and saving
Loading and saving RDF format is relatively slow. For this reason we
designed a binary format that is more compact, avoids the complications
of the RDF parser and avoids repetitive lookup of (URL) identifiers.
Especially the speed improvement of about 25 times is worth-while when
loading large databases. These predicates are used for caching by
rdf_load/2 under certain
conditions as well as for maintaining persistent snapshots of the