rtm 0.1.6 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. data/DISCLAIMER +10 -33
  2. data/LICENSE +201 -0
  3. data/README +32 -3
  4. data/lib/rtm.rb +126 -74
  5. data/lib/rtm/axes.rb +298 -0
  6. data/lib/rtm/axes/association.rb +76 -0
  7. data/lib/rtm/axes/associations.rb +96 -0
  8. data/lib/rtm/axes/assocs_names_occs.rb +56 -0
  9. data/lib/rtm/axes/characteristic.rb +68 -0
  10. data/lib/rtm/axes/characteristics.rb +93 -0
  11. data/lib/rtm/axes/string.rb +76 -0
  12. data/lib/rtm/axes/strings.rb +87 -0
  13. data/lib/rtm/axes/topic.rb +233 -0
  14. data/lib/rtm/axes/topics.rb +280 -0
  15. data/lib/rtm/{backward_compatibility.rb → deprecated/index_property_set.rb} +3 -0
  16. data/lib/rtm/engine.rb +101 -0
  17. data/lib/rtm/extensions.rb +65 -5
  18. data/lib/rtm/{locator_helpers.rb → helpers/locator.rb} +15 -4
  19. data/lib/rtm/{helpers.rb → helpers/no_output.rb} +3 -0
  20. data/lib/rtm/helpers/uri.rb +13 -0
  21. data/lib/rtm/io.rb +19 -0
  22. data/lib/rtm/io/from_xtm2_libxml.rb +2 -1
  23. data/lib/rtm/io/tmapix_from.rb +155 -0
  24. data/lib/rtm/io/tmapix_to.rb +223 -0
  25. data/lib/rtm/io/to_hash.rb +154 -0
  26. data/lib/rtm/io/to_jtm.rb +53 -103
  27. data/lib/rtm/io/to_rdf.rb +45 -0
  28. data/lib/rtm/io/to_string.rb +21 -8
  29. data/lib/rtm/io/to_xtm1.rb +6 -4
  30. data/lib/rtm/io/to_xtm2.rb +10 -8
  31. data/lib/rtm/io/to_yaml.rb +59 -100
  32. data/lib/rtm/navigation.rb +23 -0
  33. data/lib/rtm/navigation/association/players.rb +25 -0
  34. data/lib/rtm/navigation/name/atomify.rb +19 -0
  35. data/lib/rtm/navigation/name/characteristics.rb +33 -0
  36. data/lib/rtm/navigation/occurrence/atomify.rb +19 -0
  37. data/lib/rtm/navigation/occurrence/characteristics.rb +33 -0
  38. data/lib/rtm/navigation/topic/characteristics.rb +33 -0
  39. data/lib/rtm/navigation/topic/indicators.rb +31 -0
  40. data/lib/rtm/navigation/topic/items.rb +31 -0
  41. data/lib/rtm/navigation/topic/locators.rb +31 -0
  42. data/lib/rtm/navigation/topic/players.rb +27 -0
  43. data/lib/rtm/navigation/topic/supertypes.rb +166 -0
  44. data/lib/rtm/navigation/topic/traverse.rb +51 -0
  45. data/lib/rtm/navigation/topic/types.rb +109 -0
  46. data/lib/rtm/psi.rb +39 -2
  47. data/lib/rtm/sugar.rb +47 -0
  48. data/lib/rtm/sugar/association/hash_access.rb +46 -0
  49. data/lib/rtm/sugar/occurrence/dynamic_value.rb +58 -0
  50. data/lib/rtm/sugar/occurrence/external.rb +53 -0
  51. data/lib/rtm/sugar/reifiable/reifier.rb +21 -0
  52. data/lib/rtm/sugar/role/counterparts.rb +139 -46
  53. data/lib/rtm/sugar/topic/best_name.rb +74 -0
  54. data/lib/rtm/sugar/topic/characteristics.rb +126 -12
  55. data/lib/rtm/sugar/topic/counterparts.rb +145 -10
  56. data/lib/rtm/sugar/topic/hash_access.rb +140 -30
  57. data/lib/rtm/sugar/topic/scoped.rb +114 -0
  58. data/lib/rtm/sugar/topic/topic_ref.rb +86 -0
  59. data/lib/rtm/sugar/topic/typed.rb +207 -0
  60. data/lib/rtm/sugar/topic_map/query_cache.rb +66 -0
  61. data/lib/rtm/sugar/topic_map/themes.rb +53 -0
  62. data/lib/rtm/sugar/typed/types.rb +38 -0
  63. data/lib/rtm/validation.rb +7 -4
  64. data/lib/rtm/version.rb +30 -0
  65. data/spec/helpers/spec_exampleexamplegroup.rb +14 -0
  66. data/spec/rtm/axes/association_spec.rb +88 -0
  67. data/spec/rtm/axes/associations_spec.rb +60 -0
  68. data/spec/rtm/axes/assocs_names_occs_spec.rb +9 -0
  69. data/spec/rtm/axes/characteristic_spec.rb +90 -0
  70. data/spec/rtm/axes/characteristics_spec.rb +85 -0
  71. data/spec/rtm/axes/string_spec.rb +145 -0
  72. data/spec/rtm/axes/strings_spec.rb +168 -0
  73. data/spec/rtm/axes/topic_spec.rb +124 -0
  74. data/spec/rtm/axes/topics_spec.rb +103 -0
  75. data/spec/rtm/base_spec.rb +32 -0
  76. data/spec/rtm/io/tmapix_from_spec.rb +76 -0
  77. data/spec/rtm/io/tmapix_to_spec.rb +159 -0
  78. data/spec/rtm/io/to_hash_spec.rb +90 -0
  79. data/spec/rtm/io/to_rdf_spec.rb +37 -0
  80. data/spec/rtm/io/to_string_spec.rb +122 -0
  81. data/spec/rtm/io/to_yaml_spec.rb +89 -0
  82. data/spec/rtm/navigation/association/players_spec.rb +58 -0
  83. data/spec/rtm/navigation/association_spec.rb +52 -0
  84. data/spec/rtm/navigation/name/atomify_spec.rb +27 -0
  85. data/spec/rtm/navigation/name/characteristics_spec.rb +34 -0
  86. data/spec/rtm/navigation/name_spec.rb +52 -0
  87. data/spec/rtm/navigation/occurrence/atomify_spec.rb +27 -0
  88. data/spec/rtm/navigation/occurrence/characteristics_spec.rb +34 -0
  89. data/spec/rtm/navigation/occurrence_spec.rb +52 -0
  90. data/spec/rtm/navigation/string_spec.rb +51 -0
  91. data/spec/rtm/navigation/topic/characteristics_spec.rb +55 -0
  92. data/spec/rtm/navigation/topic/indicators_spec.rb +43 -0
  93. data/spec/rtm/navigation/topic/items_spec.rb +44 -0
  94. data/spec/rtm/navigation/topic/locators_spec.rb +44 -0
  95. data/spec/rtm/navigation/topic/players_spec.rb +48 -0
  96. data/spec/rtm/navigation/topic/scope_spec.rb +41 -0
  97. data/spec/rtm/navigation/topic/supertypes_spec.rb +376 -0
  98. data/spec/rtm/navigation/topic/traverse_spec.rb +64 -0
  99. data/spec/rtm/navigation/topic/types_spec.rb +195 -0
  100. data/spec/rtm/navigation/topic_spec.rb +153 -0
  101. data/spec/rtm/sugar/association/hash_access_spec.rb +55 -0
  102. data/spec/rtm/sugar/occurrence/dynamic_value_spec.rb +171 -0
  103. data/spec/rtm/sugar/occurrence/external_spec.rb +129 -0
  104. data/spec/rtm/sugar/reifiable/reifier_spec.rb +41 -0
  105. data/spec/rtm/sugar/role/counterparts_spec.rb +193 -0
  106. data/spec/rtm/sugar/topic/best_name_spec.rb +25 -0
  107. data/spec/rtm/sugar/topic/characteristics_spec.rb +333 -0
  108. data/spec/rtm/sugar/topic/counterparts_spec.rb +224 -0
  109. data/spec/rtm/sugar/topic/hash_access_spec.rb +234 -0
  110. data/spec/rtm/sugar/topic/scoped_spec.rb +195 -0
  111. data/spec/rtm/sugar/topic/topic_ref_spec.rb +44 -0
  112. data/spec/rtm/sugar/topic/typed_spec.rb +217 -0
  113. data/spec/rtm/sugar/topic_map/themes_spec.rb +67 -0
  114. data/spec/rtm/sugar/typed/types_spec.rb +24 -0
  115. data/spec/rtm/tmapi/core/association_spec.rb +169 -0
  116. data/spec/rtm/tmapi/core/construct_spec.rb +25 -0
  117. data/spec/rtm/tmapi/core/datatype_aware_spec.rb +236 -0
  118. data/spec/rtm/tmapi/core/name_spec.rb +270 -0
  119. data/spec/rtm/tmapi/core/occurrence_spec.rb +53 -0
  120. data/spec/rtm/tmapi/core/reifiable_spec.rb +168 -0
  121. data/spec/rtm/tmapi/core/role_spec.rb +73 -0
  122. data/spec/rtm/tmapi/core/scoped_spec.rb +441 -0
  123. data/spec/rtm/tmapi/core/topic_map_spec.rb +716 -0
  124. data/spec/rtm/tmapi/core/topic_spec.rb +1468 -0
  125. data/spec/rtm/tmapi/core/typed_spec.rb +112 -0
  126. data/spec/rtm/tmapi/core/variant_spec.rb +52 -0
  127. data/spec/rtm/tmapi/ext/java_util_set_spec.rb +34 -0
  128. data/spec/rtm/tmapi_spec.rb +44 -0
  129. data/spec/rtm/utils/sparql_spec.rb +26 -0
  130. data/spec/rtm_spec.rb +93 -0
  131. data/spec/spec_helper.rb +28 -0
  132. data/test/javalibs/junit-4.5.jar +0 -0
  133. data/test/javalibs/tmapi-2.0-tests.jar +0 -0
  134. data/test/tmapi_tests.rb +25 -0
  135. metadata +169 -65
  136. data/COPYRIGHT +0 -4
  137. data/lib/Rakefile.rb +0 -42
  138. data/lib/activetopicmaps.rb +0 -278
  139. data/lib/rtm/backend/active_record.rb +0 -58
  140. data/lib/rtm/backend/active_record/001_initial_schema.rb +0 -116
  141. data/lib/rtm/backend/active_record/association_and_role.rb +0 -33
  142. data/lib/rtm/backend/active_record/locators.rb +0 -55
  143. data/lib/rtm/backend/active_record/name_variant_occurrence.rb +0 -45
  144. data/lib/rtm/backend/active_record/quaaxtm2rtm.rb +0 -113
  145. data/lib/rtm/backend/active_record/quaaxtm2rtmviews.rb +0 -134
  146. data/lib/rtm/backend/active_record/set_wrapper.rb +0 -98
  147. data/lib/rtm/backend/active_record/tm_construct.rb +0 -62
  148. data/lib/rtm/backend/active_record/tm_delegator.rb +0 -345
  149. data/lib/rtm/backend/active_record/tm_set_delegator.rb +0 -195
  150. data/lib/rtm/backend/active_record/tmdm.rb +0 -298
  151. data/lib/rtm/backend/active_record/topic.rb +0 -87
  152. data/lib/rtm/backend/active_record/topic_map.rb +0 -314
  153. data/lib/rtm/backend/active_record/traverse_associations.rb +0 -87
  154. data/lib/rtm/base.rb +0 -92
  155. data/lib/rtm/connect.rb +0 -92
  156. data/lib/rtm/core_ext.rb +0 -6
  157. data/lib/rtm/io/from_xtm2.rb +0 -263
  158. data/lib/rtm/merging/merging.rb +0 -307
  159. data/lib/rtm/pimp_my_api.rb +0 -28
  160. data/lib/rtm/sugar/topic/identifier_direct.rb +0 -11
  161. data/lib/rtm/sugar/topic/predefined_associations.rb +0 -42
  162. data/lib/run_main_project.rb +0 -16
  163. data/test/base_test.rb +0 -162
@@ -0,0 +1,89 @@
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::ToYAML
7
+
8
+ describe self do
9
+ before(:each) do
10
+ @tm = get_used_tm_sys_tm
11
+ @tm.reifier!
12
+ @topic = @tm.get!("a:b")
13
+ @name = @topic.create_name("name type", "name value", ["theme1", "theme2"])
14
+ @name.reifier!
15
+ @var = @name.create_variant(1234, RTM::PSI[:String], ["theme5"])
16
+ @var.reifier!
17
+ @occ = @topic.create_occurrence("occ type", "occ value", :datatype => RTM::PSI[:IRI], :scope => ["theme3", "theme4"])
18
+ @occ.reifier!
19
+ @assoc = @tm.create_association("assoc type", ["theme6", "theme7"])
20
+ @assoc.reifier!
21
+ @role = @assoc.create_role("role type", "role player")
22
+ @role.reifier!
23
+ @locator = @tm.create_locator("http://www.example.org/test this locator")
24
+ end
25
+ after(:each) do
26
+ @output.should be_a_kind_of String
27
+ @tm.close
28
+ end
29
+
30
+ describe "#to_yaml" do
31
+ describe "for TopicMap" do
32
+ before(:each) do
33
+ @tm.should be_a_kind_of RTM::TopicMap
34
+ end
35
+ it "should give back a String" do
36
+ @output = @tm.to_yaml
37
+ end
38
+ end
39
+ describe "for Topic" do
40
+ before(:each) do
41
+ @topic.should be_a_kind_of RTM::Topic
42
+ end
43
+ it "should give back a String" do
44
+ @output = @topic.to_yaml
45
+ end
46
+ end
47
+ describe "for Association" do
48
+ before(:each) do
49
+ @assoc.should be_a_kind_of RTM::Association
50
+ end
51
+ it "should give back a String" do
52
+ @output = @assoc.to_yaml
53
+ end
54
+ end
55
+ describe "for Role" do
56
+ before(:each) do
57
+ @role.should be_a_kind_of RTM::Role
58
+ end
59
+ it "should give back a String" do
60
+ @output = @role.to_yaml
61
+ end
62
+ end
63
+ describe "for Name" do
64
+ before(:each) do
65
+ @name.should be_a_kind_of RTM::Name
66
+ end
67
+ it "should give back a String" do
68
+ @output = @name.to_yaml
69
+ end
70
+ end
71
+ describe "for Occurrence" do
72
+ before(:each) do
73
+ @occ.should be_a_kind_of RTM::Occurrence
74
+ end
75
+ it "should give back a String" do
76
+ @output = @occ.to_yaml
77
+ end
78
+ end
79
+ describe "for Variant" do
80
+ before(:each) do
81
+ @var.should be_a_kind_of RTM::Variant
82
+ end
83
+ it "should give back a String" do
84
+ @output = @var.to_yaml
85
+ end
86
+ end
87
+ end
88
+ end
89
+ 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
@@ -0,0 +1,51 @@
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
+ class String
7
+ describe self do
8
+ before(:all) do
9
+ @tm = get_used_tm_sys_tm
10
+ @value = "18"
11
+ @methods_array = @value.methods
12
+ end
13
+ after(:all) do
14
+ @tm.close
15
+ end
16
+
17
+ describe "#axes" do
18
+ it "should give back a RTM::Axes::String when called on a string, needs a TopicMap" do
19
+ axes_object = @value.axes(@tm)
20
+ axes_object.should be_a_kind_of RTM::Axes::String
21
+ axes_object.construct.should == @value
22
+ axes_object.tm.should == @tm
23
+ end
24
+ end
25
+
26
+ describe "#reverse_atomify" do
27
+ it "should not be allowed to call" do
28
+ @methods_array.should_not include("reverse_atomify")
29
+ end
30
+ end
31
+
32
+ describe "#reverse_indicators" do
33
+ it "should not be allowed to call" do
34
+ @methods_array.should_not include("reverse_indicators")
35
+ end
36
+ end
37
+
38
+ describe "#reverse_item" do
39
+ it "should not be allowed to call" do
40
+ @methods_array.should_not include("reverse_item")
41
+ end
42
+ end
43
+
44
+ describe "#reverse_locators" do
45
+ it "should not be allowed to call" do
46
+ @methods_array.should_not include("reverse_locators")
47
+ end
48
+ end
49
+
50
+ end
51
+ end