Store 'hashes'

This module is always present (cannot be removed) and provides indexed storage using Redland Triple stores(3) to store various combinations of subject, predicate and object for faster access. Context nodes are also stored in a hash when used. The hashes may be in-memory (always available) or persistent via Sleepycat/Berkeley DB (BDB) versions 2-4. It is the most mature and primary persistent store and suitable for large models, tested in the 2-3 million range..

The main option requiring setting is the hash-type which must be one of the supported Redland hashes. Hash type memory is always available and if BDB has been compiled in, bdb is also available. Option dir can be used to set the destination directory for the BDB files when used. Boolean option new can be set to force creation or truncation of a persistent hashed store. The storage name must be given for hash type bdb since it is used for a filename.

The module provides optional contexts support enabled when boolean storage option contexts is set. This can be used with any hash type.

Examples:

  /* A new BDB hashed persistent store in the current directory */
  storage=librdf_new_storage(world, "hashes", "db1",
                             "new='yes',hash-type='bdb',dir='.'");

  /* Hashed in-memory store */
  storage=librdf_new_storage(world, "hashes", NULL,
                             "hash-type='memory'");

  /* An existing BDB hashed persistent store in dir /somewhere */
  storage=librdf_new_storage(world, "hashes", "dv2", 
                             "hash-type='bdb',dir='/somewhere'");

  /* An existing BDB hashed store with contexts */
  storage=librdf_new_storage(world, "hashes", "db3", 
                             "hash-type='bdb',contexts='yes'");

In Python:

  from RDF import *
  ...
  # Create a new BDB store
  storage = HashStorage("db4", options="new='yes',hash-type='bdb'")

In Perl:

  use RDF::Redland;
  ...
  # Open an existing BDB store
  $storage=new RDF::Redland::Storage("hashes", "db5", 
                                     "hash-type='bdb',dir='.'");

Summary:

  • Persistent or in-memory

  • Suitable for larger models

  • Indexed

  • Large disk usage with BDB

  • Optional contexts (with option contexts set)



Navigation: Redland Home Page

Copyright 2000-2023 Dave Beckett