activerdf_net7 1.6.16 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +63 -0
- data/activerdf-jena/lib/activerdf_jena/jena.rb +4 -4
- data/activerdf-jena/lib/activerdf_jena/jena_adapter.rb +55 -55
- data/activerdf-jena/lib/activerdf_jena/lucene.rb +1 -1
- data/activerdf-jena/lib/activerdf_jena/ng4j.rb +7 -7
- data/activerdf-jena/lib/activerdf_jena/ng4j_adapter.rb +47 -47
- data/activerdf-jena/lib/activerdf_jena/pellet.rb +1 -1
- data/activerdf-jena/test/test_jena_adapter.rb +121 -120
- data/activerdf-jena/test/test_ng4j_adapter.rb +111 -110
- data/activerdf-rdflite/lib/activerdf_rdflite/fetching.rb +23 -19
- data/activerdf-rdflite/lib/activerdf_rdflite/rdflite.rb +153 -277
- data/activerdf-rdflite/lib/activerdf_rdflite/suggesting.rb +2 -2
- data/activerdf-rdflite/test/test_fetching.rb +7 -22
- data/activerdf-rdflite/test/test_rdflite.rb +44 -257
- data/activerdf-redland/lib/activerdf_redland/redland.rb +246 -282
- data/activerdf-redland/test/test_redland_adapter.rb +62 -224
- data/activerdf-sesame/ext/wrapper-sesame2.jar +0 -0
- data/activerdf-sesame/java/build.number +2 -2
- data/activerdf-sesame/java/build.xml +0 -0
- data/activerdf-sesame/java/lib/junit-3.8.2.jar +0 -0
- data/activerdf-sesame/java/settings.xml +0 -0
- data/activerdf-sesame/java/src/org/activerdf/wrapper/sesame2/WrapperForSesame2.java +0 -0
- data/activerdf-sesame/java/temp/build/org/activerdf/wrapper/sesame2/WrapperForSesame2.class +0 -0
- data/activerdf-sesame/java/temp/manifest/MANIFEST.MF +2 -2
- data/activerdf-sesame/java/test-src/org/activerdf/wrapper/sesame2/TestWrapperForSesame2.java +0 -0
- data/activerdf-sesame/lib/activerdf_sesame/sesame.rb +360 -364
- data/activerdf-sesame/test/test_sesame_adapter.rb +85 -83
- data/activerdf-sparql/lib/activerdf_sparql/sparql.rb +147 -148
- data/activerdf-sparql/lib/activerdf_sparql/sparql_result_parser.rb +5 -5
- data/activerdf-sparql/test/test_sparql_adapter.rb +2 -0
- data/activerdf-yars/lib/activerdf_yars/jars2.rb +85 -83
- data/lib/active_rdf/federation/active_rdf_adapter.rb +26 -39
- data/lib/active_rdf/federation/connection_pool.rb +119 -110
- data/lib/active_rdf/federation/federation_manager.rb +51 -51
- data/lib/active_rdf/objectmanager/bnode.rb +8 -2
- data/lib/active_rdf/objectmanager/literal.rb +81 -50
- data/lib/active_rdf/objectmanager/namespace.rb +117 -84
- data/lib/active_rdf/objectmanager/object_manager.rb +101 -96
- data/lib/active_rdf/objectmanager/ordered_set.rb +1 -1
- data/lib/active_rdf/objectmanager/property.rb +345 -0
- data/lib/active_rdf/objectmanager/property_list.rb +4 -4
- data/lib/active_rdf/objectmanager/property_lookup.rb +57 -0
- data/lib/active_rdf/objectmanager/resource.rb +293 -501
- data/lib/active_rdf/objectmanager/resource_like.rb +2 -2
- data/lib/active_rdf/objectmanager/resource_query.rb +85 -0
- data/lib/active_rdf/queryengine/ntriples_parser.rb +75 -68
- data/lib/active_rdf/queryengine/query.rb +237 -183
- data/lib/active_rdf/queryengine/query2jars2.rb +17 -15
- data/lib/active_rdf/queryengine/query2sparql.rb +107 -101
- data/lib/active_rdf.rb +28 -17
- data/lib/active_rdf_helpers.rb +37 -5
- data/lib/active_rdf_log.rb +11 -11
- data/test/adapters/test_activerdf_adapter.rb +138 -0
- data/test/{test_adapters.rb → adapters/test_adapters.rb} +6 -24
- data/test/adapters/test_bnode_capable_adapter.rb +31 -0
- data/test/adapters/test_context_aware_adapter.rb +31 -0
- data/test/adapters/test_network_aware_adapter.rb +29 -0
- data/test/adapters/test_persistent_adapter.rb +21 -0
- data/test/adapters/test_read_only_adapter.rb +15 -0
- data/test/adapters/test_reasoning_adapter.rb +11 -0
- data/test/adapters/test_writable_adapter.rb +163 -0
- data/test/common.rb +78 -96
- data/test/federation/test_connection_pool.rb +25 -44
- data/test/federation/test_federation_manager.rb +45 -45
- data/test/objectmanager/test_literal.rb +47 -26
- data/test/objectmanager/test_namespace.rb +3 -1
- data/test/objectmanager/test_object_manager.rb +35 -45
- data/test/objectmanager/test_ordered_set.rb +1 -1
- data/test/objectmanager/test_property.rb +261 -0
- data/test/objectmanager/test_resource_reading.rb +196 -104
- data/test/objectmanager/test_resource_reasoning.rb +26 -0
- data/test/objectmanager/test_resource_writing.rb +34 -25
- data/test/queryengine/my_external_resource.rb +5 -1
- data/test/queryengine/test_external_resource_class.rb +1 -8
- data/test/queryengine/test_ntriples_parser.rb +5 -3
- data/test/queryengine/test_query.rb +3 -3
- data/test/queryengine/test_query2jars2.rb +2 -2
- data/test/queryengine/test_query2sparql.rb +2 -2
- data/test/queryengine/test_query_engine.rb +46 -28
- metadata +16 -8
- data/activerdf-rdflite/test/test_bnode_data.nt +0 -5
- data/activerdf-rdflite/test/test_data.nt +0 -32
- data/activerdf-rdflite/test/test_escaped_data.nt +0 -2
- data/activerdf-redland/test/test_person_data.nt +0 -42
- data/test/objectmanager/test_talia_syntax.rb +0 -68
@@ -3,240 +3,78 @@
|
|
3
3
|
# License:: LGPL
|
4
4
|
|
5
5
|
require 'test/unit'
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
require
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
8
|
+
common_test_dir = File.dirname(File.expand_path(__FILE__)) + '/../../test'
|
9
|
+
require "#{common_test_dir}/adapters/test_writable_adapter"
|
10
|
+
require "#{common_test_dir}/adapters/test_persistent_adapter"
|
11
|
+
require "#{common_test_dir}/adapters/test_network_aware_adapter"
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def teardown
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_registration
|
20
|
-
adapter = ConnectionPool.add_data_source(:type => :redland)
|
21
|
-
assert_instance_of RedlandAdapter, adapter
|
22
|
-
end
|
23
|
-
|
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
|
-
|
30
|
-
def test_redland_connections
|
31
|
-
adapter = RedlandAdapter.new({})
|
32
|
-
assert_instance_of RedlandAdapter, adapter
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_simple_query
|
36
|
-
adapter = ConnectionPool.add_data_source(:type => :redland)
|
37
|
-
|
38
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
39
|
-
age = RDFS::Resource.new 'foaf:age'
|
40
|
-
test = RDFS::Resource.new 'test'
|
41
|
-
|
42
|
-
adapter.add(eyal, age, test)
|
43
|
-
result = Query.new.distinct(:s).where(:s, :p, :o).execute(:flatten)
|
44
|
-
|
45
|
-
assert_instance_of RDFS::Resource, result
|
46
|
-
assert_equal 'eyaloren.org', result.uri
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_federated_query
|
50
|
-
adapter1 = ConnectionPool.add_data_source(:type => :redland)
|
51
|
-
adapter2 = ConnectionPool.add_data_source(:type => :redland, :fake_symbol_to_get_unique_adapter => true)
|
52
|
-
|
53
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
54
|
-
age = RDFS::Resource.new 'foaf:age'
|
55
|
-
test = RDFS::Resource.new 'test'
|
56
|
-
test2 = RDFS::Resource.new 'test2'
|
57
|
-
|
58
|
-
adapter1.add(eyal, age, test)
|
59
|
-
adapter2.add(eyal, age, test2)
|
60
|
-
|
61
|
-
# assert only one distinct subject is found (same one in both adapters)
|
62
|
-
assert_equal 1, Query.new.distinct(:s).where(:s, :p, :o).execute.size
|
63
|
-
|
64
|
-
# assert two distinct objects are found
|
65
|
-
results = Query.new.distinct(:o).where(:s, :p, :o).execute
|
66
|
-
assert_equal 2, results.size
|
67
|
-
|
68
|
-
results.all? {|result| assert result.instance_of?(RDFS::Resource) }
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_query_with_block
|
72
|
-
adapter = ConnectionPool.add_data_source(:type => :redland)
|
73
|
-
|
74
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
75
|
-
age = RDFS::Resource.new 'foaf:age'
|
76
|
-
test = RDFS::Resource.new 'test'
|
77
|
-
|
78
|
-
adapter.add(eyal, age, test)
|
79
|
-
Query.new.select(:s,:p).where(:s,:p,:o).execute do |s,p|
|
80
|
-
assert_equal 'eyaloren.org', s.uri
|
81
|
-
assert_equal 'foaf:age', p.uri
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_load_from_file
|
86
|
-
adapter = ConnectionPool.add_data_source :type => :redland
|
87
|
-
adapter.load("#{File.dirname(__FILE__)}/test_person_data.nt", "turtle")
|
88
|
-
assert_equal 28, adapter.size
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_remote_load
|
92
|
-
adapter = ConnectionPool.add_data_source :type => :redland
|
93
|
-
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
94
|
-
assert_equal 9, adapter.size
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_load_and_clear
|
98
|
-
adapter = ConnectionPool.add_data_source :type => :redland
|
99
|
-
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
100
|
-
assert_equal 9, adapter.size
|
101
|
-
adapter.clear
|
102
|
-
assert_equal 0, adapter.size
|
103
|
-
end
|
13
|
+
module TestRedlandAdapter
|
14
|
+
include TestWritableAdapter
|
15
|
+
include TestNetworkAwareAdapter
|
104
16
|
|
105
|
-
def
|
106
|
-
adapter
|
107
|
-
adapter.load('http://www.eyaloren.org/foaf.rdf', 'rdfxml')
|
108
|
-
assert_equal 9, adapter.size
|
109
|
-
adapter.close
|
110
|
-
assert_equal 0, ConnectionPool.adapters.size
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_person_data
|
114
|
-
ConnectionPool.add_data_source :type => :redland, :location => 'test/test-person'
|
115
|
-
Namespace.register(:test, 'http://activerdf.org/test/')
|
116
|
-
|
117
|
-
eyal = Namespace.lookup(:test, :eyal)
|
118
|
-
eye = Namespace.lookup(:test, :eye)
|
119
|
-
person = Namespace.lookup(:test, :Person)
|
120
|
-
type = Namespace.lookup(:rdf, :type)
|
121
|
-
resource = Namespace.lookup(:rdfs,:resource)
|
122
|
-
|
123
|
-
color = Query.new.select(:o).where(eyal, eye,:o).execute
|
124
|
-
assert 'blue', color
|
125
|
-
assert_instance_of String, color
|
126
|
-
|
127
|
-
ObjectManager.construct_classes
|
128
|
-
assert eyal.instance_of?(TEST::Person)
|
129
|
-
assert eyal.instance_of?(RDFS::Resource)
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_federated_query
|
133
|
-
adapter1 = ConnectionPool.add_data_source(:type => :redland)
|
134
|
-
adapter2 = ConnectionPool.add_data_source(:type => :redland, :fake_symbol_to_get_unique_adapter => true)
|
135
|
-
|
136
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
137
|
-
age = RDFS::Resource.new 'foaf:age'
|
138
|
-
test = RDFS::Resource.new 'test'
|
139
|
-
test2 = RDFS::Resource.new 'test2'
|
140
|
-
|
141
|
-
adapter1.add(eyal, age, test)
|
142
|
-
adapter2.add(eyal, age, test2)
|
143
|
-
|
144
|
-
# assert only one distinct subject is found (same one in both adapters)
|
145
|
-
assert_equal 1, Query.new.distinct(:s).where(:s, :p, :o).execute.size
|
146
|
-
|
147
|
-
# assert two distinct objects are found
|
148
|
-
results = Query.new.distinct(:o).where(:s, :p, :o).execute
|
149
|
-
assert_equal 2, results.size
|
150
|
-
|
151
|
-
results.all? {|result| assert result.instance_of?(RDFS::Resource) }
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_query_with_block
|
155
|
-
adapter = ConnectionPool.add_data_source(:type => :redland)
|
156
|
-
|
157
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
158
|
-
age = RDFS::Resource.new 'foaf:age'
|
159
|
-
test = RDFS::Resource.new 'test'
|
17
|
+
def test_sparql_query
|
18
|
+
@adapter.add(@@eyal, @@age, @@ageval)
|
160
19
|
|
161
|
-
adapter.
|
162
|
-
Query.new.select(:s,:p).where(:s,:p,:o).execute do |s,p|
|
163
|
-
assert_equal 'eyaloren.org', s.uri
|
164
|
-
assert_equal 'foaf:age', p.uri
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_person_data
|
169
|
-
adapter = ConnectionPool.add_data_source :type => :redland
|
170
|
-
adapter.load("#{File.dirname(__FILE__)}/test_person_data.nt", "turtle")
|
171
|
-
|
172
|
-
Namespace.register(:test, 'http://activerdf.org/test/')
|
173
|
-
|
174
|
-
eyal = Namespace.lookup(:test, :eyal)
|
175
|
-
eye = Namespace.lookup(:test, :eye)
|
176
|
-
person = Namespace.lookup(:test, :Person)
|
177
|
-
type = Namespace.lookup(:rdf, :type)
|
178
|
-
resource = Namespace.lookup(:rdfs,:resource)
|
20
|
+
@adapter.flush
|
179
21
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
assert eyal.instance_of?(TEST::Person)
|
184
|
-
assert eyal.instance_of?(RDFS::Resource)
|
22
|
+
query = Query.new.distinct(:s).where(:s,:p,:o)
|
23
|
+
sparql_query = @adapter.get_query_results(query)
|
24
|
+
assert sparql_query.include?(TEST::eyal.uri)
|
185
25
|
end
|
186
|
-
|
187
|
-
def test_write_to_file_and_reload
|
188
|
-
require 'tmpdir'
|
189
|
-
location = "#{Dir.tmpdir}/redland-temp"
|
190
|
-
adapter = ConnectionPool.add_data_source(:type => :redland, :location => location)
|
191
|
-
|
192
|
-
eyal = RDFS::Resource.new 'eyaloren.org'
|
193
|
-
age = RDFS::Resource.new 'foaf:age'
|
194
|
-
test = RDFS::Resource.new 'test'
|
26
|
+
end
|
195
27
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
# flush the pool and freshly load the file we just wrote into
|
200
|
-
ConnectionPool.clear
|
201
|
-
adapter2 = ConnectionPool.add_data_source(:type => :redland, :location => location)
|
28
|
+
class TestRedlandAdapterMemory < Test::Unit::TestCase
|
29
|
+
include TestRedlandAdapter
|
30
|
+
# not persistent
|
202
31
|
|
203
|
-
|
204
|
-
|
32
|
+
def setup
|
33
|
+
super(:type => :redland, :location => "memory")
|
205
34
|
end
|
35
|
+
end
|
206
36
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
37
|
+
#class TestRedlandAdapterFile < Test::Unit::TestCase
|
38
|
+
# include TestRedlandAdapter
|
39
|
+
# include TestPersistentAdapter
|
40
|
+
#
|
41
|
+
# def setup
|
42
|
+
# super(:type => :redland, :location => @location)
|
43
|
+
# @location = File.join(Dir.tmpdir,"redland-temp")
|
44
|
+
# end
|
45
|
+
# def teardown
|
46
|
+
# FileUtils.rm Dir.glob(@location + '-*')
|
47
|
+
# end
|
48
|
+
#end
|
49
|
+
|
50
|
+
class TestRedlandAdapterSqlite < Test::Unit::TestCase
|
51
|
+
include TestRedlandAdapter
|
52
|
+
# not persistent
|
217
53
|
|
218
|
-
|
219
|
-
|
220
|
-
adapter.load("#{File.dirname(__FILE__)}/test_person_data.nt", "turtle")
|
221
|
-
assert_equal 27, TEST::eyal.age.to_i
|
222
|
-
TEST::eyal.age = 30
|
223
|
-
assert_equal 30, TEST::eyal.age.to_i
|
54
|
+
def setup
|
55
|
+
super(:type => :redland, :location => 'sqlite')
|
224
56
|
end
|
57
|
+
end
|
225
58
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
59
|
+
#class TestRedlandAdapterMySQL < Test::Unit::TestCase
|
60
|
+
# include TestRedlandAdapter
|
61
|
+
# include TestPersistentAdapter
|
62
|
+
#
|
63
|
+
# def setup
|
64
|
+
# super(:type => :redland, :name => 'db1', :location => 'mysql',
|
65
|
+
# :host => 'localhost', :database => 'redland_test',
|
66
|
+
# :user => '', :password => '', :new => 'yes')
|
67
|
+
# end
|
68
|
+
#end
|
69
|
+
|
70
|
+
#class TestRedlandAdapterPostgres < Test::Unit::TestCase
|
71
|
+
# include TestPersistentAdapter
|
72
|
+
# include TestRedlandAdapter
|
73
|
+
#
|
74
|
+
# def setup
|
75
|
+
# super(:type => :redland, :name => 'db1', :location => 'postgresql',
|
76
|
+
# :host => 'localhost', :database => 'redland_test',
|
77
|
+
# :user => '', :password => '', :new => 'yes')
|
78
|
+
# end
|
79
|
+
#end
|
237
80
|
|
238
|
-
# TODO: test if results are correct; but we do this only when redland
|
239
|
-
# supports this method in release
|
240
|
-
assert results.include?('eyaloren.org')
|
241
|
-
end
|
242
|
-
end
|
Binary file
|
@@ -1,3 +1,3 @@
|
|
1
1
|
#Build Number for ANT. Do not edit!
|
2
|
-
#
|
3
|
-
build.number=
|
2
|
+
#Thu Feb 11 14:15:40 CET 2010
|
3
|
+
build.number=138
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
data/activerdf-sesame/java/test-src/org/activerdf/wrapper/sesame2/TestWrapperForSesame2.java
CHANGED
File without changes
|