Debian Codegraph @

ruby/test/test_store.rb

raw symbols SCIP
1 require 'rdf/redland'
2 require 'test/unit'
3
4 class TestStore < Test::Unit::TestCase
5 include Redland
6
7 def test_hash_store()
8 store = HashStore.new()
9 assert_equal('memory',store.hash_type)
10 model = Model.new(store)
11 model = nil
12 store = nil
13 end
14
15 def test_hash_bdb()
16 store = HashStore.new('bdb','mystore')
17 assert_equal('bdb',store.hash_type)
18 model = Model.new(store)
19 model.add(
20 Uri.new("http://xmlns.com"),
21 Uri.new("http://predicate"),
22 "baz"
23 )
24 st = Statement.new(
25 Uri.new("http://xmlns.com"),
26 Uri.new("http://predicate"),
27 "baz"
28 )
29 assert(model.include_statement?(st))
30 end
31
32 def test_hash_raises()
33 assert_raises(RedlandError){
34 store = HashStore.new('bdb')
35 } # bdb needs a name
36 end
37
38 def test_read_store()
39 store = HashStore.new('bdb','thestore')
40 model = Model.new(store)
41 parser = Parser.new(name="ntriples",mime_type=nil)
42 parser.parse_into_model(model,"file:./one.nt")
43 st = Statement.new(
44 Uri.new("http://example.org/dom"),
45 Uri.new("http://example.org/project"),
46 "2334"
47 )
48 assert(model.include_statement?(st))
49 #model.triples(){|s,p,o| puts "#{s}:#{p}:#{o}"}
50 end
51 end