activerdf_redland 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/lib/activerdf_redland/redland.rb +30 -4
- data/test/test_redland_adapter.rb +22 -6
- metadata +77 -70
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== activerdf_redland (1.2.2) Tue, 16 Sep 2008 12:44:39 +0200
|
2
|
+
* added close and clear method
|
3
|
+
* added support for full Redland options (Benno Blumenthal)
|
4
|
+
|
1
5
|
== activerdf_redland (1.2.1) Sat Jun 23 09:03:43 UTC 2007
|
2
6
|
* added support for Redland on PostgreSQL (Richard Dale)
|
3
7
|
|
@@ -14,14 +14,30 @@ class RedlandAdapter < ActiveRdfAdapter
|
|
14
14
|
|
15
15
|
# instantiate connection to Redland database
|
16
16
|
def initialize(params = {})
|
17
|
+
super()
|
18
|
+
|
17
19
|
if params[:location] and params[:location] == :postgresql
|
18
20
|
initialize_postgresql(params)
|
19
21
|
return
|
20
22
|
end
|
21
23
|
|
22
24
|
if params[:location] and params[:location] != :memory
|
23
|
-
# setup file
|
25
|
+
# setup file defaults for redland database
|
24
26
|
type = 'bdb'
|
27
|
+
want_new = false # create new or use existing store
|
28
|
+
write = true
|
29
|
+
contexts = true
|
30
|
+
|
31
|
+
if params[:want_new] == true
|
32
|
+
want_new = true
|
33
|
+
end
|
34
|
+
if params[:write] == false
|
35
|
+
write = false
|
36
|
+
end
|
37
|
+
if params[:contexts] == false
|
38
|
+
contexts = false
|
39
|
+
end
|
40
|
+
|
25
41
|
if params[:location].include?('/')
|
26
42
|
path, file = File.split(params[:location])
|
27
43
|
else
|
@@ -30,12 +46,12 @@ class RedlandAdapter < ActiveRdfAdapter
|
|
30
46
|
end
|
31
47
|
else
|
32
48
|
# fall back to in-memory redland
|
33
|
-
type = 'memory'; path = ''; file = '.'
|
49
|
+
type = 'memory'; path = ''; file = '.'; want_new = false; write = true; contexts = true
|
34
50
|
end
|
35
51
|
|
36
52
|
|
37
53
|
begin
|
38
|
-
@store = Redland::HashStore.new(type, file, path,
|
54
|
+
@store = Redland::HashStore.new(type, file, path, want_new, write, contexts)
|
39
55
|
@model = Redland::Model.new @store
|
40
56
|
@reads = true
|
41
57
|
@writes = true
|
@@ -207,6 +223,16 @@ class RedlandAdapter < ActiveRdfAdapter
|
|
207
223
|
# instead, we just dump all triples, and count them
|
208
224
|
@model.triples.size
|
209
225
|
end
|
226
|
+
|
227
|
+
# clear all real triples of adapter
|
228
|
+
def clear
|
229
|
+
@model.find(nil, nil, nil) {|s,p,o| @model.delete(s,p,o)}
|
230
|
+
end
|
231
|
+
|
232
|
+
# close adapter and remove it from the ConnectionPool
|
233
|
+
def close
|
234
|
+
ConnectionPool.remove_data_source(self)
|
235
|
+
end
|
210
236
|
|
211
237
|
private
|
212
238
|
################ helper methods ####################
|
@@ -229,7 +255,7 @@ class RedlandAdapter < ActiveRdfAdapter
|
|
229
255
|
# we determine the node type
|
230
256
|
if node.literal?
|
231
257
|
# for literal nodes we just return the value
|
232
|
-
node.
|
258
|
+
Redland.librdf_node_get_literal_value(node.node)
|
233
259
|
elsif node.blank?
|
234
260
|
# blank nodes we ignore
|
235
261
|
nil
|
@@ -21,11 +21,11 @@ class TestRedlandAdapter < Test::Unit::TestCase
|
|
21
21
|
assert_instance_of RedlandAdapter, adapter
|
22
22
|
end
|
23
23
|
|
24
|
-
def test_redland_postgres
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
24
|
+
#def test_redland_postgres
|
25
|
+
# adapter = ConnectionPool.add(:type => :redland, :name => 'db1', :location => :postgresql,
|
26
|
+
# :host => 'localhost', :database => 'redland_test',
|
27
|
+
# :user => 'eyal', :password => 'lief1234')
|
28
|
+
#end
|
29
29
|
|
30
30
|
def test_redland_connections
|
31
31
|
adapter = RedlandAdapter.new({})
|
@@ -93,7 +93,23 @@ class TestRedlandAdapter < Test::Unit::TestCase
|
|
93
93
|
def test_remote_load
|
94
94
|
adapter = ConnectionPool.add_data_source :type => :redland
|
95
95
|
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
96
|
-
assert_equal
|
96
|
+
assert_equal 9, adapter.size
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_load_and_clear
|
100
|
+
adapter = ConnectionPool.add_data_source :type => :redland
|
101
|
+
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
102
|
+
assert_equal 9, adapter.size
|
103
|
+
adapter.clear
|
104
|
+
assert_equal 0, adapter.size
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_close
|
108
|
+
adapter = ConnectionPool.add_data_source :type => :redland, :location => '/tmp/test.db'
|
109
|
+
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
110
|
+
assert_equal 9, adapter.size
|
111
|
+
adapter.close
|
112
|
+
assert_equal 0, ConnectionPool.adapters.size
|
97
113
|
end
|
98
114
|
|
99
115
|
def test_person_data
|
metadata
CHANGED
@@ -1,98 +1,105 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: activerdf_redland
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date: 2007-08-03 00:00:00 +01:00
|
8
|
-
summary: ActiveRDF adapter to Redland RDF store
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email:
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
14
|
-
description: ActiveRDF adapter to Redland RDF store
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.2.2
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Eyal Oren <eyal.oren@deri.org
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-09-16 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: gem_plugin
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.2.1
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: activerdf
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.6.4
|
32
|
+
version:
|
33
|
+
description: ActiveRDF adapter to Redland RDF store
|
34
|
+
email:
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README
|
31
41
|
files:
|
32
42
|
- LICENSE
|
33
43
|
- README
|
34
44
|
- CHANGELOG
|
45
|
+
- doc/rdoc/fr_file_index.html
|
46
|
+
- doc/rdoc/index.html
|
35
47
|
- doc/rdoc/rdoc-style.css
|
36
|
-
- doc/rdoc/
|
37
|
-
- doc/rdoc/
|
38
|
-
- doc/rdoc/files/LICENSE.html
|
39
|
-
- doc/rdoc/files/lib
|
40
|
-
- doc/rdoc/files/lib/activerdf_redland
|
41
|
-
- doc/rdoc/files/lib/activerdf_redland/redland_rb.html
|
42
|
-
- doc/rdoc/files/lib/activerdf_redland/init_rb.html
|
48
|
+
- doc/rdoc/fr_class_index.html
|
49
|
+
- doc/rdoc/fr_method_index.html
|
43
50
|
- doc/rdoc/classes
|
44
51
|
- doc/rdoc/classes/RedlandAdapter.src
|
45
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000001.html
|
46
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000002.html
|
47
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000003.html
|
48
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000004.html
|
49
52
|
- doc/rdoc/classes/RedlandAdapter.src/M000005.html
|
50
|
-
- doc/rdoc/classes/RedlandAdapter.src/
|
51
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000007.html
|
52
|
-
- doc/rdoc/classes/RedlandAdapter.src/M000008.html
|
53
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000001.html
|
53
54
|
- doc/rdoc/classes/RedlandAdapter.src/M000009.html
|
54
55
|
- doc/rdoc/classes/RedlandAdapter.src/M000011.html
|
55
56
|
- doc/rdoc/classes/RedlandAdapter.src/M000012.html
|
57
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000006.html
|
58
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000003.html
|
59
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000008.html
|
60
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000002.html
|
61
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000004.html
|
62
|
+
- doc/rdoc/classes/RedlandAdapter.src/M000007.html
|
56
63
|
- doc/rdoc/classes/RedlandAdapter.html
|
57
|
-
- doc/rdoc/fr_file_index.html
|
58
|
-
- doc/rdoc/fr_class_index.html
|
59
|
-
- doc/rdoc/fr_method_index.html
|
60
|
-
- doc/rdoc/index.html
|
61
64
|
- doc/rdoc/created.rid
|
62
|
-
-
|
65
|
+
- doc/rdoc/files
|
66
|
+
- doc/rdoc/files/lib
|
67
|
+
- doc/rdoc/files/lib/activerdf_redland
|
68
|
+
- doc/rdoc/files/lib/activerdf_redland/init_rb.html
|
69
|
+
- doc/rdoc/files/lib/activerdf_redland/redland_rb.html
|
70
|
+
- doc/rdoc/files/README.html
|
71
|
+
- doc/rdoc/files/LICENSE.html
|
63
72
|
- test/test_person_data.nt
|
73
|
+
- test/test_redland_adapter.rb
|
64
74
|
- lib/activerdf_redland
|
65
75
|
- lib/activerdf_redland/redland.rb
|
66
76
|
- lib/activerdf_redland/init.rb
|
67
|
-
|
68
|
-
|
77
|
+
has_rdoc: true
|
78
|
+
homepage:
|
79
|
+
post_install_message:
|
69
80
|
rdoc_options: []
|
70
81
|
|
71
|
-
|
72
|
-
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
77
96
|
requirements:
|
78
97
|
- librdf0 (Redland)
|
79
98
|
- librdf-ruby (Redland Ruby bindings)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 0.2.1
|
89
|
-
version:
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: activerdf
|
92
|
-
version_requirement:
|
93
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: "1.3"
|
98
|
-
version:
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.1.1
|
101
|
+
signing_key:
|
102
|
+
specification_version: 2
|
103
|
+
summary: ActiveRDF adapter to Redland RDF store
|
104
|
+
test_files: []
|
105
|
+
|