activerdf_rdflite 1.2 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,13 +13,13 @@ setup_rdoc ['README', 'LICENSE', 'lib/**/*.rb', 'doc/**/*.rdoc']
13
13
  desc "test and package gem"
14
14
  task :default => [:test, :package]
15
15
 
16
- # get VERSION from commandline
17
- VERSION = '1.2'
16
+ # get @VERSION from commandline
17
+ @VERSION = '1.2.1'
18
18
  NAME="activerdf_rdflite"
19
- GEMNAME="#{NAME}-#{VERSION}.gem"
19
+ GEMNAME="#{NAME}-#{@VERSION}.gem"
20
20
 
21
21
  # define package task
22
- setup_gem(NAME,VERSION) do |spec|
22
+ setup_gem(NAME,@VERSION) do |spec|
23
23
  spec.summary = "an RDF database for usage in ActiveRDF (based on sqlite3)"
24
24
  spec.description = spec.summary
25
25
  spec.author="Eyal Oren <eyal.oren@deri.org"
@@ -335,7 +335,11 @@ class RDFLite < ActiveRdfAdapter
335
335
  # but on the other hand, restating the aliases gives ambiguity:
336
336
  # "from triple as t1 join triple as t2 on ... join triple as t1 ..."
337
337
  # is ambiguous
338
- join << " join triple as #{buddyalias} on #{termjoin} = #{buddyjoin} "
338
+ if join_stmt.include?(buddyalias)
339
+ join << "and #{termjoin} = #{buddyjoin}"
340
+ else
341
+ join << " join triple as #{buddyalias} on #{termjoin} = #{buddyjoin} "
342
+ end
339
343
  end
340
344
  join_stmt << join
341
345
 
data/test/test_rdflite.rb CHANGED
@@ -205,4 +205,27 @@ class TestRdfLiteAdapter < Test::Unit::TestCase
205
205
  assert_equal 29, TEST::Person.find_all[1].age.to_i
206
206
  assert_equal "Another Person", TEST::Person.find_all[1].name
207
207
  end
208
+
209
+ def test_multi_join
210
+ adapter = ConnectionPool.add_data_source :type => :rdflite
211
+ type = Namespace.lookup(:rdf, 'type')
212
+ transProp = Namespace.lookup(:owl, 'TransitiveProperty')
213
+
214
+ Namespace.register(:test, 'http://test.com/')
215
+ ancestor = Namespace.lookup(:test, 'ancestor')
216
+ sue = Namespace.lookup(:test, 'Sue')
217
+ mary = Namespace.lookup(:test, 'Mary')
218
+ anne = Namespace.lookup(:test, 'Anne')
219
+
220
+ adapter.add ancestor, type, transProp
221
+ adapter.add sue, ancestor, mary
222
+ adapter.add mary, ancestor, anne
223
+
224
+ # test that query with multi-join (joining over 1.p==2.p and 1.o==2.s) works
225
+ query = Query.new.select(:Sue, :p, :Anne)
226
+ query.where(:p, type, transProp)
227
+ query.where(:Sue, :p, :Mary)
228
+ query.where(:Mary, :p, :Anne)
229
+ assert_equal 1, query.execute.size
230
+ end
208
231
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: activerdf_rdflite
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.2"
6
+ version: 1.2.1
7
7
  date: 2006-12-21 00:00:00 +01:00
8
8
  summary: an RDF database for usage in ActiveRDF (based on sqlite3)
9
9
  require_paths: