| 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 library(semweb/turtle) uses 
this plugin API to support loading Turtle files using rdf_load/2.
rdf_load(FileOrList, []). See rdf_load/2.if(changed)=.
Options provides additional processing options. Defined options are:
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.true, changed 
(default) or
not_loaded.not_modified, cached(File),
last_modified(Stamp) or unknown.false, do not use or create a cache file.true (default false), register xmlns 
namespace declarations or Turtle @prefix prefixes 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.Boolean+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)).
library(semweb/rdf_persistency) 
and
library(semweb/rdf_cache)rdf_save(Out, []). See rdf_save/2 
for details.false (default true) do not save blank 
nodes that do not appear (indirectly) as object of a named resource.write_xml_base 
option.xml:lang saved with rdf:RDF element.true (default false), inline resources when 
encountered for the first time. Normally, only bnodes are handled this 
way.true (default false), emit subjects sorted 
on the full URI. Useful to make file comparison easier.false, do not include the xml:base 
declaration that is written normally when using the
base_uri option.false (default true), never use xml 
attributes to save plain literal attributes, i.e., always used an XML 
element as in <name>Joe</name>.| Out | Location to save the data. This can also 
be a file-url (file://path) or a stream wrapped in a term stream(Out).  | 
Partial save
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
utf8, iso_latin_1 and ascii.
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:
rdf and rdfs 
are added to the provided List. If a namespace is not 
declared, the resource is emitted in non-abbreviated 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 
database using
library(semweb/rdf_persistency).