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
@@ -8,32 +8,41 @@ require 'federation/connection_pool'
8
8
  require "#{File.dirname(__FILE__)}/../common"
9
9
 
10
10
  class TestResourceWriting < Test::Unit::TestCase
11
- def setup
12
- ConnectionPool.clear
13
- end
11
+ include SetupAdapter
12
+
13
+ @@eyal = TEST::eyal
14
14
 
15
15
  def test_update_value
16
- Namespace.register(:ar, 'http://activerdf.org/test/')
17
- adapter = get_write_adapter
18
-
19
- eyal = RDFS::Resource.new 'http://activerdf.org/test/eyal'
20
- assert_raises(ActiveRdfError) { eyal.age = 18 }
21
-
22
- eyal.ar::age = 100
23
- assert_equal 100, eyal.ar::age
24
- assert_equal [100], eyal.all_ar::age
25
-
26
- # << fails on Fixnums , because Ruby doesn't allow us to change behaviour of
27
- # << on Fixnums
28
- eyal.age << 18
29
- assert_equal 100, eyal.age
30
-
31
- # << same for Strings (TODO)
32
- eyal.ar::name = "first"
33
- eyal.ar::name << "second"
34
- assert_equal "first", eyal.ar::name
35
-
36
- eyal.ar::age = [100, 80]
37
- assert_equal [100, 80], eyal.ar::age
16
+ assert_raises(ActiveRdfError) { @@eyal.age = 18 }
17
+
18
+ @@eyal.test::age = 100
19
+ assert_equal 100, @@eyal.test::age.to_a.first
20
+
21
+ @@eyal.age += 18
22
+ assert_equal [100,18], @@eyal.age
23
+
24
+ @@eyal.test::age = [100, 80]
25
+ assert_equal [100, 80], @@eyal.test::age
26
+ end
27
+
28
+ def test_clear_property
29
+ TEST::eyal.test::email = ["eyal@cs.vu.nl","eyal.oren@deri.net"]
30
+ assert_equal 2, TEST::eyal.email.size
31
+ TEST::eyal.email.clear
32
+
33
+ # once direct predicates not defined in the schema are removed, they are no longer accessible without specifying a namespace
34
+ assert_nil TEST::eyal.email
35
+ assert_raise ActiveRdfError do
36
+ TEST::eyal.email = ""
37
+ end
38
+ assert_equal 0, TEST::eyal.test::email.size
39
+ end
40
+
41
+ def test_save
42
+ foo = RDFS::Resource.new(TEST::foo)
43
+ assert_equal 0, ConnectionPool.write_adapter.size
44
+ foo.save
45
+ assert_equal 1, ConnectionPool.write_adapter.size
46
+ assert_equal [foo], RDFS::Resource.find_all
38
47
  end
39
48
  end
@@ -2,7 +2,7 @@ module RDFS
2
2
  # External resource class
3
3
  class MyExternalResource
4
4
 
5
- include ResourceLike
5
+ include ActiveRDF::ResourceLike
6
6
 
7
7
  # uri of the resource
8
8
  attr_reader :uri
@@ -17,6 +17,10 @@ module RDFS
17
17
  @uri = uri
18
18
  end
19
19
 
20
+ def to_literal_s
21
+ @uri
22
+ end
23
+
20
24
  def to_s
21
25
  "<#{uri}>"
22
26
  end
@@ -18,7 +18,7 @@ class TestExternalResourceClass < Test::Unit::TestCase
18
18
  @@age = RDFS::MyExternalResource.new("http://activerdf.org/test/age")
19
19
 
20
20
  def test_query_external_resource
21
- adapters = get_talia_adapters
21
+ adapters = [get_primary_adapter, get_secondary_adapter]
22
22
  adapters.each do |adapter|
23
23
 
24
24
  # load test data
@@ -39,11 +39,4 @@ class TestExternalResourceClass < Test::Unit::TestCase
39
39
  end
40
40
  end
41
41
 
42
- def test_namespace_external_resource
43
- # namespace
44
- Namespace.register(:test, 'http://activerdf.org/test/')
45
- assert_kind_of(RDFS::MyExternalResource, Namespace.lookup(:test, "eyal", RDFS::MyExternalResource))
46
- assert_equal(:test, Namespace.prefix(@@eyal))
47
- assert_equal("eyal",Namespace.localname(@@eyal))
48
- end
49
42
  end
@@ -8,6 +8,8 @@ require 'queryengine/ntriples_parser'
8
8
  require "#{File.dirname(__FILE__)}/../common"
9
9
 
10
10
  class TestNTriplesParser < Test::Unit::TestCase
11
+ include ActiveRDF
12
+
11
13
  def setup
12
14
  end
13
15
 
@@ -18,9 +20,9 @@ class TestNTriplesParser < Test::Unit::TestCase
18
20
  str = <<EOF
19
21
  <http://www.johnbreslin.com/blog/author/cloud/#foaf> <http://xmlns.com/foaf/0.1/surname> "Breslin" .
20
22
  <http://www.johnbreslin.com/blog/author/cloud/#foaf> <http://xmlns.com/foaf/0.1/firstName> "John" .
21
- <http://www.johnbreslin.com/blog/author/cloud/> <http://purl.org/dc/terms/created> "1999-11-30T00:00:00" .
23
+ <http://www.johnbreslin.com/blog/author/cloud/> <http://purl.org/dc/terms/created> "1999-11-30T00:00:00" .
22
24
  EOF
23
-
25
+
24
26
  triples = NTriplesParser.parse(str)
25
27
  assert_equal 9, triples.flatten.size
26
28
  assert_equal 3, triples[0].size
@@ -59,7 +61,7 @@ EOF
59
61
  <s> <p> "blue" .
60
62
  <s> <p> "29"^^<http://www.w3.org/2001/XMLSchema#integer> .
61
63
  <s> <p> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
62
- <s> <p> "2002-10-10T00:00:00+13"^^<http://www.w3.org/2001/XMLSchema#date> .
64
+ <s> <p> "2002-10-10T00:00:00+13"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
63
65
  EOF
64
66
  triples = NTriplesParser.parse(string)
65
67
  assert_equal 4, triples.size
@@ -19,7 +19,7 @@ class TestQuery < Test::Unit::TestCase
19
19
  query.select(:s)
20
20
  query.where(:s, RDFS::Resource.new('predicate'), '30')
21
21
  generated = Query2SPARQL.translate(query)
22
- expected = "SELECT ?s WHERE { ?s <predicate> \"30\" . }"
22
+ expected = "SELECT ?s WHERE { ?s <predicate> \"30\" . } "
23
23
  assert_equal expected, generated
24
24
 
25
25
  query = Query.new
@@ -27,7 +27,7 @@ class TestQuery < Test::Unit::TestCase
27
27
  query.where(:s, RDFS::Resource.new('foaf:age'), :a)
28
28
  query.where(:a, RDFS::Resource.new('rdf:type'), RDFS::Resource.new('xsd:int'))
29
29
  generated = Query2SPARQL.translate(query)
30
- expected = "SELECT ?s WHERE { ?s <foaf:age> ?a. ?a <rdf:type> <xsd:int> . }"
30
+ expected = "SELECT ?s WHERE { ?s <foaf:age> ?a. ?a <rdf:type> <xsd:int> . } "
31
31
  assert_equal expected, generated
32
32
  end
33
33
 
@@ -36,7 +36,7 @@ class TestQuery < Test::Unit::TestCase
36
36
  query.distinct(:s)
37
37
  query.where(:s, RDFS::Resource.new('foaf:age'), :a)
38
38
  generated = Query2SPARQL.translate(query)
39
- expected = "SELECT DISTINCT ?s WHERE { ?s <foaf:age> ?a . }"
39
+ expected = "SELECT DISTINCT ?s WHERE { ?s <foaf:age> ?a . } "
40
40
  assert_equal expected, generated
41
41
  end
42
42
 
@@ -23,7 +23,7 @@ class TestQuery2Jars2 < Test::Unit::TestCase
23
23
  query.where(:s, RDFS::Resource.new('predicate'), '30')
24
24
 
25
25
  generated = Query2SPARQL.translate(query)
26
- expected = "SELECT ?s WHERE { ?s <predicate> \"30\" . }"
26
+ expected = "SELECT ?s WHERE { ?s <predicate> \"30\"^^<http://www.w3.org/2001/XMLSchema#string> . } "
27
27
  assert_equal expected, generated
28
28
 
29
29
  query = Query.new
@@ -31,7 +31,7 @@ class TestQuery2Jars2 < Test::Unit::TestCase
31
31
  query.where(:s, RDFS::Resource.new('foaf:age'), :a)
32
32
  query.where(:a, RDFS::Resource.new('rdf:type'), RDFS::Resource.new('xsd:int'))
33
33
  generated = Query2SPARQL.translate(query)
34
- expected = "SELECT ?s WHERE { ?s <foaf:age> ?a. ?a <rdf:type> <xsd:int> . }"
34
+ expected = "SELECT ?s WHERE { ?s <foaf:age> ?a. ?a <rdf:type> <xsd:int> . } "
35
35
  assert_equal expected, generated
36
36
 
37
37
  # query = Query.new
@@ -28,7 +28,7 @@ class TestQuery2Sparql < Test::Unit::TestCase
28
28
  assert_equal expected, generated
29
29
  end
30
30
 
31
- def test_sparql_distinct
31
+ def test_sparql_distinct
32
32
  query = Query.new
33
33
  query.distinct(:s)
34
34
  query.where(:s, RDFS::Resource.new('foaf:age'), :a)
@@ -60,7 +60,7 @@ class TestQuery2Sparql < Test::Unit::TestCase
60
60
  def test_execute_sort_query
61
61
  ConnectionPool.clear
62
62
  file_one = "#{File.dirname(__FILE__)}/../small-one.nt"
63
- adapter = get_adapter
63
+ adapter = get_primary_adapter
64
64
 
65
65
  if (adapter.class.to_s != "SesameAdapter")
66
66
  adapter.load file_one
@@ -7,46 +7,64 @@ require 'active_rdf'
7
7
  require 'queryengine/query'
8
8
  require 'queryengine/query2sparql'
9
9
  require "#{File.dirname(__FILE__)}/../common"
10
+ require 'set'
10
11
 
11
12
  class TestQueryEngine < Test::Unit::TestCase
13
+ include SetupAdapter
14
+
12
15
  def setup
16
+ super
17
+ @adapter.load "#{File.dirname(__FILE__)}/../test_person_data.nt"
13
18
  end
14
19
 
15
- def teardown
20
+ def test_datatype
21
+ t = Time.parse("Tue Jan 20 12:00:00 -0800 2009")
22
+ @adapter.add(TEST::time,TEST::value,t)
23
+
24
+ email = Set["eyal@cs.vu.nl","eyal.oren@deri.org"]
25
+ assert_equal email, Set.new(Query.new.select(:o).where(:s,:p,:o).datatype(:o,XSD::string).execute)
26
+ assert_equal Set[27,21], Set.new(Query.new.select(:o).where(:s,:p,:o).datatype(:o,XSD::integer).execute)
27
+ assert_equal [t], Query.new.select(:o).where(:s,:p,:o).datatype(:o,XSD::time).execute
16
28
  end
17
29
 
18
- def test_sparql_generation
30
+ def test_lang
31
+
32
+ en_blue = LocalizedString.new('blue','en')
33
+ nl_blauw = LocalizedString.new('blauw','nl')
34
+ @adapter.add(TEST::eyal,TEST::eye, nl_blauw)
35
+ @adapter.add(TEST::eyal,TEST::eye,'blu')
19
36
 
20
- # TODO: write tests for distinct, ask
37
+ assert_equal Set[en_blue,nl_blauw,'blu'], Set.new(Query.new.select(:o).where(:s,TEST::eye,:o).execute)
38
+ assert_equal Set[en_blue,nl_blauw], Set.new(Query.new.select(:o).where(:s,:p,:o).lang(:o,'n',false).execute)
39
+ assert_equal [en_blue], Query.new.select(:o).where(:s,:p,:o).lang(:o,'e',false).execute
40
+ assert_equal [en_blue], Query.new.select(:o).where(:s,:p,:o).lang(:o,'en',true).execute
41
+ assert_equal [], Query.new.select(:s).where(:s,:p,:o).lang(:o,'n',true).execute
21
42
 
22
- query = Query.new
23
- query.select(:s)
24
- query.where(:s, RDFS::Resource.new('predicate'), 30)
43
+ # check that localized strings will also be found when searching with a non-localized string
44
+ q = Query.new.select(:s).where(:s,TEST::eye,"blue").all_types
45
+ assert_equal Set[TEST::eyal], Set.new(q.execute)
46
+ assert_equal Set[TEST::eyal], Set.new(Query.new.select(:s).where(:s,TEST::eye,"blauw").all_types.execute)
47
+ end
25
48
 
26
- generated = Query2SPARQL.translate(query)
27
- expected = "SELECT ?s WHERE { ?s <predicate> \"30\"^^<http://www.w3.org/2001/XMLSchema#integer> . } "
28
- assert_equal expected, generated
49
+ def test_expanded_objects
50
+ @adapter.load "#{File.dirname(__FILE__)}/../test_person2_data.nt"
51
+ eyal = TEST::eyal
52
+ michael = TEST::michael
53
+ benjamin = TEST::Person.new(TEST::benjamin)
54
+ eyal.test::member_of = ["A","B","C"]
55
+ michael.test::member_of = ["A","B"]
56
+ benjamin.test::member_of = ["B","C"]
29
57
 
30
- query = Query.new
31
- query.select(:s)
32
- query.where(:s, RDFS::Resource.new('foaf:age'), :a)
33
- query.where(:a, RDFS::Resource.new('rdf:type'), RDFS::Resource.new('xsd:int'))
34
- generated = Query2SPARQL.translate(query)
35
- expected = "SELECT ?s WHERE { ?s <foaf:age> ?a . ?a <rdf:type> <xsd:int> . } "
36
- assert_equal expected, generated
58
+ s = Query.new.select(:s).where(:s,TEST::member_of,["A","B","C"]).execute
59
+ assert_equal Set[eyal], Set.new(s)
37
60
 
38
- # query = Query.new
39
- # query.select(:s).select(:a)
40
- # query.where(:s, 'foaf:age', :a)
41
- # generated = Query2SPARQL.translate(query)
42
- # expected = "SELECT DISTINCT ?s ?a WHERE { ?s foaf:age ?a .}"
43
- # assert_equal expected, generated
44
- end
61
+ s = Query.new.select(:s).where(:s,TEST::member_of,["A","B"]).execute
62
+ assert_equal Set[eyal,michael], Set.new(s)
63
+
64
+ s = Query.new.select(:s).where(:s,TEST::member_of,["B","C"]).execute
65
+ assert_equal Set[eyal,benjamin], Set.new(s)
45
66
 
46
- def test_query_omnipotent
47
- # can define multiple select clauses at once or separately
48
- q1 = Query.new.select(:s,:a)
49
- q2 = Query.new.select(:s).select(:a)
50
- assert_equal Query2SPARQL.translate(q1),Query2SPARQL.translate(q2)
67
+ s = Query.new.select(:s).where(:s,TEST::member_of,"B").execute
68
+ assert_equal Set[eyal,michael,benjamin], Set.new(s)
51
69
  end
52
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerdf_net7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.16
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eyal Oren
@@ -10,7 +10,7 @@ autorequire: active_rdf
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-11 00:00:00 +01:00
13
+ date: 2010-02-11 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -95,9 +95,6 @@ files:
95
95
  - activerdf-rdflite/lib/activerdf_rdflite/init.rb
96
96
  - activerdf-rdflite/lib/activerdf_rdflite/rdflite.rb
97
97
  - activerdf-rdflite/lib/activerdf_rdflite/suggesting.rb
98
- - activerdf-rdflite/test/test_bnode_data.nt
99
- - activerdf-rdflite/test/test_data.nt
100
- - activerdf-rdflite/test/test_escaped_data.nt
101
98
  - activerdf-rdflite/test/test_fetching.rb
102
99
  - activerdf-rdflite/test/test_rdflite.rb
103
100
  - activerdf-redland/CHANGELOG
@@ -107,7 +104,6 @@ files:
107
104
  - activerdf-redland/VERSION
108
105
  - activerdf-redland/lib/activerdf_redland/init.rb
109
106
  - activerdf-redland/lib/activerdf_redland/redland.rb
110
- - activerdf-redland/test/test_person_data.nt
111
107
  - activerdf-redland/test/test_redland_adapter.rb
112
108
  - activerdf-sesame/CHANGELOG
113
109
  - activerdf-sesame/LICENSE
@@ -202,9 +198,12 @@ files:
202
198
  - lib/active_rdf/objectmanager/namespace.rb
203
199
  - lib/active_rdf/objectmanager/object_manager.rb
204
200
  - lib/active_rdf/objectmanager/ordered_set.rb
201
+ - lib/active_rdf/objectmanager/property.rb
205
202
  - lib/active_rdf/objectmanager/property_list.rb
203
+ - lib/active_rdf/objectmanager/property_lookup.rb
206
204
  - lib/active_rdf/objectmanager/resource.rb
207
205
  - lib/active_rdf/objectmanager/resource_like.rb
206
+ - lib/active_rdf/objectmanager/resource_query.rb
208
207
  - lib/active_rdf/queryengine/ntriples_parser.rb
209
208
  - lib/active_rdf/queryengine/query.rb
210
209
  - lib/active_rdf/queryengine/query2jars2.rb
@@ -243,6 +242,15 @@ signing_key:
243
242
  specification_version: 3
244
243
  summary: Offers object-oriented access to RDF (with adapters to several datastores). Version of the Talia project.
245
244
  test_files:
245
+ - test/adapters/test_activerdf_adapter.rb
246
+ - test/adapters/test_adapters.rb
247
+ - test/adapters/test_bnode_capable_adapter.rb
248
+ - test/adapters/test_context_aware_adapter.rb
249
+ - test/adapters/test_network_aware_adapter.rb
250
+ - test/adapters/test_persistent_adapter.rb
251
+ - test/adapters/test_read_only_adapter.rb
252
+ - test/adapters/test_reasoning_adapter.rb
253
+ - test/adapters/test_writable_adapter.rb
246
254
  - test/common.rb
247
255
  - test/directaccess/test_direct_access.rb
248
256
  - test/federation/test_connection_pool.rb
@@ -251,9 +259,10 @@ test_files:
251
259
  - test/objectmanager/test_namespace.rb
252
260
  - test/objectmanager/test_object_manager.rb
253
261
  - test/objectmanager/test_ordered_set.rb
262
+ - test/objectmanager/test_property.rb
254
263
  - test/objectmanager/test_resource_reading.rb
264
+ - test/objectmanager/test_resource_reasoning.rb
255
265
  - test/objectmanager/test_resource_writing.rb
256
- - test/objectmanager/test_talia_syntax.rb
257
266
  - test/queryengine/my_external_resource.rb
258
267
  - test/queryengine/test_external_resource_class.rb
259
268
  - test/queryengine/test_ntriples_parser.rb
@@ -261,4 +270,3 @@ test_files:
261
270
  - test/queryengine/test_query2jars2.rb
262
271
  - test/queryengine/test_query2sparql.rb
263
272
  - test/queryengine/test_query_engine.rb
264
- - test/test_adapters.rb
@@ -1,5 +0,0 @@
1
- _:1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://activerdf.org/test/Person> .
2
- _:1 <http://activerdf.org/test/age> "27" .
3
- _:1 <http://activerdf.org/test/name> "Eyal Oren" .
4
- _:2 <http://activerdf.org/test/age> "27" .
5
- _:2 <http://activerdf.org/test/eye> "blue" .
@@ -1,32 +0,0 @@
1
- <http://activerdf.org/test/Person> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
2
- <http://activerdf.org/test/Person> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
3
- <http://activerdf.org/test/Person> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://www.w3.org/2000/01/rdf-schema#Resource> .
4
- <http://activerdf.org/test/age> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
5
- <http://activerdf.org/test/age> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
6
- <http://activerdf.org/test/age> <http://www.w3.org/2000/01/rdf-schema#domain> <http://activerdf.org/test/Person> .
7
- <http://activerdf.org/test/age> <http://www.w3.org/2000/01/rdf-schema#domain> <http://www.w3.org/2000/01/rdf-schema#Resource> .
8
- <http://activerdf.org/test/age> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Literal> .
9
- <http://activerdf.org/test/car> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
10
- <http://activerdf.org/test/car> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
11
- <http://activerdf.org/test/car> <http://www.w3.org/2000/01/rdf-schema#domain> <http://activerdf.org/test/Person> .
12
- <http://activerdf.org/test/car> <http://www.w3.org/2000/01/rdf-schema#domain> <http://www.w3.org/2000/01/rdf-schema#Resource> .
13
- <http://activerdf.org/test/car> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Literal> .
14
- <http://activerdf.org/test/eyal> <http://activerdf.org/test/age> "27" .
15
- <http://activerdf.org/test/eyal> <http://activerdf.org/test/eye> "blue" .
16
- <http://activerdf.org/test/eyal> <http://activerdf.org/test/name> "Eyal Oren" .
17
- <http://activerdf.org/test/eyal> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://activerdf.org/test/Person> .
18
- <http://activerdf.org/test/eyal> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
19
- <http://activerdf.org/test/eye> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
20
- <http://activerdf.org/test/eye> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
21
- <http://activerdf.org/test/eye> <http://www.w3.org/2000/01/rdf-schema#domain> <http://activerdf.org/test/Person> .
22
- <http://activerdf.org/test/eye> <http://www.w3.org/2000/01/rdf-schema#domain> <http://www.w3.org/2000/01/rdf-schema#Resource> .
23
- <http://activerdf.org/test/eye> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Literal> .
24
- <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
25
- <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
26
- <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#domain> <http://www.w3.org/2000/01/rdf-schema#Resource> .
27
- <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/2000/01/rdf-schema#Class> .
28
- <http://www.w3.org/2000/01/rdf-schema#Class> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
29
- <http://www.w3.org/2000/01/rdf-schema#Class> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
30
- _:#1 <http://activerdf.org/test/age> "29" .
31
- _:#1 <http://activerdf.org/test/name> "Another Person" .
32
- _:#1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://activerdf.org/test/Person> .
@@ -1,2 +0,0 @@
1
- <http://activerdf.org/test/eyal> <http://activerdf.org/test/comment> "ümlauts and \u00ebmlauts" .
2
- <http://activerdf.org/test/eyal> <http://activerdf.org/test/encoded> "line\nbreaks, <p>'s and \"quotes\"" .
@@ -1,42 +0,0 @@
1
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
- @prefix ar: <http://activerdf.org/test/> .
4
-
5
- ar:Person a rdfs:Class .
6
- # each class is subclass of resource
7
- ar:Person rdfs:subClassOf rdfs:Resource .
8
-
9
- ar:eyal a ar:Person .
10
- ar:eyal ar:age "27".
11
- ar:eyal ar:eye "blue".
12
- # inferred statements about eyal
13
-
14
- # all properties of Person are also properties of Resource
15
- ar:age rdfs:domain rdfs:Resource .
16
- ar:eye rdfs:domain rdfs:Resource .
17
- ar:car rdfs:domain rdfs:Resource .
18
-
19
- ar:age a rdf:Property .
20
- ar:eye a rdf:Property .
21
- ar:car a rdf:Property .
22
- ar:age rdfs:domain ar:Person .
23
- ar:age rdfs:range rdf:Literal .
24
- ar:eye rdfs:domain ar:Person .
25
- ar:eye rdfs:range rdf:Literal .
26
- ar:car rdfs:domain ar:Person .
27
- ar:car rdfs:range rdf:Literal .
28
-
29
- # everything is a resource
30
- ar:Person a rdfs:Resource .
31
- ar:eye a rdfs:Resource .
32
- ar:eyal a rdfs:Resource .
33
- ar:age a rdfs:Resource .
34
- ar:car a rdfs:Resource .
35
-
36
- # standard stuff
37
- rdfs:Class a rdfs:Class .
38
- rdfs:Class a rdfs:Resource .
39
- rdf:Property a rdfs:Class .
40
- rdf:Property a rdfs:Resource .
41
- rdf:type rdfs:domain rdfs:Resource .
42
- rdf:type rdfs:range rdfs:Class .
@@ -1,68 +0,0 @@
1
- # Author: Michele Nucci
2
- # License: LGPL
3
- #
4
- # Test for new syntax in ActiveRDF for Talia
5
-
6
- require 'test/unit'
7
- require 'active_rdf'
8
- require 'federation/connection_pool'
9
- require "#{File.dirname(__FILE__)}/../common"
10
-
11
- class TestTaliaSyntax < Test::Unit::TestCase
12
- def setup
13
- ConnectionPool.clear
14
- end
15
-
16
- def test_syntax
17
- adapter = get_write_adapter
18
- adapter.load "#{File.dirname(__FILE__)}/../test_person_data.nt"
19
-
20
- Namespace.register(:test, 'http://activerdf.org/test/')
21
-
22
- eyal = RDFS::Resource.new 'http://activerdf.org/test/eyal'
23
- michele = RDFS::Resource.new 'http://activerdf.org/test/michele'
24
-
25
- # Adding some triples
26
- adapter.add(michele, RDFS::subClassOf, RDF::Resource)
27
- adapter.add(michele, RDF::type, Namespace.lookup(:rdfs, 'Class') )
28
- adapter.add(michele, RDF::type, Namespace.lookup(:test, 'Person') )
29
- adapter.add(eyal, Namespace.lookup(:test, 'friendOf'), michele)
30
-
31
- assert_nothing_raised(ActiveRdfError) {
32
- michele.car = 'car1'
33
- michele.car = 'car2'
34
- }
35
-
36
- # new syntax (shortcut) to get all properties values about TEST::car
37
- x = michele[TEST::car]
38
- assert_not_equal [], x
39
-
40
- # Adding new property (new triple) with the new syntax
41
- x << 'car3'
42
- assert_equal ['car2', 'car3'], x
43
-
44
- # test inverse ===========================================================
45
- y = michele.inverse
46
- assert_equal '<http://activerdf.org/test/eyal>', y[Namespace.lookup(:test, 'friendOf')].to_s
47
- # ========================================================================
48
-
49
- # test deletion triple with new syntax ===================================
50
-
51
- # remove a triple whose value is specified relater to TEST::car
52
- x.remove('car3')
53
- assert_equal ['car2'], x
54
-
55
- # remove every triples related to TEST::car
56
- x.remove
57
- assert_equal [], x
58
-
59
- # remove EVERY triples related to a specified resource
60
- FederationManager.delete_all(michele)
61
- result = Query.new.select(:p, :o).where(michele, :p, :o).execute
62
- assert_equal [], result
63
- # ========================================================================
64
-
65
-
66
- end
67
-
68
- end