Redland::HashStore

Store the triples in a hash. Can use memory or bdb

Attributes

hash_type[RW]

Public Class Methods

new(hash_type='memory',name='',dir='.', want_new=true,write=true,contexts=true) click to toggle source

hash_type either memory or bdb. If it's bdb, you must specify a name

# File rdf/redland/store.rb, line 56
def initialize(hash_type='memory',name='',dir='.', want_new=true,write=true,contexts=true)
  @hash_type = hash_type
  @dir = dir
  unless ( (hash_type == 'memory') || (hash_type == 'bdb'))
    raise RedlandError.new('Hash must be memory or bdb')
  end

  if hash_type=='bdb' then
    unless (name != '')
      raise RedlandError.new('bdb must have a filename')
    end
  end
  if (( want_new == true)|| (want_new == 'yes') || (want_new == 'Yes'))
    want_new = 'yes'
  elsif
    ( (want_new == false) || (want_new == 'no') || (want_new == 'No'))
    want_new = 'no'
  end
  if ((write == true) || (write == 'yes') || (write == 'Yes'))
    write = 'yes'
  elsif
    ( (write == false) || (write == 'no') || (write == 'No'))
    write = 'no'
  end
  if ((contexts == true) || (contexts == 'yes') || (contexts == 'Yes'))
    contexts = 'yes'
  elsif ((contexts == false) || (contexts == 'no') || (contexts == 'No'))
    contexts = 'no'
  end
  
  options = "hash-type='#{hash_type}',new='#{want_new}', dir='#{dir}', write='#{write}',contexts='#{contexts}'"
  super('hashes',name,options)
end
read_store(name,dir='.',write=true) click to toggle source
# File rdf/redland/store.rb, line 90
def HashStore.read_store(name,dir='.',write=true)
  return HashStore.new('bdb',name,dir,false,write)
end

Go to Redland Home - Language Bindings Home - Ruby API Home

(C) Copyright 2004-2013 Dave Beckett, (C) Copyright 2004-2005 University of Bristol