rtm 0.1.6 → 0.2
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 +32 -3
- data/lib/rtm.rb +126 -74
- data/lib/rtm/axes.rb +298 -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 +101 -0
- data/lib/rtm/extensions.rb +65 -5
- 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 +19 -0
- data/lib/rtm/io/from_xtm2_libxml.rb +2 -1
- data/lib/rtm/io/tmapix_from.rb +155 -0
- data/lib/rtm/io/tmapix_to.rb +223 -0
- data/lib/rtm/io/to_hash.rb +154 -0
- data/lib/rtm/io/to_jtm.rb +53 -103
- data/lib/rtm/io/to_rdf.rb +45 -0
- data/lib/rtm/io/to_string.rb +21 -8
- 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 +59 -100
- data/lib/rtm/navigation.rb +23 -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 +166 -0
- data/lib/rtm/navigation/topic/traverse.rb +51 -0
- data/lib/rtm/navigation/topic/types.rb +109 -0
- data/lib/rtm/psi.rb +39 -2
- data/lib/rtm/sugar.rb +47 -0
- data/lib/rtm/sugar/association/hash_access.rb +46 -0
- data/lib/rtm/sugar/occurrence/dynamic_value.rb +58 -0
- data/lib/rtm/sugar/occurrence/external.rb +53 -0
- data/lib/rtm/sugar/reifiable/reifier.rb +21 -0
- data/lib/rtm/sugar/role/counterparts.rb +139 -46
- data/lib/rtm/sugar/topic/best_name.rb +74 -0
- data/lib/rtm/sugar/topic/characteristics.rb +126 -12
- data/lib/rtm/sugar/topic/counterparts.rb +145 -10
- data/lib/rtm/sugar/topic/hash_access.rb +140 -30
- data/lib/rtm/sugar/topic/scoped.rb +114 -0
- data/lib/rtm/sugar/topic/topic_ref.rb +86 -0
- data/lib/rtm/sugar/topic/typed.rb +207 -0
- data/lib/rtm/sugar/topic_map/query_cache.rb +66 -0
- data/lib/rtm/sugar/topic_map/themes.rb +53 -0
- data/lib/rtm/sugar/typed/types.rb +38 -0
- data/lib/rtm/validation.rb +7 -4
- data/lib/rtm/version.rb +30 -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_from_spec.rb +76 -0
- data/spec/rtm/io/tmapix_to_spec.rb +159 -0
- data/spec/rtm/io/to_hash_spec.rb +90 -0
- data/spec/rtm/io/to_rdf_spec.rb +37 -0
- data/spec/rtm/io/to_string_spec.rb +122 -0
- data/spec/rtm/io/to_yaml_spec.rb +89 -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 +171 -0
- data/spec/rtm/sugar/occurrence/external_spec.rb +129 -0
- data/spec/rtm/sugar/reifiable/reifier_spec.rb +41 -0
- data/spec/rtm/sugar/role/counterparts_spec.rb +193 -0
- data/spec/rtm/sugar/topic/best_name_spec.rb +25 -0
- data/spec/rtm/sugar/topic/characteristics_spec.rb +333 -0
- data/spec/rtm/sugar/topic/counterparts_spec.rb +224 -0
- data/spec/rtm/sugar/topic/hash_access_spec.rb +234 -0
- data/spec/rtm/sugar/topic/scoped_spec.rb +195 -0
- data/spec/rtm/sugar/topic/topic_ref_spec.rb +44 -0
- data/spec/rtm/sugar/topic/typed_spec.rb +217 -0
- data/spec/rtm/sugar/topic_map/themes_spec.rb +67 -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/datatype_aware_spec.rb +236 -0
- data/spec/rtm/tmapi/core/name_spec.rb +270 -0
- data/spec/rtm/tmapi/core/occurrence_spec.rb +53 -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 +441 -0
- data/spec/rtm/tmapi/core/topic_map_spec.rb +716 -0
- data/spec/rtm/tmapi/core/topic_spec.rb +1468 -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 +93 -0
- data/spec/spec_helper.rb +28 -0
- data/test/javalibs/junit-4.5.jar +0 -0
- data/test/javalibs/tmapi-2.0-tests.jar +0 -0
- data/test/tmapi_tests.rb +25 -0
- metadata +169 -65
- 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/pimp_my_api.rb +0 -28
- 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
- data/test/base_test.rb +0 -162
@@ -0,0 +1,55 @@
|
|
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::Topic
|
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 "#characteristics" do
|
18
|
+
it "should give back an empty set if nothing matches" do
|
19
|
+
topic = @tm.create_topic_by("Uni_Leipzig")
|
20
|
+
topic.characteristics.size.should == 0
|
21
|
+
occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
|
22
|
+
topic.characteristics("super_Gruendungsjahr").size.should == 0
|
23
|
+
topic.characteristics("super_Gruendungsjahr").include?(occ1).should be_false
|
24
|
+
end
|
25
|
+
it "should give back the values of the Names and Occurrences included in Characteristics" do
|
26
|
+
topic = @tm.create_topic_by("Uni_Leipzig")
|
27
|
+
name1 = topic.create_name("Universität Leipzig")
|
28
|
+
name2 = topic.create_name("University of Leipzig")
|
29
|
+
occ1 = topic.create_occurrence("Gruendungsjahr", "1409")
|
30
|
+
occ2 = topic.create_occurrence("Webseite", "http://www.topicmapslab.de")
|
31
|
+
topic.characteristics.size.should == 4
|
32
|
+
topic.characteristics.should include name1, name2, occ1, occ2
|
33
|
+
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
|
49
|
+
end
|
50
|
+
|
51
|
+
end #of describe "#characteristics"
|
52
|
+
|
53
|
+
end #of describe "characteristics"
|
54
|
+
|
55
|
+
end #of module
|
@@ -0,0 +1,43 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("ii:http://example.org/topic")
|
11
|
+
end
|
12
|
+
after(:each) do
|
13
|
+
@tm.close
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#indicators" do
|
17
|
+
it "should return all indicators of this Topic as Strings, even if the Topic was created by given a relative identifier" do
|
18
|
+
@topic.indicators.size.should == 0
|
19
|
+
@topic.add_subject_identifier("http://example.org/topic_si1")
|
20
|
+
@topic.should have(1).indicators
|
21
|
+
@topic.indicators.should include "http://example.org/topic_si1"
|
22
|
+
@topic.add_subject_identifier("topic_si2")
|
23
|
+
@topic.should have(2).indicators
|
24
|
+
@topic.indicators.should include "http://example.org/topic_si1", (@tm.base_iri + "topic_si2")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#indicator" do
|
29
|
+
it "should give back nil if this Topic has no indicators" do
|
30
|
+
@topic.indicator.should be_nil
|
31
|
+
end
|
32
|
+
it "should retrieve one indicator of this Topic" do
|
33
|
+
@topic.add_subject_identifier("http://example.org/topic_si")
|
34
|
+
@topic.indicator.should == "http://example.org/topic_si"
|
35
|
+
end
|
36
|
+
it "should return one indicator (the first one, sorted alphabetically) if this Topic has several subject identifiers" do
|
37
|
+
@topic.add_subject_identifier("http://example.org/D")
|
38
|
+
@topic.add_subject_identifier("http://example.org/A")
|
39
|
+
@topic.indicator.should include "http://example.org/A"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("http://example.org/topic")
|
11
|
+
end
|
12
|
+
after(:each) do
|
13
|
+
@tm.close
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#items" do
|
17
|
+
it "should return all item identifier of this Topic as Strings, even if the Topic was created by given a relative identifier" do
|
18
|
+
@topic.items.size.should == 0
|
19
|
+
@topic.add_item_identifier("http://example.org/topic_ii1")
|
20
|
+
@topic.should have(1).items
|
21
|
+
@topic.items.should include "http://example.org/topic_ii1"
|
22
|
+
@topic.add_item_identifier("topic_ii2")
|
23
|
+
@topic.should have(2).items
|
24
|
+
@topic.items.should include "http://example.org/topic_ii1", (@tm.base_iri + "topic_ii2")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#item" do
|
29
|
+
it "should give back nil if this Topic has no item identifiers" do
|
30
|
+
@topic.item.should be_nil
|
31
|
+
end
|
32
|
+
it "should retrieve one item identifier of this Topic" do
|
33
|
+
@topic.add_item_identifier("http://example.org/topic_ii")
|
34
|
+
@topic.item.should == "http://example.org/topic_ii"
|
35
|
+
end
|
36
|
+
it "should return one item identifier (the first one, sorted alphabetically) if this Topic has several item identifiers" do
|
37
|
+
@topic.add_item_identifier("http://example.org/D")
|
38
|
+
@topic.add_item_identifier("http://example.org/A")
|
39
|
+
@topic.item.should include "http://example.org/A"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("ii:http://example.org/topic")
|
11
|
+
end
|
12
|
+
after(:each) do
|
13
|
+
@tm.close
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#locators" do
|
17
|
+
it "should return all subject locators of this Topic as Strings, even if the Topic was created by given a relative identifier" do
|
18
|
+
@topic.locators.size.should == 0
|
19
|
+
@topic.add_subject_locator("http://example.org/topic_sl1")
|
20
|
+
@topic.should have(1).locators
|
21
|
+
@topic.locators.should include "http://example.org/topic_sl1"
|
22
|
+
@topic.add_subject_locator("topic_sl2")
|
23
|
+
@topic.should have(2).locators
|
24
|
+
@topic.locators.should include "http://example.org/topic_sl1", (@tm.base_iri + "topic_sl2")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#locator" do
|
29
|
+
it "should give back nil if this Topic has no subject locators" do
|
30
|
+
@topic.locator.should be_nil
|
31
|
+
end
|
32
|
+
it "should retrieve one subject locator of this Topic" do
|
33
|
+
@topic.add_subject_locator("http://example.org/topic_sl")
|
34
|
+
@topic.locator.should == "http://example.org/topic_sl"
|
35
|
+
end
|
36
|
+
it "should return one subject locator (the first one, sorted alphabetically) if this Topic has several subject locators" do
|
37
|
+
@topic.add_subject_locator("http://example.org/D")
|
38
|
+
@topic.add_subject_locator("http://example.org/A")
|
39
|
+
@topic.locator.should include "http://example.org/A"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@asso = @tm.create_association("a_type")
|
11
|
+
@topic = @tm.get!("a_topic")
|
12
|
+
end
|
13
|
+
after(:each) do
|
14
|
+
@tm.close
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#reverse_players" do
|
18
|
+
it "should give for each role the topic enactiong the association" do
|
19
|
+
@topic.reverse_players.should be_empty
|
20
|
+
a_asso = @tm.create_association("asso_type")
|
21
|
+
a_asso.create_role("role_type",@topic)
|
22
|
+
@topic.reverse_players.length.should == 1
|
23
|
+
@topic.reverse_players.include?(a_asso).should be_true
|
24
|
+
@topic.reverse_players("role_type").length.should == 1
|
25
|
+
@topic.reverse_players("role_type").include?(a_asso).should be_true
|
26
|
+
@topic.reverse_players("wrong_role_type").length.should == 0
|
27
|
+
@topic.reverse_players("wrong_role_type").include?(a_asso).should be_false
|
28
|
+
end
|
29
|
+
it "should give back an empty set if the topic plays in no association" do
|
30
|
+
@topic.reverse_players.should be_empty
|
31
|
+
end
|
32
|
+
it "should give back multiple entrys in the set if the topic plays multiple rols in one and the same association" do
|
33
|
+
a_asso = @tm.create_association("asso_type")
|
34
|
+
a_asso.create_role("role_type",@topic)
|
35
|
+
@topic.reverse_players.size.should == 1
|
36
|
+
a_asso.create_role("role_type_2",@topic)
|
37
|
+
@topic.reverse_players.size.should == 2
|
38
|
+
end
|
39
|
+
it "should give back associations of the type specified in the optional item" do
|
40
|
+
a_asso = @tm.create_association("asso_type")
|
41
|
+
a_asso.create_role("role_type",@topic)
|
42
|
+
@topic.reverse_players("wrong_role_type").size.should == 0
|
43
|
+
@topic.reverse_players("role_type").size.should == 1
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tm = get_used_tm_sys_tm
|
10
|
+
@topic = @tm.get!("nikolaus")
|
11
|
+
|
12
|
+
puts @topic.class.ancestors
|
13
|
+
|
14
|
+
end
|
15
|
+
after(:each) do
|
16
|
+
@tm.close
|
17
|
+
end
|
18
|
+
# describe "#reverse_scope" do
|
19
|
+
# it "should give back all instances of Scoped that are Scoped by self" do
|
20
|
+
# name = @topic.create_name("n_topic","some_name", ["s_topic"])
|
21
|
+
# occurrence = @topic.create_occurrence("n_topic","some_name",{:scope => ["s_topic"]})
|
22
|
+
# scoped = @tm.get("s_topic").reverse_scope
|
23
|
+
# scoped.length.should == 2
|
24
|
+
# scoped.include?(name).should be_true
|
25
|
+
# scoped.include?(occurrence).should be_true
|
26
|
+
# end
|
27
|
+
# it "should give back all instances of Scoped that are Scoped by self but have other Themes as well" do
|
28
|
+
# name = @topic.create_name("n_topic","some_name", ["s_topic","s_topic2"])
|
29
|
+
# occurrence = @topic.create_occurrence("n_topic","some_name",{:scope => ["s_topic"]})
|
30
|
+
# scoped = @tm.get("s_topic").reverse_scope
|
31
|
+
# scoped.length.should == 2
|
32
|
+
# scoped.include?(name).should be_true
|
33
|
+
# scoped.include?(occurrence).should be_true
|
34
|
+
# end
|
35
|
+
# it "should give back an empty set if noting is scoped" do
|
36
|
+
# @topic.reverse_scope.should be_empty
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,376 @@
|
|
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::Topic
|
7
|
+
describe self do
|
8
|
+
before(:each) do
|
9
|
+
@tms = get_used_tm_sys
|
10
|
+
@tm_empty = @tms.create("http://rtm.topicmapslab.de/spec/rtm/axes/navigation/supertypes/empty")
|
11
|
+
@topic1 = @tm_empty.get!("topic1") #lonely Topic
|
12
|
+
@tm = @tms.create("http://rtm.topicmapslab.de/spec/rtm/axes/navigation/supertypes/tm")
|
13
|
+
@t_lebewesen = @tm.get!("Lebewesen")
|
14
|
+
@t_tier = @tm.get!("Tier")
|
15
|
+
@t_affe = @tm.get!("Affe")
|
16
|
+
@t_saeuger = @tm.get!("Saeuger")
|
17
|
+
@t_mensch = @tm.get!("Mensch")
|
18
|
+
@t_super_sub = @tm.get!(RTM::PSI[:supertype_subtype])
|
19
|
+
@t_super = @tm.get!(RTM::PSI[:supertype])
|
20
|
+
@t_sub = @tm.get!(RTM::PSI[:subtype])
|
21
|
+
@t_etwas = @tm.get!("etwas")
|
22
|
+
@t_etwas_anderes = @tm.get!("etwas_anderes")
|
23
|
+
@t_noch_anders = @tm.get!("noch_anders")
|
24
|
+
@assoc1 = @tm.create_association(@t_super_sub)
|
25
|
+
@assoc2 = @tm.create_association(@t_super_sub)
|
26
|
+
@assoc3 = @tm.create_association(@t_super_sub)
|
27
|
+
@assoc4 = @tm.create_association(@t_super_sub)
|
28
|
+
@assoc5 = @tm.create_association(@t_super_sub)
|
29
|
+
@assoc6 = @tm.create_association(@t_super_sub)
|
30
|
+
@assoc7 = @tm.create_association(@t_super_sub)
|
31
|
+
@assoc8 = @tm.create_association(@t_super_sub)
|
32
|
+
@assoc1.create_role(@t_sub,@t_mensch)
|
33
|
+
@assoc1.create_role(@t_super,@t_saeuger)
|
34
|
+
@assoc2.create_role(@t_sub,@t_saeuger)
|
35
|
+
@assoc2.create_role(@t_super,@t_tier)
|
36
|
+
@assoc3.create_role(@t_sub,@t_affe)
|
37
|
+
@assoc3.create_role(@t_super,@t_saeuger)
|
38
|
+
@assoc4.create_role(@t_sub,@t_affe)
|
39
|
+
@assoc4.create_role(@t_super,@t_tier)
|
40
|
+
@assoc5.create_role(@t_sub,@t_tier)
|
41
|
+
@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
|
+
end
|
49
|
+
after(:each) do
|
50
|
+
@tm_empty.close
|
51
|
+
@tm.close
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#direct_supertypes" do
|
55
|
+
it "should give back an empty Array if Topic has no supertypes" do
|
56
|
+
@topic1.direct_supertypes.should be_empty
|
57
|
+
@topic1.direct_supertypes.should_not be_nil
|
58
|
+
end
|
59
|
+
it "should not create typing topics" do
|
60
|
+
@topic1.direct_supertypes
|
61
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
62
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
63
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
64
|
+
end
|
65
|
+
it "should give back the direct supertypes" do
|
66
|
+
@t_saeuger.should have(1).direct_supertypes
|
67
|
+
@t_saeuger.direct_supertypes.should include @t_tier
|
68
|
+
@t_affe.should have(2).direct_supertypes
|
69
|
+
@t_affe.direct_supertypes.should include @t_saeuger, @t_tier
|
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
|
+
end
|
80
|
+
|
81
|
+
describe "#direct_subtypes" do
|
82
|
+
it "should give back an empty Array if Topic has no subtypes" do
|
83
|
+
@topic1.direct_subtypes.should be_empty
|
84
|
+
@topic1.direct_subtypes.should_not be_nil
|
85
|
+
end
|
86
|
+
it "should not create typing topics" do
|
87
|
+
@topic1.direct_subtypes
|
88
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
89
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
90
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
91
|
+
end
|
92
|
+
it "should give back the direct subtypes" do
|
93
|
+
@t_saeuger.should have(2).direct_subtypes
|
94
|
+
@t_saeuger.direct_subtypes.should include @t_affe, @t_mensch
|
95
|
+
@t_affe.direct_subtypes.should be_empty
|
96
|
+
@t_lebewesen.should have(1).direct_subtypes
|
97
|
+
@t_lebewesen.direct_subtypes.should include @t_tier
|
98
|
+
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
|
+
end
|
107
|
+
|
108
|
+
describe "#transitive_supertypes" do
|
109
|
+
it "should give back an empty Array if Topic has no transitive supertypes" do
|
110
|
+
@topic1.transitive_supertypes.should be_empty
|
111
|
+
@topic1.transitive_supertypes.should_not be_nil
|
112
|
+
@t_lebewesen.transitive_supertypes.should be_empty
|
113
|
+
@t_lebewesen.transitive_supertypes.should_not be_nil
|
114
|
+
end
|
115
|
+
it "should not create typing topics" do
|
116
|
+
@topic1.transitive_supertypes
|
117
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
118
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
119
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
120
|
+
end
|
121
|
+
it "should give back the transitive supertypes" do
|
122
|
+
@t_mensch.should have(3).transitive_supertypes
|
123
|
+
@t_mensch.transitive_supertypes.should include @t_saeuger, @t_tier, @t_lebewesen
|
124
|
+
@t_saeuger.should have(2).transitive_supertypes
|
125
|
+
@t_saeuger.transitive_supertypes.should include @t_tier, @t_lebewesen
|
126
|
+
@t_affe.should have(3).transitive_supertypes
|
127
|
+
@t_affe.transitive_supertypes.should include @t_saeuger, @t_tier, @t_lebewesen
|
128
|
+
@t_tier.should have(1).transitive_supertypes
|
129
|
+
@t_tier.transitive_supertypes.should include @t_lebewesen
|
130
|
+
@t_lebewesen.transitive_supertypes.should be_empty
|
131
|
+
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
|
+
end
|
136
|
+
|
137
|
+
describe "#transitive_subtypes" do
|
138
|
+
it "should give back an empty Array if Topic has no transitive subtypes" do
|
139
|
+
@topic1.transitive_subtypes.should be_empty
|
140
|
+
@topic1.transitive_subtypes.should_not be_nil
|
141
|
+
@t_mensch.transitive_subtypes.should be_empty
|
142
|
+
@t_mensch.transitive_subtypes.should_not be_nil
|
143
|
+
end
|
144
|
+
it "should not create typing topics" do
|
145
|
+
@topic1.transitive_subtypes
|
146
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
147
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
148
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
149
|
+
end
|
150
|
+
it "should give back the transitive subtypes" do
|
151
|
+
@t_mensch.transitive_subtypes.should be_empty
|
152
|
+
@t_saeuger.should have(2).transitive_subtypes
|
153
|
+
@t_saeuger.transitive_subtypes.should include @t_affe, @t_mensch
|
154
|
+
@t_affe.transitive_subtypes.should be_empty
|
155
|
+
@t_tier.should have(3).transitive_subtypes
|
156
|
+
@t_tier.transitive_subtypes.should include @t_affe, @t_saeuger, @t_mensch
|
157
|
+
@t_lebewesen.should have(4).transitive_subtypes
|
158
|
+
@t_lebewesen.transitive_subtypes.should include @t_tier, @t_saeuger, @t_affe, @t_mensch
|
159
|
+
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
|
+
end
|
164
|
+
|
165
|
+
describe "#add_supertype" do
|
166
|
+
before(:each) do
|
167
|
+
@topic1.direct_supertypes.should be_empty
|
168
|
+
@tm_empty.get("topic2").should be_nil
|
169
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
170
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
171
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
172
|
+
@assoc = @topic1.add_supertype("topic2")
|
173
|
+
end
|
174
|
+
it "should create the typing topics if not present" do
|
175
|
+
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
176
|
+
@tm_empty.get(RTM::PSI[:supertype]).should_not be_nil
|
177
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should_not be_nil
|
178
|
+
end
|
179
|
+
it "should add exactly one supertype at a time" do
|
180
|
+
@topic1.should have(1).direct_supertypes
|
181
|
+
end
|
182
|
+
it "should create the supertyping topic" do
|
183
|
+
@tm_empty.get("topic2").should_not == nil
|
184
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 1
|
185
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic2")
|
186
|
+
end
|
187
|
+
it "should set the Topic as subtype" do
|
188
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 1
|
189
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.player.should == @topic1
|
190
|
+
end
|
191
|
+
it "should create a supertype_subtype association" do
|
192
|
+
@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
|
+
end
|
195
|
+
it "should create a supertype_subtype association with exactly two roles" do
|
196
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
197
|
+
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
|
+
end
|
209
|
+
|
210
|
+
describe "#add_subtype" do
|
211
|
+
before(:each) do
|
212
|
+
@topic1.direct_subtypes.should be_empty
|
213
|
+
@tm_empty.get("topic0").should be_nil
|
214
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
215
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
216
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
217
|
+
@assoc = @topic1.add_subtype("topic0")
|
218
|
+
end
|
219
|
+
it "should create the typing topics if not present" do
|
220
|
+
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
221
|
+
@tm_empty.get(RTM::PSI[:supertype]).should_not be_nil
|
222
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should_not be_nil
|
223
|
+
end
|
224
|
+
it "should add exactly one subtype at a time" do
|
225
|
+
@topic1.should have(1).direct_subtypes
|
226
|
+
end
|
227
|
+
it "should create the subtyping topic" do
|
228
|
+
@tm_empty.get("topic0").should_not == nil
|
229
|
+
@tm_empty.get("topic0").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 1
|
230
|
+
@tm_empty.get("topic0").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic0")
|
231
|
+
end
|
232
|
+
it "should set the Topic as supertype" do
|
233
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 1
|
234
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.player.should == @topic1
|
235
|
+
end
|
236
|
+
it "should create a supertype_subtype association" do
|
237
|
+
@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
|
+
end
|
240
|
+
it "should create a supertype_subtype association with exactly two roles" do
|
241
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
242
|
+
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
|
+
end
|
254
|
+
|
255
|
+
describe "#add_subtypes" do
|
256
|
+
before(:each) do
|
257
|
+
@topic1.direct_supertypes.should be_empty
|
258
|
+
@tm_empty.get("topic2").should be_nil
|
259
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
260
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
261
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
262
|
+
@resulting_assocs = @topic1.add_subtypes("topic2", "topic3")
|
263
|
+
end
|
264
|
+
it "should create the typing topics if not present" do
|
265
|
+
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
266
|
+
@tm_empty.get(RTM::PSI[:supertype]).should_not be_nil
|
267
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should_not be_nil
|
268
|
+
end
|
269
|
+
it "should add several subtypes" do
|
270
|
+
@topic1.should have(2).direct_subtypes
|
271
|
+
end
|
272
|
+
it "should create the subtyping topics" do
|
273
|
+
@tm_empty.get("topic2").should_not be_nil
|
274
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 1
|
275
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic2")
|
276
|
+
###
|
277
|
+
@tm_empty.get("topic3").should_not be_nil
|
278
|
+
@tm_empty.get("topic3").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 1
|
279
|
+
@tm_empty.get("topic3").roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic3")
|
280
|
+
end
|
281
|
+
it "should set the Topic as supertype" do
|
282
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 2
|
283
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.player.should == @topic1
|
284
|
+
end
|
285
|
+
it "should create supertype_subtype associations" do
|
286
|
+
@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
|
+
end
|
291
|
+
it "should create a supertype_subtype association with exactly two roles" do
|
292
|
+
@topic1.roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
293
|
+
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
|
+
it "should be tested further"
|
301
|
+
end
|
302
|
+
|
303
|
+
describe "#add_supertypes" do
|
304
|
+
before(:each) do
|
305
|
+
@topic1.direct_supertypes.should be_empty
|
306
|
+
@tm_empty.get("topic2").should be_nil
|
307
|
+
@tm_empty.get("topic3").should be_nil
|
308
|
+
@tm_empty.get(RTM::PSI[:subtype]).should be_nil
|
309
|
+
@tm_empty.get(RTM::PSI[:supertype]).should be_nil
|
310
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should be_nil
|
311
|
+
@resulting_assocs = @topic1.add_supertypes("topic2", "topic3")
|
312
|
+
end
|
313
|
+
it "should create the typing topics if not present" do
|
314
|
+
@tm_empty.get(RTM::PSI[:subtype]).should_not be_nil
|
315
|
+
@tm_empty.get(RTM::PSI[:supertype]).should_not be_nil
|
316
|
+
@tm_empty.get(RTM::PSI[:supertype_subtype]).should_not be_nil
|
317
|
+
end
|
318
|
+
it "should add several supertypes" do
|
319
|
+
@topic1.should have(2).direct_supertypes
|
320
|
+
end
|
321
|
+
it "should create the supertyping topics" do
|
322
|
+
@tm_empty.get("topic2").should_not be_nil
|
323
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 1
|
324
|
+
@tm_empty.get("topic2").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic2")
|
325
|
+
###
|
326
|
+
@tm_empty.get("topic3").should_not be_nil
|
327
|
+
@tm_empty.get("topic3").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).size.should == 1
|
328
|
+
@tm_empty.get("topic3").roles(RTM::PSI[:supertype],RTM::PSI[:supertype_subtype]).first.player.should == @tm_empty.get("topic3")
|
329
|
+
end
|
330
|
+
it "should set the Topic as subtype" do
|
331
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).size.should == 2
|
332
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.player.should == @topic1
|
333
|
+
end
|
334
|
+
it "should create supertype_subtype associations" do
|
335
|
+
@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
|
+
end
|
340
|
+
it "should create a supertype_subtype association with exactly two roles" do
|
341
|
+
@topic1.roles(RTM::PSI[:subtype],RTM::PSI[:supertype_subtype]).first.parent.roles.size.should == 2
|
342
|
+
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
|
+
it "should be tested further"
|
350
|
+
end
|
351
|
+
|
352
|
+
describe "#supertypes" do
|
353
|
+
it "should call transitive_supertypes" do
|
354
|
+
@topic1.method(:supertypes).should == @topic1.method(:transitive_supertypes)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
describe "#subtypes" do
|
358
|
+
it "should call transitive_subtypes" do
|
359
|
+
@topic1.method(:subtypes).should == @topic1.method(:transitive_subtypes)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
describe "#reverse_supertypes" do
|
363
|
+
it "should call subtypes" do
|
364
|
+
@topic1.method(:reverse_supertypes).should == @topic1.method(:subtypes)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
describe "#reverse_subtypes" do
|
368
|
+
it "should call supertypes" do
|
369
|
+
@topic1.method(:reverse_subtypes).should == @topic1.method(:supertypes)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
|
376
|
+
|