rtm 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/DISCLAIMER +3 -1
  2. data/README +0 -0
  3. data/lib/rtm.rb +0 -1
  4. data/lib/rtm/axes/topic.rb +0 -3
  5. data/lib/rtm/axes/topics.rb +0 -3
  6. data/lib/rtm/connection.rb +4 -4
  7. data/lib/rtm/engine.rb +6 -5
  8. data/lib/rtm/extensions.rb +1 -1
  9. data/lib/rtm/helpers/no_output.rb +1 -1
  10. data/lib/rtm/io/from_xtm2_libxml.rb +2 -2
  11. data/lib/rtm/io/tmapix_from.rb +11 -24
  12. data/lib/rtm/io/tmapix_to.rb +38 -7
  13. data/lib/rtm/navigation/topic/characteristics.rb +7 -9
  14. data/lib/rtm/navigation/topic/supertypes.rb +1 -5
  15. data/lib/rtm/sugar.rb +16 -1
  16. data/lib/rtm/sugar/association/remove.rb +21 -0
  17. data/lib/rtm/sugar/name/remove.rb +18 -0
  18. data/lib/rtm/sugar/occurrence/external.rb +1 -0
  19. data/lib/rtm/sugar/occurrence/remove.rb +15 -0
  20. data/lib/rtm/sugar/topic/remove.rb +23 -0
  21. data/lib/rtm/sugar/topic/topic_ref.rb +111 -7
  22. data/lib/rtm/sugar/topic_map/readable.rb +19 -0
  23. data/lib/rtm/sugar/topic_map/remove.rb +15 -6
  24. data/lib/rtm/sugar/topic_map/resolve.rb +44 -0
  25. data/lib/rtm/sugar/topic_map/scoped.rb +42 -0
  26. data/lib/rtm/sugar/topic_map/types.rb +46 -0
  27. data/lib/rtm/sugar/variant/remove.rb +15 -0
  28. data/lib/rtm/version.rb +1 -2
  29. data/spec/rtm/axes/topic_spec.rb +4 -4
  30. data/spec/rtm/axes/topics_spec.rb +4 -4
  31. data/spec/rtm/engine_spec.rb +10 -1
  32. data/spec/rtm/io/tmapix_from_spec.rb +41 -9
  33. data/spec/rtm/io/tmapix_to_spec.rb +58 -32
  34. data/spec/rtm/io/to_rdf_spec.rb +8 -4
  35. data/spec/rtm/javatmapi_spec.rb +39 -29
  36. data/spec/rtm/navigation/topic/characteristics_spec.rb +11 -16
  37. data/spec/rtm/navigation/topic/supertypes_spec.rb +32 -89
  38. data/spec/rtm/navigation/topic_spec.rb +4 -4
  39. data/spec/rtm/sugar/association/hash_access_spec.rb +1 -1
  40. data/spec/rtm/sugar/topic/counterparts_spec.rb +18 -2
  41. data/spec/rtm/sugar/topic/remove_spec.rb +46 -0
  42. data/spec/rtm/sugar/topic/topic_ref_spec.rb +99 -26
  43. data/spec/rtm/sugar/topic_map/readable_spec.rb +25 -0
  44. data/spec/rtm/sugar/topic_map/remove_spec.rb +4 -1
  45. data/spec/rtm/sugar/topic_map/resolve_spec.rb +56 -0
  46. data/spec/rtm/sugar/topic_map/types_spec.rb +31 -0
  47. data/spec/rtm/tmapi/core/reifiable_spec.rb +0 -1
  48. data/spec/rtm/tmapi/core/topic_map_spec.rb +13 -8
  49. data/spec/rtm/tmapi/core/topic_spec.rb +17 -6
  50. data/spec/rtm/tmapi_spec.rb +2 -2
  51. data/spec/rtm_spec.rb +3 -3
  52. data/spec/spec_helper.rb +34 -6
  53. data/test/javalibs/junit-4.8.1.jar +0 -0
  54. data/test/javalibs/tmapi-tests-2.0.3-SNAPSHOT.jar +0 -0
  55. metadata +175 -165
  56. data/test/javalibs/junit-4.5.jar +0 -0
  57. data/test/javalibs/tmapi-2.0-tests.jar +0 -0
@@ -50,11 +50,11 @@ module RTM::Axes
50
50
  it "should be allowed to call #subtypes on a RTM::Axes::Topic" do
51
51
  @proxy.methods.should include("subtypes")
52
52
  end
53
- it "should be allowed to call #reverse_subtypes on a RTM::Axes::Topic" do
54
- @proxy.methods.should include("reverse_subtypes")
53
+ it "should not be allowed to call #reverse_subtypes on a RTM::Axes::Topic" do
54
+ @proxy.methods.should_not include("reverse_subtypes")
55
55
  end
56
- it "should be allowed to call #reverse_supertypes on a RTM::Axes::Topic" do
57
- @proxy.methods.should include("reverse_supertypes")
56
+ it "should not be allowed to call #reverse_supertypes on a RTM::Axes::Topic" do
57
+ @proxy.methods.should_not include("reverse_supertypes")
58
58
  end
59
59
  it "should be allowed to call #traverse on a RTM::Axes::Topic" do
60
60
  @proxy.methods.should include("traverse")
@@ -53,11 +53,11 @@ module RTM::Axes
53
53
  it "should be allowed to call #subtypes on a RTM::TQML::Topics" do
54
54
  @proxy.methods.should include("subtypes")
55
55
  end
56
- it "should be allowed to call #reverse_subtypes on a RTM::TQML::Topics" do
57
- @proxy.methods.should include("reverse_subtypes")
56
+ it "should not be allowed to call #reverse_subtypes on a RTM::TQML::Topics" do
57
+ @proxy.methods.should_not include("reverse_subtypes")
58
58
  end
59
- it "should be allowed to call #reverse_supertypes on a RTM::TQML::Topics" do
60
- @proxy.methods.should include("reverse_supertypes")
59
+ it "should not be allowed to call #reverse_supertypes on a RTM::TQML::Topics" do
60
+ @proxy.methods.should_not include("reverse_supertypes")
61
61
  end
62
62
  it "should be allowed to call #traverse on a RTM::TQML::Topics" do
63
63
  @proxy.methods.should include("traverse")
@@ -10,7 +10,7 @@ module RTM
10
10
 
11
11
  describe "#identifier" do
12
12
  before(:all) do
13
- @connection = RTM.connect(:implementation => implementation_for_spec)
13
+ @connection = get_used_tm_sys
14
14
  @tested = false
15
15
  end
16
16
  it "should return :ontopia if ontopia is used" do
@@ -32,6 +32,15 @@ module RTM
32
32
  elsif implementation_for_spec == :sesametm
33
33
  @connection.identifier.should == :sesametm
34
34
  @tested = true
35
+ elsif implementation_for_spec == :majortom
36
+ @connection.identifier.should == :majortom
37
+ @tested = true
38
+ elsif implementation_for_spec == :majortom_db
39
+ @connection.identifier.should == :majortom
40
+ @tested = true
41
+ elsif implementation_for_spec == :couchtm
42
+ @connection.identifier.should == :couchtm
43
+ @tested = true
35
44
  else
36
45
  # engine not found
37
46
  end
@@ -8,38 +8,68 @@ module RTM::IO::TmapiXFrom::TopicMap
8
8
  describe self do
9
9
  before(:each) do
10
10
  @tm = get_used_tm_sys_tm
11
+ @tm.topics.should be_empty
12
+ @tm.associations.should be_empty
13
+ @tm.names.should be_empty
14
+ @tm.occurrences.should be_empty
15
+ @tm.variants.should be_empty
16
+ @tm.roles.should be_empty
17
+ @test_size = false
11
18
  end
12
19
  after(:each) do
20
+ if @test_size
21
+ # This is just for testing if approx. everything was imported
22
+ @tm.topics.size.should >= 117
23
+ @tm.associations.size.should >= 58
24
+ @tm.names.size.should >= 169
25
+ @tm.occurrences.size.should == 28
26
+ @tm.variants.size.should == 44
27
+ @tm.roles.size.should >= 131
28
+ end
13
29
  @tm.close
14
30
  end
15
31
 
16
32
  describe "#from_ltm" do
17
33
  it "should import into an empty topic map" do
18
34
  @tm.from_ltm(File.dirname(__FILE__) + "/../../resources/toyTM.ltm")
35
+ # @tm.occurrences.each do |o|
36
+ # puts "Occurrence:"
37
+ # puts "Type: " + o.type.reference
38
+ # puts "Parent: " + o.parent.reference
39
+ # end
40
+ #@test_size = true
41
+ end
42
+ it "should load the pokemon.ltm map" do
43
+ @tm.from_ltm(File.dirname(__FILE__) + "/../../resources/pokemon.ltm")
19
44
  end
20
45
  end
21
46
 
22
47
  describe "#from_ctm" do
23
48
  it "should import into an empty topic map" do
24
49
  @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
50
+ @test_size = true
25
51
  end
26
52
  end
27
53
 
28
54
  describe "#from_jtm" do
29
55
  it "should import into an empty topic map" do
30
- #@tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
56
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
57
+ @test_size = true
31
58
  end
32
59
  end
33
60
 
34
61
  describe "#from_tmxml" do
35
62
  it "should import into an empty topic map" do
36
- #@tm.from_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM.tmxml")
63
+ pending "not working" do
64
+ @tm.from_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM.tmxml")
65
+ end
37
66
  end
38
67
  end
39
68
 
40
69
  describe "#from_xtm10" do
41
70
  it "should import into an empty topic map" do
42
- #@tm.from_xtm10(File.dirname(__FILE__) + "/../../resources/toyTM_xtm10.xtm")
71
+ @tm.from_xtm10(File.dirname(__FILE__) + "/../../resources/toyTM_xtm10.xtm")
72
+ @test_size = true
43
73
  end
44
74
  it "should provide an alias for from_xtm1" do
45
75
  @tm.method(:from_xtm1).should == @tm.method(:from_xtm10)
@@ -48,19 +78,21 @@ module RTM::IO::TmapiXFrom::TopicMap
48
78
 
49
79
  describe "#from_xtm20" do
50
80
  it "should import into an empty topic map" do
51
- @tm.from_xtm20(File.dirname(__FILE__) + "/../../resources/toyTM.xtm")
81
+ @tm.from_xtm20(File.dirname(__FILE__) + "/../../resources/toyTM_xtm20.xtm")
82
+ @test_size = true
52
83
  end
53
84
  it "should provide an alias for from_xtm2" do
54
85
  @tm.method(:from_xtm2).should == @tm.method(:from_xtm20)
55
86
  end
56
87
  end
57
88
 
58
- describe "#from_xtm" do
59
- it "should import into an empty topic map from xtm v2.0" do
60
- @tm.from_xtm20(File.dirname(__FILE__) + "/../../resources/toyTM.xtm")
89
+ describe "#from_xtm21" do
90
+ it "should import into an empty topic map from xtm v2.1" do
91
+ @tm.from_xtm21(File.dirname(__FILE__) + "/../../resources/toyTM.xtm")
92
+ @test_size = true
61
93
  end
62
- it "should import into an empty topic map from xtm v1.0" do
63
- #@tm.from_xtm10(File.dirname(__FILE__) + "/../../resources/toyTM_xtm10.xtm")
94
+ it "should provide an alias for from_xtm2" do
95
+ @tm.method(:from_xtm).should == @tm.method(:from_xtm20)
64
96
  end
65
97
  end
66
98
 
@@ -13,9 +13,33 @@ module RTM::IO::TmapiXTo::TopicMap
13
13
  @tm.close
14
14
  end
15
15
 
16
+ describe "#to_xtm21" do
17
+ before(:each) do
18
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
19
+ end
20
+ it "should serialize a topic map to String" do
21
+ @tm.to_xtm21.should be_a_kind_of String
22
+ end
23
+ it "should serialize a topic map to a file" do
24
+ @tm.to_xtm21(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.xtm21").should be_true
25
+ end
26
+ it "should serialize a topic map to a file given a base iri" do
27
+ @tm.to_xtm21(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.xtm20", "http://www.example.org/testtm").should be_true
28
+ end
29
+ it "should serialize a topic map to a Java::JavaIo::Stream" do
30
+ @tm.to_xtm21(Java::JavaIo::ByteArrayOutputStream.new).should be_true
31
+ end
32
+ it "should be the case that the xtm21 writer does not respond to :setProperty" do
33
+ Java::OrgTmapixIo::XTM2TopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm",Java::OrgTmapixIo::XTMVersion::XTM_2_1).should_not respond_to(:setProperty)
34
+ end
35
+ it "should provide an alias for to_xtm" do
36
+ @tm.method(:to_xtm).should == @tm.method(:to_xtm21)
37
+ end
38
+ end
39
+
16
40
  describe "#to_xtm20" do
17
41
  before(:each) do
18
- @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
42
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
19
43
  end
20
44
  it "should serialize a topic map to String" do
21
45
  @tm.to_xtm20.should be_a_kind_of String
@@ -30,10 +54,7 @@ module RTM::IO::TmapiXTo::TopicMap
30
54
  @tm.to_xtm20(Java::JavaIo::ByteArrayOutputStream.new).should be_true
31
55
  end
32
56
  it "should be the case that the xtm20 writer does not respond to :setProperty" do
33
- Java::OrgTmapixIo::XTM20TopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
34
- end
35
- it "should provide an alias for to_xtm" do
36
- @tm.method(:to_xtm).should == @tm.method(:to_xtm20)
57
+ Java::OrgTmapixIo::XTM2TopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm",Java::OrgTmapixIo::XTMVersion::XTM_2_1).should_not respond_to(:setProperty)
37
58
  end
38
59
  it "should provide an alias for to_xtm2" do
39
60
  @tm.method(:to_xtm2).should == @tm.method(:to_xtm20)
@@ -42,7 +63,7 @@ module RTM::IO::TmapiXTo::TopicMap
42
63
 
43
64
  describe "#to_xtm10" do
44
65
  before(:each) do
45
- @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
66
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
46
67
  end
47
68
  it "should serialize a topic map to String" do
48
69
  @tm.to_xtm10.should be_a_kind_of String
@@ -66,7 +87,7 @@ module RTM::IO::TmapiXTo::TopicMap
66
87
 
67
88
  describe "#to_jtm" do
68
89
  before(:each) do
69
- @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
90
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
70
91
  end
71
92
  it "should serialize a topic map to String" do
72
93
  @tm.to_jtm.should be_a_kind_of String
@@ -83,14 +104,16 @@ module RTM::IO::TmapiXTo::TopicMap
83
104
  it "should be the case that the jtm writer does not respond to :setProperty" do
84
105
  Java::OrgTmapixIo::JTMTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
85
106
  end
86
- it "should provide an alias for to_json" do
87
- @tm.method(:to_json).should == @tm.method(:to_jtm)
107
+ unless implementation_for_spec == :couchtm
108
+ it "should provide an alias for to_json" do
109
+ @tm.method(:to_json).should == @tm.method(:to_jtm)
110
+ end
88
111
  end
89
112
  end
90
113
 
91
114
  describe "#to_ltm" do
92
115
  before(:each) do
93
- @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
116
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
94
117
  end
95
118
  it "should serialize a topic map to String" do
96
119
  @tm.to_ltm.should be_a_kind_of String
@@ -109,30 +132,30 @@ module RTM::IO::TmapiXTo::TopicMap
109
132
  end
110
133
  end
111
134
 
112
- # describe "#to_tmxml" do
113
- # before(:each) do
114
- # @tm.from_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM.tmxml")
115
- # end
116
- # it "should serialize a topic map to String" do
117
- # @tm.to_tmxml.should be_a_kind_of String
118
- # end
119
- # it "should serialize a topic map to a file" do
120
- # @tm.to_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.tmxml").should be_true
121
- # end
122
- # it "should serialize a topic map to a file given a base iri" do
123
- # @tm.to_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.tmxml", "http://www.example.org/testtm").should be_true
124
- # end
125
- # it "should serialize a topic map to a Java::JavaIo::Stream" do
126
- # @tm.to_tmxml(Java::JavaIo::ByteArrayOutputStream.new).should be_true
127
- # end
128
- # it "should be the case that the tmxml writer does not respond to :setProperty" do
129
- # Java::OrgTmapixIo::TMXMLTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
130
- # end
131
- # end
135
+ describe "#to_tmxml" do
136
+ before(:each) do
137
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
138
+ end
139
+ it "should serialize a topic map to String" do
140
+ @tm.to_tmxml.should be_a_kind_of String
141
+ end
142
+ it "should serialize a topic map to a file" do
143
+ @tm.to_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.tmxml").should be_true
144
+ end
145
+ it "should serialize a topic map to a file given a base iri" do
146
+ @tm.to_tmxml(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.tmxml", "http://www.example.org/testtm").should be_true
147
+ end
148
+ it "should serialize a topic map to a Java::JavaIo::Stream" do
149
+ @tm.to_tmxml(Java::JavaIo::ByteArrayOutputStream.new).should be_true
150
+ end
151
+ it "should be the case that the tmxml writer does not respond to :setProperty" do
152
+ Java::OrgTmapixIo::TMXMLTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
153
+ end
154
+ end
132
155
 
133
- describe "#to_ctm" do
156
+ describe "#to_jtm" do
134
157
  before(:each) do
135
- @tm.from_xtm(File.dirname(__FILE__) + "/../../resources/toyTM.xtm")
158
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
136
159
  end
137
160
  it "should serialize a topic map to String" do
138
161
  @tm.to_ctm.should be_a_kind_of String
@@ -151,6 +174,9 @@ module RTM::IO::TmapiXTo::TopicMap
151
174
  end
152
175
  it "should read it afterwards" do
153
176
  emptyTM = get_used_tm_sys.create("http://blub.org/")
177
+ if implementation_for_spec == :majortom_db
178
+ emptyTM.clear
179
+ end
154
180
  emptyTM.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.ctm")
155
181
  end
156
182
  end
@@ -8,7 +8,7 @@ module RTM::IO::ToRDF::TopicMap
8
8
  describe self do
9
9
  before(:each) do
10
10
  @tm = get_used_tm_sys_tm
11
- @tm.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM.ctm")
11
+ @tm.from_jtm(File.dirname(__FILE__) + "/../../resources/toyTM.jtm")
12
12
  end
13
13
  after(:each) do
14
14
  @tm.close
@@ -17,8 +17,10 @@ module RTM::IO::ToRDF::TopicMap
17
17
  describe "#to_rdf" do
18
18
  it "should be callable on an Ontopia topic map" do
19
19
  if implementation_for_spec == :ontopia
20
- lambda{@tm.to_rdf}.should_not raise_error
21
- @tm.to_rdf.should be_a_kind_of String
20
+ pending "should fail wihtout lucene" do
21
+ lambda{@tm.to_rdf}.should_not raise_error
22
+ @tm.to_rdf.should be_a_kind_of String
23
+ end
22
24
  else
23
25
  lambda{@tm.to_rdf}.should raise_error
24
26
  end
@@ -28,7 +30,9 @@ module RTM::IO::ToRDF::TopicMap
28
30
  describe "#to_rdf_ontopia" do
29
31
  it "should be callable on an Ontopia topic map" do
30
32
  if implementation_for_spec == :ontopia
31
- @tm.to_rdf_ontopia.should be_a_kind_of String
33
+ pending "should fail wihtout lucene" do
34
+ @tm.to_rdf_ontopia.should be_a_kind_of String
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -6,28 +6,27 @@ require File.dirname(__FILE__) + '/../spec_helper'
6
6
  module RTM
7
7
 
8
8
  describe "JavaTMAPI" do
9
+ before(:each) do
10
+ @base_iri = "http://www.exampl.org/test/"
11
+ @engine = get_used_tm_sys
12
+ @tm = @engine.create(@base_iri)
13
+ end
9
14
 
10
15
  describe "#create" do
11
16
  it "should give always give back the same topic map" do
12
- tm_identifier = "http://www.exampl.org/test/"
13
- engine = RTM.connect(:implementation => implementation_for_spec)
14
- tm = engine.create(tm_identifier)
15
17
  1000.times do
16
- tm_other = engine.create(tm_identifier)
17
- tm_other.should == tm
18
+ tm_other = @engine.create(@base_iri)
19
+ tm_other.should == @tm
18
20
  tm_other.engine.should_not be_nil
19
21
  tm_other.prefixes.should_not be_empty
20
22
  end
21
23
  end
22
- it "should raise an error if topic map identifier is relative" do
23
- tm_identifier = "www.exampl.org/test/"
24
- engine = RTM.connect(:implementation => implementation_for_spec)
24
+ it "should raise an error if the topic map base_iri is relative" do
25
+ rel_base_iri = "www.exampl.org/test/"
25
26
  if implementation_for_spec == :tinytim
26
- pending do
27
- lambda{engine.create(tm_identifier)}.should raise_error
28
- end
27
+ lambda{@engine.create(rel_base_iri)}.should_not raise_error
29
28
  else
30
- lambda{engine.create(tm_identifier)}.should raise_error
29
+ lambda{@engine.create(rel_base_iri)}.should raise_error
31
30
  end
32
31
  end
33
32
  it "should be tested"
@@ -35,30 +34,41 @@ module RTM
35
34
 
36
35
  describe "#delete" do
37
36
  it "should delete a topic map" do
38
- tm_identifier = "http://www.exampl.org/test/"
39
- engine = RTM.connect(:implementation => implementation_for_spec)
40
- tm = engine.create(tm_identifier)
41
- tm.should be_a_kind_of RTM::TopicMap
42
- tm.create_topic
43
- tm.create_association(tm.create_topic)
44
- engine.tms.getTopicMap(tm_identifier).should_not be_nil
45
- engine.delete(tm_identifier)
46
- engine.tms.getTopicMap(tm_identifier).should be_nil
37
+ @tm.should be_a_kind_of RTM::TopicMap
38
+ @tm.create_topic
39
+ @tm.create_association(@tm.create_topic)
40
+ @engine.tms.getTopicMap(@base_iri).should_not be_nil
41
+ @engine.delete(@base_iri)
42
+ @engine.tms.getTopicMap(@base_iri).should be_nil
43
+ end
44
+ it "should delete the toyTM" do
45
+ @tm.from_xtm(File.dirname(__FILE__) + "/../resources/toyTM.xtm")
46
+ @engine.delete(@base_iri)
47
47
  end
48
48
  end
49
49
 
50
50
  describe "#existing?" do
51
51
  it "should tell if the map is existing" do
52
- tm_identifier = "http://www.exampl.org/test/"
53
- engine = RTM.connect(:implementation => implementation_for_spec)
54
- engine.existing?(tm_identifier).should_not be_true
55
- tm = engine.create(tm_identifier)
56
- engine.existing?(tm_identifier).should be_true
57
- engine.delete(tm_identifier)
58
- engine.existing?(tm_identifier).should_not be_true
52
+ @engine.existing?("http://not.existing").should_not be_true
53
+ @engine.existing?(@base_iri).should be_true
54
+ @engine.delete(@base_iri)
55
+ @engine.existing?(@base_iri).should_not be_true
59
56
  end
60
57
  end
61
-
58
+
59
+ describe "#topic_map" do
60
+ it "should return nil if no topic map exists with the given base_iri" do
61
+ @engine.topic_map("http://not.existing").should be_nil
62
+ @engine.topic_map(@engine.create_locator("http://also.not.existing")).should be_nil
63
+ end
64
+ it "should return the topic map if it is existing" do
65
+ tm = @engine.topic_map(@base_iri)
66
+ tm.should == @tm
67
+ tm.engine.should_not be_nil
68
+ tm.prefixes.should_not be_empty
69
+ end
70
+ end
71
+
62
72
  end # of describe self
63
73
 
64
74
  end
@@ -20,7 +20,6 @@ module RTM::Navigation::Topic
20
20
  topic.characteristics.size.should == 0
21
21
  occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
22
22
  topic.characteristics("super_Gruendungsjahr").size.should == 0
23
- topic.characteristics("super_Gruendungsjahr").include?(occ1).should be_false
24
23
  end
25
24
  it "should give back the values of the Names and Occurrences included in Characteristics" do
26
25
  topic = @tm.create_topic_by("Uni_Leipzig")
@@ -31,21 +30,17 @@ module RTM::Navigation::Topic
31
30
  topic.characteristics.size.should == 4
32
31
  topic.characteristics.should include name1, name2, occ1, occ2
33
32
  end
34
-
35
- it "should give back Names and Occurrences of the subtype of the given argument" do
36
- topic = @tm.create_topic_by("Uni_Leipzig")
37
- name1 = topic.create_name("a_type","Universität Leipzig")
38
- @tm.get("a_type").add_supertype("a_super_type")
39
- topic.names.size.should == 1
40
- topic.names.first.type.should == @tm.get("a_type")
41
- topic.names.first.type.supertypes.size.should == 1
42
- topic.names.first.type.supertypes.first.should == @tm.get("a_super_type")
43
- topic.characteristics("a_super_type").size.should == 1
44
- topic.characteristics("a_super_type").include?(name1).should be_true
45
- occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
46
- @tm.get("Gruendungsjahr").add_supertype("super_Gruendungsjahr")
47
- topic.characteristics("super_Gruendungsjahr").size.should == 1
48
- topic.characteristics("super_Gruendungsjahr").include?(occ1).should be_true
33
+
34
+ it "should give back Names and Occurrences with a type of the subtype of the given argument" do
35
+ topic = @tm.get!("Uni_Leipzig")
36
+ name = topic.create_name("university name", "Universität Leipzig")
37
+ @tm.get!("name").add_subtype("university name")
38
+ topic.characteristics("name").size.should == 1
39
+ topic.characteristics("name").should include(name)
40
+ occ = topic.create_occurrence("Gruendungsjahr", "1409")
41
+ @tm.get!("Jahr").add_subtype("Gruendungsjahr")
42
+ topic.characteristics("Jahr").size.should == 1
43
+ topic.characteristics("Jahr").should include(occ)
49
44
  end
50
45
 
51
46
  end #of describe "#characteristics"