rtm 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/DISCLAIMER +3 -1
- data/README +0 -0
- data/lib/rtm.rb +0 -1
- data/lib/rtm/axes/topic.rb +0 -3
- data/lib/rtm/axes/topics.rb +0 -3
- data/lib/rtm/connection.rb +4 -4
- data/lib/rtm/engine.rb +6 -5
- data/lib/rtm/extensions.rb +1 -1
- data/lib/rtm/helpers/no_output.rb +1 -1
- data/lib/rtm/io/from_xtm2_libxml.rb +2 -2
- data/lib/rtm/io/tmapix_from.rb +11 -24
- data/lib/rtm/io/tmapix_to.rb +38 -7
- data/lib/rtm/navigation/topic/characteristics.rb +7 -9
- data/lib/rtm/navigation/topic/supertypes.rb +1 -5
- data/lib/rtm/sugar.rb +16 -1
- data/lib/rtm/sugar/association/remove.rb +21 -0
- data/lib/rtm/sugar/name/remove.rb +18 -0
- data/lib/rtm/sugar/occurrence/external.rb +1 -0
- data/lib/rtm/sugar/occurrence/remove.rb +15 -0
- data/lib/rtm/sugar/topic/remove.rb +23 -0
- data/lib/rtm/sugar/topic/topic_ref.rb +111 -7
- data/lib/rtm/sugar/topic_map/readable.rb +19 -0
- data/lib/rtm/sugar/topic_map/remove.rb +15 -6
- data/lib/rtm/sugar/topic_map/resolve.rb +44 -0
- data/lib/rtm/sugar/topic_map/scoped.rb +42 -0
- data/lib/rtm/sugar/topic_map/types.rb +46 -0
- data/lib/rtm/sugar/variant/remove.rb +15 -0
- data/lib/rtm/version.rb +1 -2
- data/spec/rtm/axes/topic_spec.rb +4 -4
- data/spec/rtm/axes/topics_spec.rb +4 -4
- data/spec/rtm/engine_spec.rb +10 -1
- data/spec/rtm/io/tmapix_from_spec.rb +41 -9
- data/spec/rtm/io/tmapix_to_spec.rb +58 -32
- data/spec/rtm/io/to_rdf_spec.rb +8 -4
- data/spec/rtm/javatmapi_spec.rb +39 -29
- data/spec/rtm/navigation/topic/characteristics_spec.rb +11 -16
- data/spec/rtm/navigation/topic/supertypes_spec.rb +32 -89
- data/spec/rtm/navigation/topic_spec.rb +4 -4
- data/spec/rtm/sugar/association/hash_access_spec.rb +1 -1
- data/spec/rtm/sugar/topic/counterparts_spec.rb +18 -2
- data/spec/rtm/sugar/topic/remove_spec.rb +46 -0
- data/spec/rtm/sugar/topic/topic_ref_spec.rb +99 -26
- data/spec/rtm/sugar/topic_map/readable_spec.rb +25 -0
- data/spec/rtm/sugar/topic_map/remove_spec.rb +4 -1
- data/spec/rtm/sugar/topic_map/resolve_spec.rb +56 -0
- data/spec/rtm/sugar/topic_map/types_spec.rb +31 -0
- data/spec/rtm/tmapi/core/reifiable_spec.rb +0 -1
- data/spec/rtm/tmapi/core/topic_map_spec.rb +13 -8
- data/spec/rtm/tmapi/core/topic_spec.rb +17 -6
- data/spec/rtm/tmapi_spec.rb +2 -2
- data/spec/rtm_spec.rb +3 -3
- data/spec/spec_helper.rb +34 -6
- data/test/javalibs/junit-4.8.1.jar +0 -0
- data/test/javalibs/tmapi-tests-2.0.3-SNAPSHOT.jar +0 -0
- metadata +175 -165
- data/test/javalibs/junit-4.5.jar +0 -0
- data/test/javalibs/tmapi-2.0-tests.jar +0 -0
@@ -8,8 +8,14 @@ module RTM::Navigation::Topic
|
|
8
8
|
before(:each) do
|
9
9
|
@tms = get_used_tm_sys
|
10
10
|
@tm_empty = @tms.create("http://rtm.topicmapslab.de/spec/rtm/axes/navigation/supertypes/empty")
|
11
|
+
if implementation_for_spec == :majortom_db
|
12
|
+
@tm_empty.clear
|
13
|
+
end
|
11
14
|
@topic1 = @tm_empty.get!("topic1") #lonely Topic
|
12
15
|
@tm = @tms.create("http://rtm.topicmapslab.de/spec/rtm/axes/navigation/supertypes/tm")
|
16
|
+
if implementation_for_spec == :majortom_db
|
17
|
+
@tm.clear
|
18
|
+
end
|
13
19
|
@t_lebewesen = @tm.get!("Lebewesen")
|
14
20
|
@t_tier = @tm.get!("Tier")
|
15
21
|
@t_affe = @tm.get!("Affe")
|
@@ -27,8 +33,6 @@ module RTM::Navigation::Topic
|
|
27
33
|
@assoc4 = @tm.create_association(@t_super_sub)
|
28
34
|
@assoc5 = @tm.create_association(@t_super_sub)
|
29
35
|
@assoc6 = @tm.create_association(@t_super_sub)
|
30
|
-
@assoc7 = @tm.create_association(@t_super_sub)
|
31
|
-
@assoc8 = @tm.create_association(@t_super_sub)
|
32
36
|
@assoc1.create_role(@t_sub,@t_mensch)
|
33
37
|
@assoc1.create_role(@t_super,@t_saeuger)
|
34
38
|
@assoc2.create_role(@t_sub,@t_saeuger)
|
@@ -39,12 +43,6 @@ module RTM::Navigation::Topic
|
|
39
43
|
@assoc4.create_role(@t_super,@t_tier)
|
40
44
|
@assoc5.create_role(@t_sub,@t_tier)
|
41
45
|
@assoc5.create_role(@t_super,@t_lebewesen)
|
42
|
-
@assoc6.create_role(@t_sub,@t_lebewesen)
|
43
|
-
@assoc6.create_role(@t_sub,@t_noch_anders)
|
44
|
-
@assoc6.create_role(@t_super,@t_etwas)
|
45
|
-
@assoc6.create_role(@t_super,@t_etwas_anderes)
|
46
|
-
@assoc7.create_role(@t_sub,@t_tier)
|
47
|
-
@assoc8.create_role(@t_super,@t_mensch)
|
48
46
|
end
|
49
47
|
after(:each) do
|
50
48
|
@tm_empty.close
|
@@ -63,19 +61,13 @@ module RTM::Navigation::Topic
|
|
63
61
|
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
64
62
|
end
|
65
63
|
it "should give back the direct supertypes" do
|
64
|
+
@t_mensch.should have(1).direct_supertypes
|
65
|
+
@t_mensch.direct_supertypes.should include @t_saeuger
|
66
66
|
@t_saeuger.should have(1).direct_supertypes
|
67
67
|
@t_saeuger.direct_supertypes.should include @t_tier
|
68
68
|
@t_affe.should have(2).direct_supertypes
|
69
69
|
@t_affe.direct_supertypes.should include @t_saeuger, @t_tier
|
70
70
|
end
|
71
|
-
it "should not give back direct supertypes that are not part of a binary association" do
|
72
|
-
@t_lebewesen.direct_supertypes.should be_empty
|
73
|
-
end
|
74
|
-
it "should handle unary associations" do
|
75
|
-
@t_tier.should have(1).direct_supertypes
|
76
|
-
@t_mensch.should have(1).direct_supertypes
|
77
|
-
end
|
78
|
-
|
79
71
|
end
|
80
72
|
|
81
73
|
describe "#direct_subtypes" do
|
@@ -96,13 +88,6 @@ module RTM::Navigation::Topic
|
|
96
88
|
@t_lebewesen.should have(1).direct_subtypes
|
97
89
|
@t_lebewesen.direct_subtypes.should include @t_tier
|
98
90
|
end
|
99
|
-
it "should not give back direct supertypes that are not part of a binary association" do
|
100
|
-
@t_etwas.direct_subtypes.should be_empty
|
101
|
-
end
|
102
|
-
it "should handle unary associations" do
|
103
|
-
@t_tier.should have(2).direct_subtypes
|
104
|
-
@t_mensch.direct_subtypes.should be_empty
|
105
|
-
end
|
106
91
|
end
|
107
92
|
|
108
93
|
describe "#transitive_supertypes" do
|
@@ -129,9 +114,6 @@ module RTM::Navigation::Topic
|
|
129
114
|
@t_tier.transitive_supertypes.should include @t_lebewesen
|
130
115
|
@t_lebewesen.transitive_supertypes.should be_empty
|
131
116
|
end
|
132
|
-
it "should not give back transitive supertypes that are not part of a binary association" do
|
133
|
-
@t_noch_anders.transitive_supertypes.should be_empty
|
134
|
-
end
|
135
117
|
end
|
136
118
|
|
137
119
|
describe "#transitive_subtypes" do
|
@@ -157,9 +139,6 @@ module RTM::Navigation::Topic
|
|
157
139
|
@t_lebewesen.should have(4).transitive_subtypes
|
158
140
|
@t_lebewesen.transitive_subtypes.should include @t_tier, @t_saeuger, @t_affe, @t_mensch
|
159
141
|
end
|
160
|
-
it "should not give back transitive subtypes that are not part of a binary association" do
|
161
|
-
@t_etwas_anderes.transitive_subtypes.should be_empty
|
162
|
-
end
|
163
142
|
end
|
164
143
|
|
165
144
|
describe "#add_supertype" do
|
@@ -169,7 +148,7 @@ module RTM::Navigation::Topic
|
|
169
148
|
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
170
149
|
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
171
150
|
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
172
|
-
@
|
151
|
+
@topic1.add_supertype("topic2")
|
173
152
|
end
|
174
153
|
it "should create the typing topics if not present" do
|
175
154
|
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
@@ -190,21 +169,10 @@ module RTM::Navigation::Topic
|
|
190
169
|
end
|
191
170
|
it "should create a supertype_subtype association" do
|
192
171
|
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
193
|
-
@assoc.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
194
172
|
end
|
195
173
|
it "should create a supertype_subtype association with exactly two roles" do
|
196
174
|
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
197
175
|
end
|
198
|
-
it "should return the created supertype_subtype association" do
|
199
|
-
@assoc.should be_a_kind_of RTM::Association
|
200
|
-
end
|
201
|
-
it "should create a second association even if a supertype is set which already _is_ a supertype of this Topic, but direct_supertypes should return unique Array" do
|
202
|
-
@assoc2 = @topic1.add_supertype("topic2")
|
203
|
-
@assoc2.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
204
|
-
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 2
|
205
|
-
@tm_empty.get("topic2").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 2
|
206
|
-
@topic1.should have(1).direct_supertypes
|
207
|
-
end
|
208
176
|
end
|
209
177
|
|
210
178
|
describe "#add_subtype" do
|
@@ -214,7 +182,7 @@ module RTM::Navigation::Topic
|
|
214
182
|
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
215
183
|
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
216
184
|
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
217
|
-
@
|
185
|
+
@topic1.add_subtype("topic0")
|
218
186
|
end
|
219
187
|
it "should create the typing topics if not present" do
|
220
188
|
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
@@ -235,21 +203,10 @@ module RTM::Navigation::Topic
|
|
235
203
|
end
|
236
204
|
it "should create a supertype_subtype association" do
|
237
205
|
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
238
|
-
@assoc.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
239
206
|
end
|
240
207
|
it "should create a supertype_subtype association with exactly two roles" do
|
241
208
|
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
242
209
|
end
|
243
|
-
it "should return the created supertype_subtype association" do
|
244
|
-
@assoc.should be_a_kind_of RTM::Association
|
245
|
-
end
|
246
|
-
it "should create a second association even if a subtype is set which already _is_ a subtype of this Topic, but direct_subtypes should return unique Array" do
|
247
|
-
@assoc2 = @topic1.add_subtype("topic0")
|
248
|
-
@assoc2.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
249
|
-
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 2
|
250
|
-
@tm_empty.get("topic0").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 2
|
251
|
-
@topic1.should have(1).direct_subtypes
|
252
|
-
end
|
253
210
|
end
|
254
211
|
|
255
212
|
describe "#add_subtypes" do
|
@@ -259,7 +216,7 @@ module RTM::Navigation::Topic
|
|
259
216
|
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
260
217
|
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
261
218
|
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
262
|
-
@
|
219
|
+
@topic1.add_subtypes("topic2", "topic3")
|
263
220
|
end
|
264
221
|
it "should create the typing topics if not present" do
|
265
222
|
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
@@ -284,19 +241,10 @@ module RTM::Navigation::Topic
|
|
284
241
|
end
|
285
242
|
it "should create supertype_subtype associations" do
|
286
243
|
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
287
|
-
@resulting_assocs.each do |assoc|
|
288
|
-
assoc.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
289
|
-
end
|
290
244
|
end
|
291
245
|
it "should create a supertype_subtype association with exactly two roles" do
|
292
246
|
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
293
247
|
end
|
294
|
-
it "should return the created supertype_subtype association" do
|
295
|
-
@resulting_assocs.should respond_to(:each)
|
296
|
-
@resulting_assocs.each do |result|
|
297
|
-
result.should be_a_kind_of(RTM::Association)
|
298
|
-
end
|
299
|
-
end
|
300
248
|
it "should be tested further"
|
301
249
|
end
|
302
250
|
|
@@ -308,8 +256,8 @@ module RTM::Navigation::Topic
|
|
308
256
|
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
309
257
|
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
310
258
|
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
311
|
-
@
|
312
|
-
end
|
259
|
+
@topic1.add_supertypes("topic2", "topic3")
|
260
|
+
end
|
313
261
|
it "should create the typing topics if not present" do
|
314
262
|
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
315
263
|
@tm_empty.get(RTM::PSI[:supertype]).should_not be_nil
|
@@ -333,42 +281,37 @@ module RTM::Navigation::Topic
|
|
333
281
|
end
|
334
282
|
it "should create supertype_subtype associations" do
|
335
283
|
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
336
|
-
@resulting_assocs.each do |assoc|
|
337
|
-
assoc.type.should == @tm_empty.get(RTM::PSI[:supertype_subtype])
|
338
|
-
end
|
339
284
|
end
|
340
285
|
it "should create a supertype_subtype association with exactly two roles" do
|
341
286
|
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
342
287
|
end
|
343
|
-
it "should return the created supertype_subtype association" do
|
344
|
-
@resulting_assocs.should respond_to(:each)
|
345
|
-
@resulting_assocs.each do |result|
|
346
|
-
result.should be_a_kind_of(RTM::Association)
|
347
|
-
end
|
348
|
-
end
|
349
288
|
it "should be tested further"
|
350
289
|
end
|
351
290
|
|
352
|
-
|
353
|
-
|
354
|
-
|
291
|
+
unless implementation_for_spec == :majortom
|
292
|
+
describe "#supertypes" do
|
293
|
+
it "should call transitive_supertypes" do
|
294
|
+
@topic1.method(:supertypes).should == @topic1.method(:transitive_supertypes)
|
295
|
+
end
|
355
296
|
end
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
297
|
+
describe "#subtypes" do
|
298
|
+
it "should call transitive_subtypes" do
|
299
|
+
@topic1.method(:subtypes).should == @topic1.method(:transitive_subtypes)
|
300
|
+
end
|
360
301
|
end
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
302
|
+
else
|
303
|
+
describe "#transitive_supertypes" do
|
304
|
+
it "should call supertypes" do
|
305
|
+
@topic1.method(:transitive_supertypes).should == @topic1.method(:supertypes)
|
306
|
+
end
|
365
307
|
end
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
308
|
+
describe "#transitive_subtypes" do
|
309
|
+
it "should call transitive_subtypes" do
|
310
|
+
@topic1.method(:transitive_subtypes).should == @topic1.method(:subtypes)
|
311
|
+
end
|
370
312
|
end
|
371
313
|
end
|
314
|
+
|
372
315
|
end
|
373
316
|
end
|
374
317
|
|
@@ -84,8 +84,8 @@ module RTM::Navigation::Topic
|
|
84
84
|
end
|
85
85
|
|
86
86
|
describe "#reverse_subtypes" do
|
87
|
-
it "should be allowed to call" do
|
88
|
-
@methods_array.
|
87
|
+
it "should not be allowed to call" do
|
88
|
+
@methods_array.should_not include("reverse_subtypes")
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -96,8 +96,8 @@ module RTM::Navigation::Topic
|
|
96
96
|
end
|
97
97
|
|
98
98
|
describe "#reverse_supertypes" do
|
99
|
-
it "should be allowed to call" do
|
100
|
-
@methods_array.
|
99
|
+
it "should not be allowed to call" do
|
100
|
+
@methods_array.should_not include("reverse_supertypes")
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -168,13 +168,29 @@ module RTM::Sugar::Topic::Counterparts
|
|
168
168
|
describe "#associations_played" do
|
169
169
|
before(:each) do
|
170
170
|
@tm = get_used_tm_sys_tm
|
171
|
-
@
|
171
|
+
@user1 = @tm.get!("user1")
|
172
|
+
@user2 = @tm.get!("user2")
|
172
173
|
end
|
173
174
|
after(:each) do
|
174
175
|
@tm.close
|
175
176
|
end
|
176
177
|
it "should give back an empty Array if the topic plays in no association" do
|
177
|
-
@
|
178
|
+
@user1.associations_played.should be_empty
|
179
|
+
end
|
180
|
+
describe "it give back all associations of a special kind" do
|
181
|
+
before(:each) do
|
182
|
+
@tm.add_prefix("psi", "http://example.org/psi/")
|
183
|
+
@tm.create_association("psi:Following", "psi:Follower" => "user1", "psi:Followed" => "user2")
|
184
|
+
end
|
185
|
+
it "if atype and rtype are given" do
|
186
|
+
@user1.associations_played(:rtype => "psi:Follower", :atype => "psi:Following").size.should == 1
|
187
|
+
@user2.associations_played(:rtype => "psi:Followed", :atype => "psi:Following").size.should == 1
|
188
|
+
@user1.associations_played(:rtype => "psi:Follower", :atype => "psi:Following").first.type.should == @tm.get("psi:Following")
|
189
|
+
end
|
190
|
+
it "if atype, rtype and oplayer are given" do
|
191
|
+
@user1.associations_played(:rtype => "psi:Follower", :atype => "psi:Following", :oplayer => "user2").size.should == 1
|
192
|
+
|
193
|
+
end
|
178
194
|
end
|
179
195
|
it "should be tested"
|
180
196
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
2
|
+
# License: Apache License, Version 2.0
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
5
|
+
|
6
|
+
module RTM::Sugar::Topic::Remove
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@tm.from_jtm(File.dirname(__FILE__) + "/../../../resources/toyTM.jtm")
|
11
|
+
end
|
12
|
+
after(:each) do
|
13
|
+
@tm.close
|
14
|
+
end
|
15
|
+
describe "#force_remove" do
|
16
|
+
it "should remove the topic if it playes in an association" do
|
17
|
+
topic = @tm.get("http://en.wikipedia.org/wiki/Germany")
|
18
|
+
topic.should_not be_nil
|
19
|
+
topic.force_remove
|
20
|
+
end
|
21
|
+
it "should remove the topic if it is an association type" do
|
22
|
+
pending "not implemented yet" do
|
23
|
+
topic = @tm.get("http://en.wikipedia.org/wiki/Neighbouring_Countries")
|
24
|
+
topic.should_not be_nil
|
25
|
+
topic.force_remove
|
26
|
+
end
|
27
|
+
end
|
28
|
+
it "should remove a topic that has a name with a reifier" do
|
29
|
+
topic = @tm.get("http://en.wikipedia.org/wiki/Vienna")
|
30
|
+
topic.should_not be_nil
|
31
|
+
topic.force_remove
|
32
|
+
end
|
33
|
+
it "should remove a topic that has a variant with a reifier" do
|
34
|
+
topic = @tm.get("http://dbpedia.org/resource/Switzerland")
|
35
|
+
topic.should_not be_nil
|
36
|
+
topic.force_remove
|
37
|
+
end
|
38
|
+
it "should remove a topic that has an occurrence with a reifier" do
|
39
|
+
topic = @tm.get("http://dbpedia.org/resource/Belgium")
|
40
|
+
topic.should_not be_nil
|
41
|
+
topic.force_remove
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end #of describe self
|
@@ -30,38 +30,111 @@ module RTM::Sugar::Topic::TopicRef
|
|
30
30
|
@topic_with_si.references.first[0].should == ?h
|
31
31
|
@topic_with_si.references.should include("http://www.topicmapslab.de/uni-berlin")
|
32
32
|
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ":resolve_qnames => :true" do
|
36
|
+
it "should resolve the qnames" do
|
37
|
+
@tm.add_prefix("tml", "http://www.topicmapslab.de/")
|
38
|
+
@topic_with_ii.references(:resolve_qnames => :true).first[0].should == ?^
|
39
|
+
@topic_with_ii.references(:resolve_qnames => :true).should include("^tml:uni-leipzig")
|
40
|
+
@topic_with_sl.references(:resolve_qnames => :true).first[0].should == ?=
|
41
|
+
@topic_with_sl.references(:resolve_qnames => :true).should include("=tml:uni-munich")
|
42
|
+
@topic_with_si.references(:resolve_qnames => :true).first[0].should == ?t
|
43
|
+
@topic_with_si.references(:resolve_qnames => :true).should include("tml:uni-berlin")
|
44
|
+
end
|
45
|
+
it "should resolve the qnames for a topic with many identifiers" do
|
46
|
+
topic = @tm.get!("http://www.example.org/si")
|
47
|
+
topic.add_subject_identifier("http://www.example.net/si")
|
48
|
+
topic.add_item_identifier("http://www.example.org/i i")
|
49
|
+
topic.add_item_identifier("http://www.example.net/i i")
|
50
|
+
topic.add_subject_locator("http://www.example.org/there#sl")
|
51
|
+
topic.add_subject_locator("http://www.example.net/sl")
|
52
|
+
@tm.add_prefix("example", "http://www.example.org/")
|
53
|
+
topic.references(:outputstyle => :yaml, :resolve_qnames => :true).size.should == 6
|
54
|
+
topic.references(:outputstyle => :yaml, :resolve_qnames => :true).should include("si:example:si", "si:http://www.example.net/si", "ii:example:i i", "ii:http://www.example.net/i i", "sl:example:there#sl", "sl:http://www.example.net/sl")
|
55
|
+
end
|
56
|
+
end
|
33
57
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
58
|
+
describe "#unresolve" do
|
59
|
+
it "should unresolve an iri that starts with the base iri of the parent topic map" do
|
60
|
+
topic = @tm.get!("Leipzig")
|
61
|
+
identifier = "http://www.topicmapslab.de/Leipzig"
|
62
|
+
topic.reference.should == identifier
|
63
|
+
topic.unresolve(identifier).should == "Leipzig"
|
64
|
+
end
|
65
|
+
it "should not raise an error"
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "questioning identifiers with" do
|
69
|
+
before(:each) do
|
70
|
+
@tm.add_prefix("test","http://example.com/test/")
|
71
|
+
@topic = @tm.get!("relativ_si")
|
72
|
+
@topic.add_si("http://example.org/absolute_si")
|
73
|
+
@topic.add_si("test:test_prefix_si")
|
74
|
+
@topic.add_sl("relativs_sl")
|
75
|
+
@topic.add_sl("http://example.org/absolute_sl")
|
76
|
+
@topic.add_sl("test:test_prefix_sl")
|
77
|
+
@topic.add_ii("relativs_ii")
|
78
|
+
@topic.add_ii("http://example.org/absolute_ii")
|
79
|
+
@topic.add_ii("test:test_prefix_il")
|
80
|
+
end
|
81
|
+
describe "#has_si?" do
|
82
|
+
it "shoud give back true if the topic has the given subject identifier" do
|
83
|
+
@topic_with_si.has_si?("http://www.topicmapslab.de/uni-berlin").should be_true
|
84
|
+
|
85
|
+
end
|
86
|
+
describe "if the topic does not have the given identifier" do
|
87
|
+
it "should give back false" do
|
88
|
+
@topic_with_ii.has_si?("http://www.topicmapslab.de/uni-berlin").should be_false
|
89
|
+
@topic_with_sl.has_si?("http://www.topicmapslab.de/uni-berlin").should be_false
|
90
|
+
end
|
91
|
+
describe "and also if this identifier is an item identifier" do
|
92
|
+
it "should give back false" do
|
93
|
+
@topic_with_ii.has_si?("http://www.topicmapslab.de/uni-leipzig").should be_false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
describe "and also if this identifier is a suject locator" do
|
97
|
+
it "should give back false" do
|
98
|
+
@topic_with_sl.has_si?("http://www.topicmapslab.de/uni-munich").should be_false
|
99
|
+
end
|
100
|
+
end
|
43
101
|
end
|
44
|
-
it "should resolve
|
45
|
-
topic
|
46
|
-
topic.
|
47
|
-
topic.add_item_identifier("http://www.example.org/i i")
|
48
|
-
topic.add_item_identifier("http://www.example.net/i i")
|
49
|
-
topic.add_subject_locator("http://www.example.org/there#sl")
|
50
|
-
topic.add_subject_locator("http://www.example.net/sl")
|
51
|
-
@tm.add_prefix("example", "http://www.example.org/")
|
52
|
-
topic.references(:outputstyle => :yaml, :resolve_qnames => :true).size.should == 6
|
53
|
-
topic.references(:outputstyle => :yaml, :resolve_qnames => :true).should include("si:example:si", "si:http://www.example.net/si", "ii:example:i i", "ii:http://www.example.net/i i", "sl:example:there#sl", "sl:http://www.example.net/sl")
|
102
|
+
it "should resolve prefixes" do
|
103
|
+
@topic.has_si?("http://example.com/test/test_prefix_si").should be_true
|
104
|
+
@topic.has_si?("test:test_prefix_si").should be_true
|
54
105
|
end
|
106
|
+
|
107
|
+
it "should be tested"
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "#has_ii?" do
|
111
|
+
it "should be tested"
|
55
112
|
end
|
56
113
|
|
57
|
-
describe "#
|
58
|
-
it "should
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
114
|
+
describe "#has_sl?" do
|
115
|
+
it "should be tested"
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "#has_type_with_si?" do
|
119
|
+
it "should give back true if the si belongs to a type of the topic and false otherwise" do
|
120
|
+
instance = @tm.get!("Instance")
|
121
|
+
instance.add_type(@topic)
|
122
|
+
instance.add_type("something")
|
123
|
+
instance.has_type_with_si?("http://example.org/absolute_si").should be_true
|
124
|
+
instance.has_type_with_si?("test:test_prefix_si").should be_true
|
125
|
+
instance.has_type_with_si?("http://example.org/absolute_sl").should be_false
|
126
|
+
instance.has_type_with_si?("http://example.org/absolute_ii").should be_false
|
63
127
|
end
|
64
|
-
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "#has_type_with_ii?" do
|
131
|
+
it "should be tested"
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "#has_type_with_sl?" do
|
136
|
+
it "should be tested"
|
137
|
+
|
65
138
|
end
|
66
139
|
end
|
67
140
|
end #of describe self
|