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.
Files changed (85) hide show
  1. data/CHANGELOG +63 -0
  2. data/activerdf-jena/lib/activerdf_jena/jena.rb +4 -4
  3. data/activerdf-jena/lib/activerdf_jena/jena_adapter.rb +55 -55
  4. data/activerdf-jena/lib/activerdf_jena/lucene.rb +1 -1
  5. data/activerdf-jena/lib/activerdf_jena/ng4j.rb +7 -7
  6. data/activerdf-jena/lib/activerdf_jena/ng4j_adapter.rb +47 -47
  7. data/activerdf-jena/lib/activerdf_jena/pellet.rb +1 -1
  8. data/activerdf-jena/test/test_jena_adapter.rb +121 -120
  9. data/activerdf-jena/test/test_ng4j_adapter.rb +111 -110
  10. data/activerdf-rdflite/lib/activerdf_rdflite/fetching.rb +23 -19
  11. data/activerdf-rdflite/lib/activerdf_rdflite/rdflite.rb +153 -277
  12. data/activerdf-rdflite/lib/activerdf_rdflite/suggesting.rb +2 -2
  13. data/activerdf-rdflite/test/test_fetching.rb +7 -22
  14. data/activerdf-rdflite/test/test_rdflite.rb +44 -257
  15. data/activerdf-redland/lib/activerdf_redland/redland.rb +246 -282
  16. data/activerdf-redland/test/test_redland_adapter.rb +62 -224
  17. data/activerdf-sesame/ext/wrapper-sesame2.jar +0 -0
  18. data/activerdf-sesame/java/build.number +2 -2
  19. data/activerdf-sesame/java/build.xml +0 -0
  20. data/activerdf-sesame/java/lib/junit-3.8.2.jar +0 -0
  21. data/activerdf-sesame/java/settings.xml +0 -0
  22. data/activerdf-sesame/java/src/org/activerdf/wrapper/sesame2/WrapperForSesame2.java +0 -0
  23. data/activerdf-sesame/java/temp/build/org/activerdf/wrapper/sesame2/WrapperForSesame2.class +0 -0
  24. data/activerdf-sesame/java/temp/manifest/MANIFEST.MF +2 -2
  25. data/activerdf-sesame/java/test-src/org/activerdf/wrapper/sesame2/TestWrapperForSesame2.java +0 -0
  26. data/activerdf-sesame/lib/activerdf_sesame/sesame.rb +360 -364
  27. data/activerdf-sesame/test/test_sesame_adapter.rb +85 -83
  28. data/activerdf-sparql/lib/activerdf_sparql/sparql.rb +147 -148
  29. data/activerdf-sparql/lib/activerdf_sparql/sparql_result_parser.rb +5 -5
  30. data/activerdf-sparql/test/test_sparql_adapter.rb +2 -0
  31. data/activerdf-yars/lib/activerdf_yars/jars2.rb +85 -83
  32. data/lib/active_rdf/federation/active_rdf_adapter.rb +26 -39
  33. data/lib/active_rdf/federation/connection_pool.rb +119 -110
  34. data/lib/active_rdf/federation/federation_manager.rb +51 -51
  35. data/lib/active_rdf/objectmanager/bnode.rb +8 -2
  36. data/lib/active_rdf/objectmanager/literal.rb +81 -50
  37. data/lib/active_rdf/objectmanager/namespace.rb +117 -84
  38. data/lib/active_rdf/objectmanager/object_manager.rb +101 -96
  39. data/lib/active_rdf/objectmanager/ordered_set.rb +1 -1
  40. data/lib/active_rdf/objectmanager/property.rb +345 -0
  41. data/lib/active_rdf/objectmanager/property_list.rb +4 -4
  42. data/lib/active_rdf/objectmanager/property_lookup.rb +57 -0
  43. data/lib/active_rdf/objectmanager/resource.rb +293 -501
  44. data/lib/active_rdf/objectmanager/resource_like.rb +2 -2
  45. data/lib/active_rdf/objectmanager/resource_query.rb +85 -0
  46. data/lib/active_rdf/queryengine/ntriples_parser.rb +75 -68
  47. data/lib/active_rdf/queryengine/query.rb +237 -183
  48. data/lib/active_rdf/queryengine/query2jars2.rb +17 -15
  49. data/lib/active_rdf/queryengine/query2sparql.rb +107 -101
  50. data/lib/active_rdf.rb +28 -17
  51. data/lib/active_rdf_helpers.rb +37 -5
  52. data/lib/active_rdf_log.rb +11 -11
  53. data/test/adapters/test_activerdf_adapter.rb +138 -0
  54. data/test/{test_adapters.rb → adapters/test_adapters.rb} +6 -24
  55. data/test/adapters/test_bnode_capable_adapter.rb +31 -0
  56. data/test/adapters/test_context_aware_adapter.rb +31 -0
  57. data/test/adapters/test_network_aware_adapter.rb +29 -0
  58. data/test/adapters/test_persistent_adapter.rb +21 -0
  59. data/test/adapters/test_read_only_adapter.rb +15 -0
  60. data/test/adapters/test_reasoning_adapter.rb +11 -0
  61. data/test/adapters/test_writable_adapter.rb +163 -0
  62. data/test/common.rb +78 -96
  63. data/test/federation/test_connection_pool.rb +25 -44
  64. data/test/federation/test_federation_manager.rb +45 -45
  65. data/test/objectmanager/test_literal.rb +47 -26
  66. data/test/objectmanager/test_namespace.rb +3 -1
  67. data/test/objectmanager/test_object_manager.rb +35 -45
  68. data/test/objectmanager/test_ordered_set.rb +1 -1
  69. data/test/objectmanager/test_property.rb +261 -0
  70. data/test/objectmanager/test_resource_reading.rb +196 -104
  71. data/test/objectmanager/test_resource_reasoning.rb +26 -0
  72. data/test/objectmanager/test_resource_writing.rb +34 -25
  73. data/test/queryengine/my_external_resource.rb +5 -1
  74. data/test/queryengine/test_external_resource_class.rb +1 -8
  75. data/test/queryengine/test_ntriples_parser.rb +5 -3
  76. data/test/queryengine/test_query.rb +3 -3
  77. data/test/queryengine/test_query2jars2.rb +2 -2
  78. data/test/queryengine/test_query2sparql.rb +2 -2
  79. data/test/queryengine/test_query_engine.rb +46 -28
  80. metadata +16 -8
  81. data/activerdf-rdflite/test/test_bnode_data.nt +0 -5
  82. data/activerdf-rdflite/test/test_data.nt +0 -32
  83. data/activerdf-rdflite/test/test_escaped_data.nt +0 -2
  84. data/activerdf-redland/test/test_person_data.nt +0 -42
  85. data/test/objectmanager/test_talia_syntax.rb +0 -68
@@ -14,8 +14,9 @@ require "pp"
14
14
  require "fileutils"
15
15
 
16
16
  class TestJenaAdapter < Test::Unit::TestCase
17
+ include ActiveRDF
17
18
 
18
- def setup
19
+ def setup
19
20
  @adapter = ConnectionPool.add_data_source(:type => :jena, :ontology => :rdfs)
20
21
  @eyal = RDFS::Resource.new 'http://eyaloren.org'
21
22
  @age = RDFS::Resource.new 'foaf:age'
@@ -29,162 +30,162 @@ class TestJenaAdapter < Test::Unit::TestCase
29
30
  @adapter.close
30
31
  # ConnectionPool.clear
31
32
  end
32
-
33
-
34
-
33
+
34
+
35
+
35
36
  def test_load_no_args
36
37
  adapter = ConnectionPool.add_data_source(:type => :jena)
37
38
  assert_instance_of JenaAdapter, adapter
38
39
  end
39
-
40
+
40
41
  def test_with_args_no_location
41
42
  assert_instance_of JenaAdapter, @adapter
42
43
  end
43
-
44
+
44
45
  def test_retrieve_a_triple_with_only_uris
45
-
46
+
46
47
  assert_instance_of JenaAdapter, @adapter
47
-
48
+
48
49
  @adapter.add(@eyal, @age, @test)
49
50
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
50
51
  assert_equal 1, result.flatten.size
51
-
52
+
52
53
  result = Query.new.distinct(:p, :o).where(@eyal, :p, :o).execute
53
54
  assert_equal 2, result.flatten.size
54
-
55
+
55
56
  result = Query.new.distinct(:o).where(@eyal, @age, :o).execute
56
57
  assert_equal 1, result.flatten.size
57
-
58
+
58
59
  result = Query.new.distinct(:s).where(:s, @age, @test).execute
59
60
  assert_equal 1, result.flatten.size
60
-
61
+
61
62
  result = Query.new.distinct(:p).where(@eyal, :p, @test).execute
62
63
  assert_equal 1, result.flatten.size
63
-
64
+
64
65
  end
65
-
66
+
66
67
  def test_retrieve_a_triple_with_string
67
-
68
+
68
69
  assert_instance_of JenaAdapter, @adapter
69
-
70
+
70
71
  @adapter.add(@eyal, @mbox, @mboxval)
71
72
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
72
73
  assert_equal 1, result.flatten.size
73
-
74
+
74
75
  result = Query.new.distinct(:p, :o).where(@eyal, :p, :o).execute
75
76
  assert_equal 2, result.flatten.size
76
-
77
+
77
78
  result = Query.new.distinct(:o).where(@eyal, @mbox, :o).execute
78
79
  assert_equal 1, result.flatten.size
79
-
80
+
80
81
  result = Query.new.distinct(:s).where(:s, @mbox, @mboxval).execute
81
82
  assert_equal 1, result.flatten.size
82
-
83
+
83
84
  result = Query.new.distinct(:p).where(@eyal, :p, @mboxval).execute
84
85
  assert_equal 1, result.flatten.size
85
-
86
+
86
87
  end
87
-
88
+
88
89
  def test_retrieve_a_triple_with_fixnum
89
-
90
+
90
91
  assert_instance_of JenaAdapter, @adapter
91
-
92
+
92
93
  @adapter.add(@eyal, @age, @ageval)
93
94
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
94
95
  assert_equal 1, result.flatten.size
95
-
96
+
96
97
  result = Query.new.distinct(:p, :o).where(@eyal, :p, :o).execute
97
98
  assert_equal 2, result.flatten.size
98
-
99
+
99
100
  result = Query.new.distinct(:o).where(@eyal, @age, :o).execute
100
101
  assert_equal 1, result.flatten.size
101
-
102
+
102
103
  result = Query.new.distinct(:s).where(:s, @age, @ageval).execute
103
104
  assert_equal 1, result.flatten.size
104
-
105
+
105
106
  result = Query.new.distinct(:p).where(@eyal, :p, @ageval).execute
106
107
  assert_equal 1, result.flatten.size
107
-
108
+
108
109
  end
109
-
110
+
110
111
  def test_remove
111
112
  @adapter.add(@eyal, @age, @ageval)
112
113
  @adapter.add(@eyal, @mbox, @mboxval)
113
114
  @adapter.delete(@eyal, @age, @ageval)
114
115
  assert_equal 1, @adapter.size
115
-
116
+
116
117
 
117
118
  @adapter.add(@eyal, @age, @ageval)
118
119
  @adapter.add(@eyal, @mbox, @mboxval)
119
120
  @adapter.delete(:s, :p, @ageval)
120
121
  assert_equal 1, @adapter.size
121
-
122
+
122
123
  @adapter.add(@eyal, @age, @ageval)
123
124
  @adapter.add(@eyal, @mbox, @mboxval)
124
125
  @adapter.delete(:s, @age, :o)
125
126
  assert_equal 1, @adapter.size
126
-
127
+
127
128
  @adapter.add(@eyal, @age, @ageval)
128
129
  @adapter.add(@eyal, @mbox, @mboxval)
129
130
  @adapter.delete(@eyal, :p, :o)
130
131
  assert_equal 0, @adapter.size
131
132
  end
132
-
133
+
133
134
  def test_dump
134
135
  @adapter.add(@eyal, @age, @test)
135
-
136
- stringDump = @adapter.dump
137
-
136
+
137
+ stringDump = @adapter.dump
138
+
138
139
  assert_not_nil stringDump
139
140
  assert_kind_of String, stringDump
140
141
  end
141
-
142
+
142
143
  def test_size
143
144
  @adapter.add(@eyal, @age, @test)
144
-
145
- assert 0 < @adapter.size
145
+
146
+ assert 0 < @adapter.size
146
147
  end
147
-
148
+
148
149
  def test_clear
149
150
  @adapter.add(@eyal, @age, @test)
150
- assert 0 < @adapter.size
151
-
151
+ assert 0 < @adapter.size
152
+
152
153
  @adapter.clear
153
- assert_equal 0, @adapter.size
154
- end
154
+ assert_equal 0, @adapter.size
155
+ end
155
156
 
156
157
  # may seem redundant, but nonetheless this is needed
157
- def test_close
158
+ def test_close
158
159
  my_adapter = ConnectionPool.add_data_source(:type => :jena, :ontology => :rdfs)
159
160
  my_adapter.add(@eyal, @age, @test)
160
161
  results = Query.new.select(:s,:p,:o).where(:s,:p,:o).execute
161
162
  assert results.flatten.size > 0
162
-
163
+
163
164
  my_adapter.close
164
165
  assert_raises ActiveRdfError do
165
166
  results = Query.new.select(:s,:p,:o).where(:s,:p,:o).execute
166
167
  end
167
-
168
+
168
169
  my_adapter = ConnectionPool.add_data_source(:type => :jena, :ontology => :rdfs)
169
170
  my_adapter.add(@eyal, @age, @test)
170
171
  results = Query.new.select(:s,:p,:o).where(:s,:p,:o).execute
171
172
  assert results.flatten.size > 0
172
-
173
+
173
174
  my_adapter.close
174
175
  assert_raises ActiveRdfError do
175
176
  results = Query.new.select(:s,:p,:o).where(:s,:p,:o).execute
176
177
  end
177
178
  end
178
-
179
-
179
+
180
+
180
181
  def test_load_ntriples
181
182
  assert_equal 0, @adapter.size
182
-
183
+
183
184
  this_dir = File.dirname(File.expand_path(__FILE__))
184
185
  @adapter.load("file://" + this_dir + "/eyal-foaf.nt", :format => :ntriples, :into => :default_model)
185
-
186
+
186
187
  assert_not_equal 0, @adapter.size
187
-
188
+
188
189
  #check for <https://launchpad.net/products/browserdf/+rdf> <http://xmlns.com/foaf/0.1/name> "BrowseRDF" .
189
190
  project_browserdf = RDFS::Resource.new("https://launchpad.net/products/browserdf/+rdf")
190
191
  foaf_name = RDFS::Resource.new("http://xmlns.com/foaf/0.1/name")
@@ -192,18 +193,18 @@ class TestJenaAdapter < Test::Unit::TestCase
192
193
  assert_equal 1, result.flatten.size
193
194
  assert_equal "BrowseRDF", result[0]
194
195
  end
195
-
196
+
196
197
  def test_load_rdf_xml
197
198
  assert_equal 0, @adapter.size
198
-
199
+
199
200
  this_dir = File.dirname(File.expand_path(__FILE__))
200
201
  @adapter.load("file://" + this_dir + "/bnode_org_rss.rdf", :format => :rdfxml, :into => :default_model)
201
-
202
+
202
203
  assert_not_equal 0, @adapter.size
203
-
204
+
204
205
  a_post = RDFS::Resource.new("http://bnode.org/blog/2007/05/29/semantic-web-gets-a-mention-in-visual-x-mag-webinale-report")
205
206
  rss_title = RDFS::Resource.new("http://purl.org/rss/1.0/title")
206
-
207
+
207
208
  result = Query.new.distinct(:o).where(a_post, rss_title, :o).execute
208
209
  assert_equal 1, result.flatten.size
209
210
  assert_equal "Semantic Web gets a mention in Visual-x mag webinale report", result[0]
@@ -211,31 +212,31 @@ class TestJenaAdapter < Test::Unit::TestCase
211
212
 
212
213
  def test_load_n3
213
214
  assert_equal 0, @adapter.size
214
-
215
+
215
216
  this_dir = File.dirname(File.expand_path(__FILE__))
216
217
  @adapter.load("file://" + this_dir + "/s1.n3", :format => :n3, :into => :default_model)
217
-
218
+
218
219
  assert_not_equal 0, @adapter.size
219
-
220
+
220
221
  transy = RDFS::Resource.new("http://www.daml.org/2001/03/daml+oil#TransitiveProperty")
221
222
  rdf_type = RDFS::Resource.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
222
223
  result = Query.new.distinct(:s).where(:s, rdf_type, transy).execute
223
-
224
- assert_equal 3, result.flatten.size
224
+
225
+ assert_equal 3, result.flatten.size
225
226
  end
226
-
227
+
227
228
  def test_persistence_file_based_anonymous
228
- @adapter.close
229
-
229
+ @adapter.close
230
+
230
231
  this_dir = File.dirname(File.expand_path(__FILE__))
231
232
  Dir.mkdir(this_dir + "/jena_persistence")
232
233
  persistent_adapter = ConnectionPool.add_data_source(:type => :jena,
233
234
  :file => this_dir + "/jena_persistence")
234
235
  assert_equal 0, persistent_adapter.size
235
-
236
+
236
237
  persistent_adapter.add(@eyal, @age, @ageval)
237
238
  persistent_adapter.add(@eyal, @mbox, @mboxval)
238
-
239
+
239
240
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
240
241
  assert_equal 2, result.flatten.size
241
242
 
@@ -248,22 +249,22 @@ class TestJenaAdapter < Test::Unit::TestCase
248
249
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
249
250
  assert_equal 2, result.flatten.size
250
251
 
251
- adapter2.close
252
- FileUtils.rm_rf(this_dir + "/jena_persistence")
252
+ adapter2.close
253
+ FileUtils.rm_rf(this_dir + "/jena_persistence")
253
254
  end
254
255
 
255
256
  def test_persistence_file_based_named_model
256
- @adapter.close
257
-
257
+ @adapter.close
258
+
258
259
  this_dir = File.dirname(File.expand_path(__FILE__))
259
260
  Dir.mkdir(this_dir + "/jena_persistence")
260
261
  persistent_adapter = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky",
261
262
  :file => this_dir + "/jena_persistence")
262
263
  assert_equal 0, persistent_adapter.size
263
-
264
+
264
265
  persistent_adapter.add(@eyal, @age, @ageval)
265
266
  persistent_adapter.add(@eyal, @mbox, @mboxval)
266
-
267
+
267
268
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
268
269
  assert_equal 2, result.flatten.size
269
270
 
@@ -276,51 +277,51 @@ class TestJenaAdapter < Test::Unit::TestCase
276
277
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
277
278
  assert_equal 2, result.flatten.size
278
279
 
279
- adapter2.close
280
- FileUtils.rm_rf(this_dir + "/jena_persistence")
280
+ adapter2.close
281
+ FileUtils.rm_rf(this_dir + "/jena_persistence")
281
282
  end
282
283
 
283
284
  def test_keyword_search
284
285
  @adapter.close
285
-
286
+
286
287
  this_dir = File.dirname(File.expand_path(__FILE__))
287
288
  keyword_adapter = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :lucene => true)
288
-
289
+
289
290
  keyword_adapter.load("file://" + this_dir + "/test_data.nt", :format => :ntriples, :into => :default_model )
290
291
 
291
292
  eyal = RDFS::Resource.new('http://activerdf.org/test/eyal')
292
293
 
293
294
  assert keyword_adapter.keyword_search?
294
-
295
+
295
296
  assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"blue").execute(:flatten => true)
296
297
  assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"27").execute(:flatten => true)
297
298
  assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"eyal oren").execute(:flatten => true)
298
-
299
+
299
300
  keyword_adapter.close
300
301
  end
301
302
 
302
303
  def test_derby_embedded_persistence
303
304
  @adapter.close
304
305
  this_dir = File.dirname(File.expand_path(__FILE__))
305
-
306
- derby1 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky",
306
+
307
+ derby1 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky",
307
308
  :database => {:url => "jdbc:derby:#{this_dir}/superfunky;create=true", :type => "Derby", :username => "", :password => ""})
308
-
309
+
309
310
  derby1.add(@eyal, @age, @ageval)
310
311
  derby1.add(@eyal, @mbox, @mboxval)
311
312
 
312
313
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
313
314
  assert_equal 2, result.flatten.size
314
-
315
+
315
316
  derby1.close
316
317
  ConnectionPool.clear
317
318
 
318
319
  derby2 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :id => "2",
319
320
  :database => {:url => "jdbc:derby:#{this_dir}/superfunky;create=true", :type => "Derby", :username => "", :password => ""})
320
-
321
+
321
322
  result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
322
323
  assert_equal 2, result.flatten.size
323
-
324
+
324
325
  derby2.close
325
326
 
326
327
  begin
@@ -328,21 +329,21 @@ class TestJenaAdapter < Test::Unit::TestCase
328
329
  rescue java.sql.SQLException
329
330
  # expected
330
331
  end
331
- FileUtils.rm_rf(this_dir + "/superfunky")
332
+ FileUtils.rm_rf(this_dir + "/superfunky")
332
333
  end
333
-
334
+
334
335
  def test_querying_bnodes
335
336
  this_dir = File.dirname(File.expand_path(__FILE__))
336
337
  @adapter.load("file://" + this_dir + "/fun_with_bnodes.nt", :format => :ntriples, :into => :default_model)
337
-
338
+
338
339
  res1 = Array(Query.new.select(:s).where(:s, RDFS::Resource.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), RDFS::Resource.new("http://xmlns.com/foaf/0.1/Person")).execute)
339
340
  assert_equal 1, res1.size
340
341
  bn1 = res1.first
341
-
342
+
342
343
  res2 = Array(Query.new.select(:s).where(:s, :p, RDFS::Resource.new("http://wordpress.org")).execute)
343
- assert_equal 1, res2.size
344
+ assert_equal 1, res2.size
344
345
  bn2 = res2.first
345
-
346
+
346
347
  assert_equal bn1, bn2
347
348
 
348
349
  res3 = Array(Query.new.select(:o).where(bn1, :p, :o).execute)
@@ -352,64 +353,64 @@ class TestJenaAdapter < Test::Unit::TestCase
352
353
  assert_equal 1, res4.size
353
354
 
354
355
  end
355
-
356
-
356
+
357
+
357
358
  # TODO: NOT TESTED until now, run this against a local mysql installation to confirm it
358
359
  def test_mysql_persistence
359
360
  # @adapter.close
360
- #
361
+ #
361
362
  # mysql1 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :id => "1",
362
363
  # :database => {:url => "jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName;create=true", :type => "MySQL", :username => "theUser", :password => "thepassword"})
363
- #
364
+ #
364
365
  # mysql1.add(@eyal, @age, @ageval)
365
366
  # mysql1.add(@eyal, @mbox, @mboxval)
366
- #
367
+ #
367
368
  # result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
368
369
  # assert_equal 2, result.flatten.size
369
- #
370
+ #
370
371
  # mysql1.close
371
372
  # ConnectionPool.clear
372
- #
373
+ #
373
374
  # mysql2 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :id => "2",
374
375
  # :database => {:url => "jdbc:mysql://MyDbComputerNameOrIP/myDatabaseName;create=true", :type => "MySQL", :username => "theUser", :password => "thepassword"})
375
- #
376
+ #
376
377
  # result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
377
378
  # assert_equal 2, result.flatten.size
378
- #
379
+ #
379
380
  # mysql2.close
380
381
  # this_dir = File.dirname(File.expand_path(__FILE__))
381
- # #FileUtils.remove_dir(this_dir + "/superfunky")
382
+ # #FileUtils.remove_dir(this_dir + "/superfunky")
382
383
  end
383
384
 
384
385
  # TODO: NOT TESTED until now, run this against a local postgres installation to confirm it
385
386
  def test_postgres_embedded_persistence
386
387
  # @adapter.close
387
- #
388
+ #
388
389
  # postgres1 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :id => "1",
389
390
  # :database => {:url => "jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName;create=true", :type => "PostgreSQL", :username => "theUser", :password => "thepassword"})
390
- #
391
+ #
391
392
  # postgres1.add(@eyal, @age, @ageval)
392
393
  # postgres1.add(@eyal, @mbox, @mboxval)
393
- #
394
+ #
394
395
  # result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
395
396
  # assert_equal 2, result.flatten.size
396
- #
397
+ #
397
398
  # postgres1.close
398
399
  # ConnectionPool.clear
399
- #
400
+ #
400
401
  # postgres2 = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :id => "2",
401
402
  # :database => {:url => "jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName;create=true", :type => "PostgreSQL", :username => "theUser", :password => "thepassword"})
402
- #
403
+ #
403
404
  # result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
404
405
  # assert_equal 2, result.flatten.size
405
- #
406
+ #
406
407
  # postgres2.close
407
408
  # this_dir = File.dirname(File.expand_path(__FILE__))
408
- # #FileUtils.remove_dir(this_dir + "/superfunky")
409
+ # #FileUtils.remove_dir(this_dir + "/superfunky")
409
410
  end
410
411
 
411
412
 
412
-
413
+
413
414
 
414
415
 
415
416
  def test_contexts
@@ -419,21 +420,21 @@ class TestJenaAdapter < Test::Unit::TestCase
419
420
  # TODO: querying pellet does not work right now
420
421
  def test_search_with_pellet
421
422
  @adapter.close
422
-
423
+
423
424
  this_dir = File.dirname(File.expand_path(__FILE__))
424
- adapter = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :lucene => true,
425
+ adapter = ConnectionPool.add_data_source(:type => :jena, :model => "superfunky", :lucene => true,
425
426
  :reasoner => :pellet, :ontology => :owl)
426
-
427
+
427
428
  adapter.load("file://" + this_dir + "/test_data.nt", :format => :ntriples, :into => :default_model )
428
-
429
+
429
430
  eyal = RDFS::Resource.new('http://activerdf.org/test/eyal')
430
-
431
- # Keyword with pellet does not work.
431
+
432
+ # Keyword with pellet does not work.
432
433
  # assert adapter.keyword_search?
433
434
  # assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"blue").execute(:flatten => true)
434
435
  # assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"27").execute(:flatten => true)
435
436
  # assert_equal eyal, Query.new.distinct(:s).where(:s,:keyword,"eyal oren").execute(:flatten => true)
436
-
437
+
437
438
  adapter.close
438
439
  end
439
440
 
@@ -441,7 +442,7 @@ class TestJenaAdapter < Test::Unit::TestCase
441
442
  # TODO: need a better understanding of rdfs reasoning in Jena before I can write a test for it
442
443
  # def test_rdfs_reasoning
443
444
  # adapter_rdfs = ConnectionPool.add_data_source(:type => :jena, :ontology => :rdfs, :reasoner => :rdfs)
444
- #
445
+ #
445
446
  # adapter_rdfs.add(@eyal, @age, @test)
446
447
  # result = Query.new.distinct(:o).where(@eyal, :p, :o).execute
447
448
  # assert_equal 2, result.flatten.size