rtm 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/rtm.rb +23 -95
- data/lib/rtm/connection.rb +51 -0
- data/lib/rtm/engine.rb +29 -18
- data/lib/rtm/extensions.rb +2 -5
- data/lib/rtm/helpers/uri.rb +1 -1
- data/lib/rtm/io/tmapix_from.rb +8 -8
- data/lib/rtm/io/tmapix_to.rb +6 -6
- data/lib/rtm/io/to_rdf.rb +1 -1
- data/lib/rtm/io/to_string.rb +22 -14
- data/lib/rtm/navigation/topic/supertypes.rb +2 -2
- data/lib/rtm/navigation/topic/types.rb +1 -1
- data/lib/rtm/psi.rb +3 -1
- data/lib/rtm/sugar.rb +8 -3
- data/lib/rtm/sugar/topic/best_name.rb +31 -50
- data/lib/rtm/sugar/topic/scoped.rb +9 -9
- data/lib/rtm/sugar/topic/topic_ref.rb +115 -72
- data/lib/rtm/sugar/topic_map/remove.rb +49 -0
- data/lib/rtm/sugar/topic_map/{themes.rb → scoped.rb} +9 -10
- data/lib/rtm/sugar/topic_map/types.rb +50 -0
- data/lib/rtm/sugar/variant/topic.rb +17 -0
- data/lib/rtm/topology.rb +134 -0
- data/lib/rtm/version.rb +13 -8
- data/spec/rtm/engine_spec.rb +45 -0
- data/spec/rtm/io/tmapix_from_spec.rb +8 -8
- data/spec/rtm/io/tmapix_to_spec.rb +38 -38
- data/spec/rtm/io/to_yaml_spec.rb +7 -0
- data/spec/rtm/javatmapi_spec.rb +64 -0
- data/spec/rtm/navigation/topic/scope_spec.rb +1 -1
- data/spec/rtm/sugar/topic/best_name_spec.rb +54 -2
- data/spec/rtm/sugar/topic/topic_ref_spec.rb +59 -35
- data/spec/rtm/sugar/topic_map/remove_spec.rb +50 -0
- data/spec/rtm/sugar/topic_map/{themes_spec.rb → scoped_spec.rb} +1 -1
- data/spec/rtm/sugar/topic_map/types_spec.rb +34 -0
- data/spec/rtm/sugar/variant/topic_spec.rb +28 -0
- data/spec/rtm/tmapi/core/name_spec.rb +1 -7
- data/spec/rtm/tmapi/core/topic_map_spec.rb +103 -51
- data/spec/rtm/tmapi/core/topic_spec.rb +3 -0
- data/spec/rtm_spec.rb +3 -12
- data/test/javalibs/tmapi-2.0-tests.jar +0 -0
- metadata +26 -9
@@ -26,11 +26,11 @@ module RTM::IO::TmapiXTo::TopicMap
|
|
26
26
|
it "should serialize a topic map to a file given a base iri" do
|
27
27
|
@tm.to_xtm20(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.xtm20", "http://www.example.org/testtm").should be_true
|
28
28
|
end
|
29
|
-
it "should serialize a topic map to a
|
30
|
-
@tm.to_xtm20(
|
29
|
+
it "should serialize a topic map to a Java::JavaIo::Stream" do
|
30
|
+
@tm.to_xtm20(Java::JavaIo::ByteArrayOutputStream.new).should be_true
|
31
31
|
end
|
32
32
|
it "should be the case that the xtm20 writer does not respond to :setProperty" do
|
33
|
-
|
33
|
+
Java::OrgTmapixIo::XTM20TopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
|
34
34
|
end
|
35
35
|
it "should provide an alias for to_xtm" do
|
36
36
|
@tm.method(:to_xtm).should == @tm.method(:to_xtm20)
|
@@ -53,11 +53,11 @@ module RTM::IO::TmapiXTo::TopicMap
|
|
53
53
|
it "should serialize a topic map to a file given a base iri" do
|
54
54
|
@tm.to_xtm10(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.xtm10", "http://www.example.org/testtm").should be_true
|
55
55
|
end
|
56
|
-
it "should serialize a topic map to a
|
57
|
-
@tm.to_xtm10(
|
56
|
+
it "should serialize a topic map to a Java::JavaIo::Stream" do
|
57
|
+
@tm.to_xtm10(Java::JavaIo::ByteArrayOutputStream.new).should be_true
|
58
58
|
end
|
59
59
|
it "should be the case that the xtm10 writer does not respond to :setProperty" do
|
60
|
-
|
60
|
+
Java::OrgTmapixIo::XTM10TopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
|
61
61
|
end
|
62
62
|
it "should provide an alias for to_xtm1" do
|
63
63
|
@tm.method(:to_xtm1).should == @tm.method(:to_xtm10)
|
@@ -77,13 +77,13 @@ module RTM::IO::TmapiXTo::TopicMap
|
|
77
77
|
it "should serialize a topic map to a file given a base iri" do
|
78
78
|
@tm.to_jtm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.jtm", "http://www.example.org/testtm").should be_true
|
79
79
|
end
|
80
|
-
it "should serialize a topic map to a
|
81
|
-
@tm.to_jtm(
|
80
|
+
it "should serialize a topic map to a Java::JavaIo::Stream" do
|
81
|
+
@tm.to_jtm(Java::JavaIo::ByteArrayOutputStream.new).should be_true
|
82
82
|
end
|
83
|
-
it "should be the case that the
|
84
|
-
|
83
|
+
it "should be the case that the jtm writer does not respond to :setProperty" do
|
84
|
+
Java::OrgTmapixIo::JTMTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
|
85
85
|
end
|
86
|
-
it "should provide an alias
|
86
|
+
it "should provide an alias for to_json" do
|
87
87
|
@tm.method(:to_json).should == @tm.method(:to_jtm)
|
88
88
|
end
|
89
89
|
end
|
@@ -101,34 +101,34 @@ module RTM::IO::TmapiXTo::TopicMap
|
|
101
101
|
it "should serialize a topic map to a file given a base iri" do
|
102
102
|
@tm.to_ltm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.ltm", "http://www.example.org/testtm").should be_true
|
103
103
|
end
|
104
|
-
it "should serialize a topic map to a
|
105
|
-
@tm.to_ltm(
|
104
|
+
it "should serialize a topic map to a Java::JavaIo::Stream" do
|
105
|
+
@tm.to_ltm(Java::JavaIo::ByteArrayOutputStream.new).should be_true
|
106
106
|
end
|
107
|
-
it "should be the case that the
|
108
|
-
|
107
|
+
it "should be the case that the ltm writer does not respond to :setProperty" do
|
108
|
+
Java::OrgTmapixIo::LTMTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should_not respond_to(:setProperty)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
describe "#to_tmxml" do
|
113
|
-
before(:each) do
|
114
|
-
@tm.
|
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
|
126
|
-
@tm.to_tmxml(
|
127
|
-
end
|
128
|
-
it "should be the case that the
|
129
|
-
|
130
|
-
end
|
131
|
-
end
|
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
|
132
132
|
|
133
133
|
describe "#to_ctm" do
|
134
134
|
before(:each) do
|
@@ -143,11 +143,11 @@ module RTM::IO::TmapiXTo::TopicMap
|
|
143
143
|
it "should serialize a topic map to a file given a base iri" do
|
144
144
|
@tm.to_ctm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.ctm", "http://www.example.org/testtm").should be_true
|
145
145
|
end
|
146
|
-
it "should serialize a topic map to a
|
147
|
-
@tm.to_ctm(
|
146
|
+
it "should serialize a topic map to a Java::JavaIo::Stream" do
|
147
|
+
@tm.to_ctm(Java::JavaIo::ByteArrayOutputStream.new).should be_true
|
148
148
|
end
|
149
149
|
it "should be the case that the xtm10 writer does respond to :setProperty" do
|
150
|
-
|
150
|
+
Java::DeTopicmapslabCtmWriterCore::CTMTopicMapWriter.new(Java::JavaIo::ByteArrayOutputStream.new,"http://www.example.org/testtm").should respond_to(:setProperty)
|
151
151
|
end
|
152
152
|
it "should read it afterwards" do
|
153
153
|
emptyTM = get_used_tm_sys.create("http://blub.org/")
|
data/spec/rtm/io/to_yaml_spec.rb
CHANGED
@@ -33,6 +33,7 @@ module RTM::IO::ToYAML
|
|
33
33
|
@tm.should be_a_kind_of RTM::TopicMap
|
34
34
|
end
|
35
35
|
it "should give back a String" do
|
36
|
+
pending
|
36
37
|
@output = @tm.to_yaml
|
37
38
|
end
|
38
39
|
end
|
@@ -41,6 +42,7 @@ module RTM::IO::ToYAML
|
|
41
42
|
@topic.should be_a_kind_of RTM::Topic
|
42
43
|
end
|
43
44
|
it "should give back a String" do
|
45
|
+
pending
|
44
46
|
@output = @topic.to_yaml
|
45
47
|
end
|
46
48
|
end
|
@@ -49,6 +51,7 @@ module RTM::IO::ToYAML
|
|
49
51
|
@assoc.should be_a_kind_of RTM::Association
|
50
52
|
end
|
51
53
|
it "should give back a String" do
|
54
|
+
pending
|
52
55
|
@output = @assoc.to_yaml
|
53
56
|
end
|
54
57
|
end
|
@@ -57,6 +60,7 @@ module RTM::IO::ToYAML
|
|
57
60
|
@role.should be_a_kind_of RTM::Role
|
58
61
|
end
|
59
62
|
it "should give back a String" do
|
63
|
+
pending
|
60
64
|
@output = @role.to_yaml
|
61
65
|
end
|
62
66
|
end
|
@@ -65,6 +69,7 @@ module RTM::IO::ToYAML
|
|
65
69
|
@name.should be_a_kind_of RTM::Name
|
66
70
|
end
|
67
71
|
it "should give back a String" do
|
72
|
+
pending
|
68
73
|
@output = @name.to_yaml
|
69
74
|
end
|
70
75
|
end
|
@@ -73,6 +78,7 @@ module RTM::IO::ToYAML
|
|
73
78
|
@occ.should be_a_kind_of RTM::Occurrence
|
74
79
|
end
|
75
80
|
it "should give back a String" do
|
81
|
+
pending
|
76
82
|
@output = @occ.to_yaml
|
77
83
|
end
|
78
84
|
end
|
@@ -81,6 +87,7 @@ module RTM::IO::ToYAML
|
|
81
87
|
@var.should be_a_kind_of RTM::Variant
|
82
88
|
end
|
83
89
|
it "should give back a String" do
|
90
|
+
pending
|
84
91
|
@output = @var.to_yaml
|
85
92
|
end
|
86
93
|
end
|
@@ -0,0 +1,64 @@
|
|
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
|
7
|
+
|
8
|
+
describe "JavaTMAPI" do
|
9
|
+
|
10
|
+
describe "#create" do
|
11
|
+
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
|
+
1000.times do
|
16
|
+
tm_other = engine.create(tm_identifier)
|
17
|
+
tm_other.should == tm
|
18
|
+
tm_other.engine.should_not be_nil
|
19
|
+
tm_other.prefixes.should_not be_empty
|
20
|
+
end
|
21
|
+
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)
|
25
|
+
if implementation_for_spec == :tinytim
|
26
|
+
pending do
|
27
|
+
lambda{engine.create(tm_identifier)}.should raise_error
|
28
|
+
end
|
29
|
+
else
|
30
|
+
lambda{engine.create(tm_identifier)}.should raise_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
it "should be tested"
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#delete" do
|
37
|
+
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
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#existing?" do
|
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
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end # of describe self
|
63
|
+
|
64
|
+
end
|
@@ -15,10 +15,62 @@ module RTM::Sugar::Topic::BestName
|
|
15
15
|
describe "#best_name" do
|
16
16
|
before(:each) do
|
17
17
|
@topic = @tm.get!("Leipzig")
|
18
|
+
@topic.add_si("LE")
|
19
|
+
@topic.add_ii("http://example.org/id-10")
|
20
|
+
@topic.add_ii("1")
|
18
21
|
end
|
19
|
-
|
22
|
+
after(:each) do
|
20
23
|
@topic.best_name.should be_a_kind_of String
|
21
|
-
|
24
|
+
end
|
25
|
+
it "should return an identfier if the topic has no name, resolved" do
|
26
|
+
@topic.best_name.should == "LE"
|
27
|
+
end
|
28
|
+
it "should give back the name if the topic has one name" do
|
29
|
+
@topic["-city-name"] = "Leipzig"
|
30
|
+
@topic.best_name.should == "Leipzig"
|
31
|
+
end
|
32
|
+
it "should give back the default name if the topic has several names" do
|
33
|
+
@topic["-city-name"] = "Leipzig"
|
34
|
+
@topic["-"] = "Leipzisch"
|
35
|
+
@topic.best_name.should == "Leipzisch"
|
36
|
+
end
|
37
|
+
it "should give back the default name with the smallest value if the topic has several names" do
|
38
|
+
@topic["-city-name"] = "Leipzig"
|
39
|
+
@topic["-"] = "LE"
|
40
|
+
@topic["-"] = "Leipzisch"
|
41
|
+
@topic.best_name.should == "LE"
|
42
|
+
end
|
43
|
+
it "should give back the default name with the smallest value sorted alphabetically if the topic has several names" do
|
44
|
+
@topic["-city-name"] = "Leipzig"
|
45
|
+
@topic["-"] = "LE"
|
46
|
+
@topic["-"] = "Leipzisch"
|
47
|
+
@topic["-"] = "LA"
|
48
|
+
@topic.best_name.should == "LA"
|
49
|
+
end
|
50
|
+
it "should give back the name with the given theme" do
|
51
|
+
@topic["-city-name name @test_theme"] = "Leipzig"
|
52
|
+
@topic["-"] = "LE"
|
53
|
+
@topic["-"] = "Leipzisch"
|
54
|
+
@topic["-"] = "LA"
|
55
|
+
test_theme = @tm.get("test_theme")
|
56
|
+
test_theme.should_not be_nil
|
57
|
+
@topic.best_name(test_theme).should == "Leipzig"
|
58
|
+
end
|
59
|
+
it "should give back the name with the given theme preferring default names" do
|
60
|
+
@topic["-city-name name @test_theme"] = "Leipzig"
|
61
|
+
@topic["-"] = "LE"
|
62
|
+
@topic["- @test_theme"] = "Leipzisch"
|
63
|
+
@topic["- @test_theme_other"] = "LA"
|
64
|
+
test_theme = @tm.get("test_theme")
|
65
|
+
test_theme.should_not be_nil
|
66
|
+
@topic.best_name(test_theme).should == "Leipzisch"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#shortest_topic_identifier" do
|
71
|
+
it "should give back the shortest most significant identifier in yaml-style" do
|
72
|
+
topic = @tm.get!("LE")
|
73
|
+
topic.shortest_topic_identifier.should == "si:LE"
|
22
74
|
end
|
23
75
|
end
|
24
76
|
end
|
@@ -3,42 +3,66 @@
|
|
3
3
|
|
4
4
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
5
5
|
|
6
|
-
module Sugar
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
module RTM::Sugar::Topic::TopicRef
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic_with_ii = @tm.get!("ii:uni-leipzig")
|
11
|
+
@topic_with_si = @tm.get!("si:uni-berlin")
|
12
|
+
@topic_with_sl = @tm.get!("sl:uni-munich")
|
13
|
+
end
|
14
|
+
after(:each) do
|
15
|
+
@tm.close
|
16
|
+
end
|
17
|
+
describe "#references" do
|
18
|
+
it "should not give back an empty Array" do
|
19
|
+
@topic_with_si.references.should_not be_empty
|
20
|
+
end
|
21
|
+
it "should give back an item identifier that starts with an ^" do
|
22
|
+
@topic_with_ii.references.first[0].should == ?^
|
23
|
+
@topic_with_ii.references.should include("^http://www.topicmapslab.de/uni-leipzig")
|
24
|
+
end
|
25
|
+
it "should give back a subject locator that starts with a ^=" do
|
26
|
+
@topic_with_sl.references.first[0].should == ?=
|
27
|
+
@topic_with_sl.references.should include("=http://www.topicmapslab.de/uni-munich")
|
28
|
+
end
|
29
|
+
it "should give back a subject identifier start does not start with a special character" do
|
30
|
+
@topic_with_si.references.first[0].should == ?h
|
31
|
+
@topic_with_si.references.should include("http://www.topicmapslab.de/uni-berlin")
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ":resolve_qnames => :true" do
|
35
|
+
it "should resolve the qnames" do
|
36
|
+
@tm.add_prefix("tml", "http://www.topicmapslab.de/")
|
37
|
+
@topic_with_ii.references(:resolve_qnames => :true).first[0].should == ?^
|
38
|
+
@topic_with_ii.references(:resolve_qnames => :true).should include("^tml:uni-leipzig")
|
39
|
+
@topic_with_sl.references(:resolve_qnames => :true).first[0].should == ?=
|
40
|
+
@topic_with_sl.references(:resolve_qnames => :true).should include("=tml:uni-munich")
|
41
|
+
@topic_with_si.references(:resolve_qnames => :true).first[0].should == ?t
|
42
|
+
@topic_with_si.references(:resolve_qnames => :true).should include("tml:uni-berlin")
|
13
43
|
end
|
14
|
-
|
15
|
-
@tm.
|
44
|
+
it "should resolve the qnames for a topic with many identifiers" do
|
45
|
+
topic = @tm.get!("http://www.example.org/si")
|
46
|
+
topic.add_subject_identifier("http://www.example.net/si")
|
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")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#unresolve" do
|
58
|
+
it "should unresolve an iri that starts with the base iri of the parent topic map" do
|
59
|
+
topic = @tm.get!("Leipzig")
|
60
|
+
identifier = "http://www.topicmapslab.de/Leipzig"
|
61
|
+
topic.reference.should == identifier
|
62
|
+
topic.unresolve(identifier).should == "Leipzig"
|
16
63
|
end
|
17
|
-
|
18
|
-
|
19
|
-
@topic.references.should_not be_empty
|
20
|
-
end
|
21
|
-
it "should give back an item identifier that starts with a ^" do
|
22
|
-
pending if implementation_for_spec == :ontopia
|
23
|
-
@topic.references.first[0].should == ?^
|
24
|
-
@topic.references.should include("^http://www.topicmapslab.de/uni_leipzig")
|
25
|
-
end
|
26
|
-
it "should give back subject locators also" do
|
27
|
-
pending if implementation_for_spec == :ontopia
|
28
|
-
@topic.addSubjectLocator(@tm.create_locator("uni_leipzig"))
|
29
|
-
@topic.references.size.should == 2
|
30
|
-
@topic.references.should include("^http://www.topicmapslab.de/uni_leipzig")
|
31
|
-
@topic.references.should include("=http://www.topicmapslab.de/uni_leipzig")
|
32
|
-
end
|
33
|
-
it "should give back subject identifiers also" do
|
34
|
-
pending if implementation_for_spec == :ontopia
|
35
|
-
@topic.add_subject_identifier(@tm.create_locator("uni_leipzig"))
|
36
|
-
@topic.references.size.should == 2
|
37
|
-
@topic.references.should include("^http://www.topicmapslab.de/uni_leipzig")
|
38
|
-
@topic.references.should include("http://www.topicmapslab.de/uni_leipzig")
|
39
|
-
end
|
40
|
-
end #of describe "#identifiers"
|
41
|
-
end #of describe self
|
64
|
+
it "should not raise an error"
|
65
|
+
end
|
42
66
|
end
|
43
|
-
end
|
67
|
+
end #of describe self
|
44
68
|
end
|
@@ -0,0 +1,50 @@
|
|
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::TopicMap
|
7
|
+
module Remove
|
8
|
+
describe self do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
@tm.from_xtm(File.dirname(__FILE__) + "/../../../resources/toyTM.xtm")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should respond to remove_everything" do
|
15
|
+
@tm.should respond_to(:clear)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#clear" do
|
19
|
+
before(:each) do
|
20
|
+
@tm.variants.should_not be_empty
|
21
|
+
@tm.names.should_not be_empty
|
22
|
+
@tm.occurrences.should_not be_empty
|
23
|
+
@tm.roles.should_not be_empty
|
24
|
+
@tm.associations.should_not be_empty
|
25
|
+
@tm.topics.should_not be_empty
|
26
|
+
@tm.clear
|
27
|
+
end
|
28
|
+
it "should remove all variants" do
|
29
|
+
@tm.variants.should be_empty
|
30
|
+
end
|
31
|
+
it "should remove all names" do
|
32
|
+
@tm.names.should be_empty
|
33
|
+
end
|
34
|
+
it "should remove all occurrences" do
|
35
|
+
@tm.occurrences.should be_empty
|
36
|
+
end
|
37
|
+
it "should remove all roles" do
|
38
|
+
@tm.roles.should be_empty
|
39
|
+
end
|
40
|
+
it "should remove all associations" do
|
41
|
+
@tm.associations.should be_empty
|
42
|
+
end
|
43
|
+
it "should remove all topics" do
|
44
|
+
@tm.topics.should be_empty
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|