rtm 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/DISCLAIMER +10 -33
- data/LICENSE +201 -0
- data/README +3 -3
- data/lib/rtm.rb +148 -74
- data/lib/rtm/axes.rb +295 -0
- data/lib/rtm/axes/association.rb +76 -0
- data/lib/rtm/axes/associations.rb +96 -0
- data/lib/rtm/axes/assocs_names_occs.rb +56 -0
- data/lib/rtm/axes/characteristic.rb +68 -0
- data/lib/rtm/axes/characteristics.rb +93 -0
- data/lib/rtm/axes/string.rb +76 -0
- data/lib/rtm/axes/strings.rb +87 -0
- data/lib/rtm/axes/topic.rb +233 -0
- data/lib/rtm/axes/topics.rb +280 -0
- data/lib/rtm/{backward_compatibility.rb → deprecated/index_property_set.rb} +3 -0
- data/lib/rtm/engine.rb +58 -0
- data/lib/rtm/extensions.rb +11 -1
- data/lib/rtm/{locator_helpers.rb → helpers/locator.rb} +15 -4
- data/lib/rtm/{helpers.rb → helpers/no_output.rb} +3 -0
- data/lib/rtm/helpers/uri.rb +13 -0
- data/lib/rtm/io.rb +18 -0
- data/lib/rtm/io/from_xtm2_libxml.rb +2 -1
- data/lib/rtm/io/ontopia_io.rb +25 -0
- data/lib/rtm/io/tmapix.rb +234 -0
- data/lib/rtm/io/to_hash.rb +116 -0
- data/lib/rtm/io/to_jtm.rb +53 -103
- data/lib/rtm/io/to_rdf.rb +30 -0
- data/lib/rtm/io/to_string.rb +8 -6
- data/lib/rtm/io/to_xtm1.rb +6 -4
- data/lib/rtm/io/to_xtm2.rb +10 -8
- data/lib/rtm/io/to_yaml.rb +29 -98
- data/lib/rtm/navigation.rb +37 -0
- data/lib/rtm/navigation/association/players.rb +25 -0
- data/lib/rtm/navigation/name/atomify.rb +19 -0
- data/lib/rtm/navigation/name/characteristics.rb +33 -0
- data/lib/rtm/navigation/occurrence/atomify.rb +19 -0
- data/lib/rtm/navigation/occurrence/characteristics.rb +33 -0
- data/lib/rtm/navigation/topic/characteristics.rb +33 -0
- data/lib/rtm/navigation/topic/indicators.rb +31 -0
- data/lib/rtm/navigation/topic/items.rb +31 -0
- data/lib/rtm/navigation/topic/locators.rb +31 -0
- data/lib/rtm/navigation/topic/players.rb +27 -0
- data/lib/rtm/navigation/topic/supertypes.rb +162 -0
- data/lib/rtm/navigation/topic/traverse.rb +51 -0
- data/lib/rtm/navigation/topic/types.rb +107 -0
- data/lib/rtm/psi.rb +33 -2
- data/lib/rtm/sugar.rb +34 -0
- data/lib/rtm/sugar/association/hash_access.rb +46 -0
- data/lib/rtm/sugar/occurrence/dynamic_value.rb +75 -0
- data/lib/rtm/{pimp_my_api.rb → sugar/occurrence/externalize.rb} +3 -0
- data/lib/rtm/sugar/role/counterparts.rb +133 -46
- data/lib/rtm/sugar/topic/characteristics.rb +126 -12
- data/lib/rtm/sugar/topic/counterparts.rb +130 -7
- data/lib/rtm/sugar/topic/hash_access.rb +140 -30
- data/lib/rtm/sugar/topic/scoped.rb +65 -0
- data/lib/rtm/sugar/topic/topic_ref.rb +35 -0
- data/lib/rtm/sugar/topic/typed.rb +159 -0
- data/lib/rtm/sugar/typed/types.rb +38 -0
- data/lib/rtm/validation.rb +8 -5
- data/lib/rtm/version.rb +18 -0
- data/spec/helpers/spec_exampleexamplegroup.rb +14 -0
- data/spec/rtm/axes/association_spec.rb +88 -0
- data/spec/rtm/axes/associations_spec.rb +60 -0
- data/spec/rtm/axes/assocs_names_occs_spec.rb +9 -0
- data/spec/rtm/axes/characteristic_spec.rb +90 -0
- data/spec/rtm/axes/characteristics_spec.rb +85 -0
- data/spec/rtm/axes/string_spec.rb +145 -0
- data/spec/rtm/axes/strings_spec.rb +168 -0
- data/spec/rtm/axes/topic_spec.rb +124 -0
- data/spec/rtm/axes/topics_spec.rb +103 -0
- data/spec/rtm/base_spec.rb +32 -0
- data/spec/rtm/io/tmapix_spec.rb +85 -0
- data/spec/rtm/navigation/association/players_spec.rb +58 -0
- data/spec/rtm/navigation/association_spec.rb +52 -0
- data/spec/rtm/navigation/name/atomify_spec.rb +27 -0
- data/spec/rtm/navigation/name/characteristics_spec.rb +34 -0
- data/spec/rtm/navigation/name_spec.rb +52 -0
- data/spec/rtm/navigation/occurrence/atomify_spec.rb +27 -0
- data/spec/rtm/navigation/occurrence/characteristics_spec.rb +34 -0
- data/spec/rtm/navigation/occurrence_spec.rb +52 -0
- data/spec/rtm/navigation/string_spec.rb +51 -0
- data/spec/rtm/navigation/topic/characteristics_spec.rb +55 -0
- data/spec/rtm/navigation/topic/indicators_spec.rb +43 -0
- data/spec/rtm/navigation/topic/items_spec.rb +44 -0
- data/spec/rtm/navigation/topic/locators_spec.rb +44 -0
- data/spec/rtm/navigation/topic/players_spec.rb +48 -0
- data/spec/rtm/navigation/topic/scope_spec.rb +41 -0
- data/spec/rtm/navigation/topic/supertypes_spec.rb +376 -0
- data/spec/rtm/navigation/topic/traverse_spec.rb +64 -0
- data/spec/rtm/navigation/topic/types_spec.rb +195 -0
- data/spec/rtm/navigation/topic_spec.rb +153 -0
- data/spec/rtm/sugar/association/hash_access_spec.rb +55 -0
- data/spec/rtm/sugar/occurrence/dynamic_value_spec.rb +16 -0
- data/spec/rtm/sugar/role/counterparts_spec.rb +191 -0
- data/spec/rtm/sugar/topic/characteristics_spec.rb +318 -0
- data/spec/rtm/sugar/topic/counterparts_spec.rb +184 -0
- data/spec/rtm/sugar/topic/hash_access_spec.rb +234 -0
- data/spec/rtm/sugar/topic/scoped_spec.rb +131 -0
- data/spec/rtm/sugar/topic/topic_ref_spec.rb +44 -0
- data/spec/rtm/sugar/topic/typed_spec.rb +155 -0
- data/spec/rtm/sugar/typed/types_spec.rb +24 -0
- data/spec/rtm/tmapi/core/association_spec.rb +169 -0
- data/spec/rtm/tmapi/core/construct_spec.rb +25 -0
- data/spec/rtm/tmapi/core/name_spec.rb +85 -0
- data/spec/rtm/tmapi/core/occurrence_spec.rb +96 -0
- data/spec/rtm/tmapi/core/reifiable_spec.rb +168 -0
- data/spec/rtm/tmapi/core/role_spec.rb +73 -0
- data/spec/rtm/tmapi/core/scoped_spec.rb +403 -0
- data/spec/rtm/tmapi/core/topic_map_spec.rb +648 -0
- data/spec/rtm/tmapi/core/topic_spec.rb +992 -0
- data/spec/rtm/tmapi/core/typed_spec.rb +112 -0
- data/spec/rtm/tmapi/core/variant_spec.rb +52 -0
- data/spec/rtm/tmapi/ext/java_util_set_spec.rb +34 -0
- data/spec/rtm/tmapi_spec.rb +44 -0
- data/spec/rtm/utils/sparql_spec.rb +26 -0
- data/spec/rtm_spec.rb +94 -0
- data/spec/spec_helper.rb +23 -0
- data/test/base_unit_test.rb +161 -0
- data/test/{base_test.rb → base_unit_test_tmapi.rb} +46 -43
- metadata +122 -66
- data/COPYRIGHT +0 -4
- data/lib/Rakefile.rb +0 -42
- data/lib/activetopicmaps.rb +0 -278
- data/lib/rtm/backend/active_record.rb +0 -58
- data/lib/rtm/backend/active_record/001_initial_schema.rb +0 -116
- data/lib/rtm/backend/active_record/association_and_role.rb +0 -33
- data/lib/rtm/backend/active_record/locators.rb +0 -55
- data/lib/rtm/backend/active_record/name_variant_occurrence.rb +0 -45
- data/lib/rtm/backend/active_record/quaaxtm2rtm.rb +0 -113
- data/lib/rtm/backend/active_record/quaaxtm2rtmviews.rb +0 -134
- data/lib/rtm/backend/active_record/set_wrapper.rb +0 -98
- data/lib/rtm/backend/active_record/tm_construct.rb +0 -62
- data/lib/rtm/backend/active_record/tm_delegator.rb +0 -345
- data/lib/rtm/backend/active_record/tm_set_delegator.rb +0 -195
- data/lib/rtm/backend/active_record/tmdm.rb +0 -298
- data/lib/rtm/backend/active_record/topic.rb +0 -87
- data/lib/rtm/backend/active_record/topic_map.rb +0 -314
- data/lib/rtm/backend/active_record/traverse_associations.rb +0 -87
- data/lib/rtm/base.rb +0 -92
- data/lib/rtm/connect.rb +0 -92
- data/lib/rtm/core_ext.rb +0 -6
- data/lib/rtm/io/from_xtm2.rb +0 -263
- data/lib/rtm/merging/merging.rb +0 -307
- data/lib/rtm/sugar/topic/identifier_direct.rb +0 -11
- data/lib/rtm/sugar/topic/predefined_associations.rb +0 -42
- data/lib/run_main_project.rb +0 -16
@@ -0,0 +1,32 @@
|
|
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
|
+
|
7
|
+
describe "RTM" do
|
8
|
+
describe "#create" do
|
9
|
+
it "should give back an instance of RTM::TopicMap" do
|
10
|
+
# RTM.connect
|
11
|
+
# @tm = RTM.create("test:test")
|
12
|
+
# @tm.should be_a_kind_of RTM::TopicMap
|
13
|
+
# @tm.close
|
14
|
+
end
|
15
|
+
end
|
16
|
+
describe "#[]" do
|
17
|
+
it "should allow to see the existing TM's and 2 access them" do
|
18
|
+
# RTM.connect
|
19
|
+
# RTM[].should be_empty
|
20
|
+
# @tm = RTM.create("test:test")
|
21
|
+
# @tm_2 = RTM.create("test:test_2")
|
22
|
+
# RTM["test:test_2"].include?(@tm_2).should be_true
|
23
|
+
# RTM["test:test_2"].length.should == 1
|
24
|
+
# RTM["test:test","test:test_2"].length.should == 2
|
25
|
+
# RTM[].length.should == 2
|
26
|
+
# @tm.close
|
27
|
+
# @tm_2.close
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,85 @@
|
|
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::IO::TMAPIX::TopicMap
|
7
|
+
|
8
|
+
describe self do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
end
|
12
|
+
after(:each) do
|
13
|
+
@tm.close
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#from_ltm" do
|
17
|
+
it "should be tested"
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#from_ctm" do
|
21
|
+
it "should be tested"
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#from_jtm" do
|
25
|
+
it "should be tested"
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#from_tmxml" do
|
29
|
+
it "should be tested"
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#from_xtm10" do
|
33
|
+
it "should be tested"
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#from_xtm20" do
|
37
|
+
it "should be tested"
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#from_xtm" do
|
41
|
+
it "should be tested"
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#from_n3" do
|
45
|
+
it "should be tested"
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#from_rdfxml" do
|
49
|
+
it "should be tested"
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#to_xtm20" do
|
53
|
+
it "should be tested"
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#to_xtm10" do
|
57
|
+
it "should be tested"
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#to_jtm" do
|
61
|
+
it "should be tested"
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#to_ltm" do
|
65
|
+
it "should be tested"
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#to_tmxml" do
|
69
|
+
it "should be tested"
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#to_ctm" do
|
73
|
+
it "should export a topic map to ctm" do
|
74
|
+
# filling ...
|
75
|
+
@tm.from_xtm20(File.dirname(__FILE__) + "/../../resources/toyTM.xtm")
|
76
|
+
@tm.to_ctm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.ctm","http://www.example.org/toyTM_after_spec")
|
77
|
+
end
|
78
|
+
it "should read it afterwards" do
|
79
|
+
emptyTM = get_used_tm_sys.create("http://blub.org/")
|
80
|
+
emptyTM.from_ctm(File.dirname(__FILE__) + "/../../resources/toyTM_after_spec.ctm")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,58 @@
|
|
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::Navigation::Association
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
end
|
11
|
+
after(:each) do
|
12
|
+
@tm.close
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#players" do
|
16
|
+
before(:each) do
|
17
|
+
@assoc = @tm.create_association("assoc_type")
|
18
|
+
end
|
19
|
+
it "give back no players if the association has no players" do
|
20
|
+
@assoc.should have(0).players
|
21
|
+
end
|
22
|
+
it "give back all players of the association" do
|
23
|
+
@assoc.create_role("role_type","role_player")
|
24
|
+
@assoc.should have(1).players
|
25
|
+
@tm.get("role_player").should_not be_nil
|
26
|
+
@assoc.players.should include @tm.get("role_player")
|
27
|
+
end
|
28
|
+
it "should give back a player as many times as it plays a role in the association" do
|
29
|
+
@assoc.create_role("country","germany")
|
30
|
+
@assoc.should have(1).players
|
31
|
+
@tm.get("germany").should_not be_nil
|
32
|
+
@assoc.players.should include @tm.get("germany")
|
33
|
+
@assoc.create_role("neighbour_country","germany")
|
34
|
+
@assoc.should have(2).players
|
35
|
+
@assoc.players.should include @tm.get("germany")
|
36
|
+
end
|
37
|
+
it "should give back players whose roletype equals the optional argument" do
|
38
|
+
@assoc.create_role("country","germany")
|
39
|
+
@assoc.create_role("country","france")
|
40
|
+
@assoc.create_role("neighbouring_country","switzerland")
|
41
|
+
@assoc.should have(3).players
|
42
|
+
@assoc.players("country").size.should == 2
|
43
|
+
@assoc.players("neighbouring_country").size.should == 1
|
44
|
+
end
|
45
|
+
it "should give back an empty result if no role with the specified role type exists" do
|
46
|
+
@assoc.create_role("country","germany")
|
47
|
+
@assoc.create_role("country","france")
|
48
|
+
@assoc.create_role("neighbouring_country","switzerland")
|
49
|
+
@assoc.players("countries").should be_empty
|
50
|
+
end
|
51
|
+
it "should give back a container" do
|
52
|
+
@assoc.players.should respond_to(:each)
|
53
|
+
@assoc.players.should_not be_a_kind_of String
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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::Navigation::Association
|
7
|
+
describe self do
|
8
|
+
before(:all) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@assoc = @tm.create_association("assoc_type")
|
11
|
+
@assoc.create_role("blub","bla")
|
12
|
+
@methods_array = @assoc.methods
|
13
|
+
end
|
14
|
+
after(:all) do
|
15
|
+
@tm.close
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#axes" do
|
19
|
+
it "should give back a RTM::Axes::Association" do
|
20
|
+
@assoc.axes.should be_a_kind_of(RTM::Axes::Association)
|
21
|
+
@assoc.axes.construct.should == @assoc
|
22
|
+
@assoc.axes.tm.should == @tm
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#players" do
|
27
|
+
it "should be allowed to call" do
|
28
|
+
@methods_array.should include("players")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#reverse_reifier" do
|
33
|
+
it "should not be allowed to call" do
|
34
|
+
@methods_array.should_not include("reverse_reifier")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
describe "#roles_tta" do
|
40
|
+
it "should not be allowed to call" do
|
41
|
+
@methods_array.should_not include("roles_tta")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#scope" do
|
46
|
+
it "should be allowed to call" do
|
47
|
+
@methods_array.should include("scope")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
+
|
7
|
+
module RTM::Navigation::Name
|
8
|
+
describe self do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
@topic = @tm.get!("Person")
|
12
|
+
@value = "Hans"
|
13
|
+
@name = @topic.create_name(@value)
|
14
|
+
end
|
15
|
+
after(:each) do
|
16
|
+
@tm.close
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#atomify" do
|
20
|
+
it "should give back the value of the name" do
|
21
|
+
@name.atomify.should be_a_kind_of String
|
22
|
+
@name.atomify.should == @value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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::Navigation::Name
|
7
|
+
|
8
|
+
describe "characteristics" do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
@topic = @tm.get!("Person")
|
12
|
+
end
|
13
|
+
after(:each) do
|
14
|
+
@tm.close
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#reverse_characteristics" do
|
18
|
+
before(:each) do
|
19
|
+
@name = @topic.create_name("Name","Hans")
|
20
|
+
@type = @tm.get!("something")
|
21
|
+
end
|
22
|
+
it "should give back the topic the Name belongs to" do
|
23
|
+
@name.reverse_characteristics.should == @topic
|
24
|
+
end
|
25
|
+
it "should give back the topic the Name belongs to with the right name type" do
|
26
|
+
@name.reverse_characteristics("Name").should == @topic
|
27
|
+
@name.reverse_characteristics("something").should be_nil
|
28
|
+
@name.reverse_characteristics("anything").should be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end #of describe "characteristics"
|
33
|
+
|
34
|
+
end #of module
|
@@ -0,0 +1,52 @@
|
|
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::Navigation::Name
|
7
|
+
describe self do
|
8
|
+
before(:all) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("person")
|
11
|
+
@name = @topic.create_name("Hans")
|
12
|
+
@methods_array = @name.methods
|
13
|
+
end
|
14
|
+
after(:all) do
|
15
|
+
@tm.close
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#axes" do
|
19
|
+
it "should give back a RTM::Axes::Name" do
|
20
|
+
@name.axes.should be_a_kind_of RTM::Axes::Name
|
21
|
+
@name.axes.should be_a_kind_of RTM::Axes::Characteristic
|
22
|
+
@name.axes.construct.should == @name
|
23
|
+
@name.axes.tm.should == @tm
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#atomify" do
|
28
|
+
it "should be allowed to call" do
|
29
|
+
@methods_array.should include("atomify")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#reverse_characteristics" do
|
34
|
+
it "should be allowed to call" do
|
35
|
+
@methods_array.should include("reverse_characteristics")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#reverse_reifier" do
|
40
|
+
it "should not be allowed to call" do
|
41
|
+
@methods_array.should_not include("reverse_reifier")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#scope" do
|
46
|
+
it "should be allowed to call" do
|
47
|
+
@methods_array.should include("scope")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
+
|
7
|
+
module RTM::Navigation::Occurrence
|
8
|
+
describe self do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
@topic = @tm.get!("Person")
|
12
|
+
@value = "Hans"
|
13
|
+
@occ = @topic.create_occurrence("Friend", @value)
|
14
|
+
end
|
15
|
+
after(:each) do
|
16
|
+
@tm.close
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#atomify" do
|
20
|
+
it "should give back the value of the occurrence" do
|
21
|
+
@occ.atomify.should be_a_kind_of String
|
22
|
+
@occ.atomify.should == @value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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::Navigation::Occurrence
|
7
|
+
|
8
|
+
describe "characteristics" do
|
9
|
+
before(:each) do
|
10
|
+
@tm = get_used_tm_sys_tm
|
11
|
+
@topic = @tm.get!("Person")
|
12
|
+
end
|
13
|
+
after(:each) do
|
14
|
+
@tm.close
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#reverse_characteristics" do
|
18
|
+
before(:each) do
|
19
|
+
@type = @tm.get!("something")
|
20
|
+
@occ = @topic.create_occurrence("Number","18")
|
21
|
+
end
|
22
|
+
it "should give back the topic the Occurrence belongs to" do
|
23
|
+
@occ.reverse_characteristics.should == @topic
|
24
|
+
end
|
25
|
+
it "should give back the topic the Occurrence belongs to with the right occ type" do
|
26
|
+
@occ.reverse_characteristics("Number").should == @topic
|
27
|
+
@occ.reverse_characteristics("something").should be_nil
|
28
|
+
@occ.reverse_characteristics("anything").should be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end #of describe "characteristics"
|
33
|
+
|
34
|
+
end #of module
|
@@ -0,0 +1,52 @@
|
|
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::Navigation::Occurrence
|
7
|
+
describe self do
|
8
|
+
before(:all) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("person")
|
11
|
+
@occ = @topic.create_occurrence("Alter", "18")
|
12
|
+
@methods_array = @occ.methods
|
13
|
+
end
|
14
|
+
after(:all) do
|
15
|
+
@tm.close
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#axes" do
|
19
|
+
it "should give back a RTM::Axes::Occurrence" do
|
20
|
+
@occ.axes.should be_a_kind_of RTM::Axes::Occurrence
|
21
|
+
@occ.axes.should be_a_kind_of RTM::Axes::Characteristic
|
22
|
+
@occ.axes.construct.should == @occ
|
23
|
+
@occ.axes.tm.should == @tm
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#atomify" do
|
28
|
+
it "should be allowed to call" do
|
29
|
+
@methods_array.should include("atomify")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#reverse_characteristics" do
|
34
|
+
it "should be allowed to call" do
|
35
|
+
@methods_array.should include("reverse_characteristics")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#reverse_reifier" do
|
40
|
+
it "should not be allowed to call" do
|
41
|
+
@methods_array.should_not include("reverse_reifier")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#scope" do
|
46
|
+
it "should be allowed to call" do
|
47
|
+
@methods_array.should include("scope")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|