rdf_attach_db(+Directory,
+Options)Attach Directory as the persistent database. If Directory
does not exist it is created. Otherwise all sources defined in the
directory are loaded into the RDF database. Loading a source means
loading the base state (if any) and replaying the journal (if any). The
current implementation does not synchronise triples that are in the
store before attaching a database. They are not removed from the
database, nor added to the presistent store. Different merging options
may be supported through the Options argument later.
Currently defined options are:
- concurrency(+PosInt)
- Number of threads used to reload databased and journals from the files
in Directory. Default is the number of physical CPUs
determined by the Prolog flag
cpu_count
or 1 (one) on
systems where this number is unknown. See also concurrent/3.
- max_open_journals(+PosInt)
- The library maintains a pool of open journal files. This option
specifies the size of this pool. The default is 10. Raising the option
can make sense if many writes occur on many different named graphs. The
value can be lowered for scenarios where write operations are very
infrequent.
- silent(Boolean)
- If
true
, supress loading messages from rdf_attach_db/2.
- log_nested_transactions(Boolean)
- If
true
, nested log transactions are added to the
journal information. By default (false
), no log-term is
added for nested transactions.
The database is locked against concurrent access using a file
lock
in Directory. An attempt to attach to a
locked database raises a permission_error
exception. The
error context contains a term rdf_locked(Args)
, where args
is a list containing time(Stamp)
and pid(PID)
.
The error can be caught by the application. Otherwise it prints:
ERROR: No permission to lock rdf_db `/home/jan/src/pl/packages/semweb/DB'
ERROR: locked at Wed Jun 27 15:37:35 2007 by process id 1748