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.
- 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
data/lib/rtm/io/to_xtm1.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
2
4
|
module RTM::IO
|
|
3
5
|
# XTM1 Export
|
|
4
6
|
module TOXTM1
|
|
@@ -98,9 +100,9 @@ module RTM::IO
|
|
|
98
100
|
end
|
|
99
101
|
end
|
|
100
102
|
|
|
101
|
-
module
|
|
103
|
+
module Name
|
|
102
104
|
def to_xtm1
|
|
103
|
-
warn("TOXTM1: Warning: outputting invalid
|
|
105
|
+
warn("TOXTM1: Warning: outputting invalid Name #{self}") unless valid?
|
|
104
106
|
# name = element name { reifiable, type?, scope?, value, variant* }
|
|
105
107
|
x = REXML::Element.new 'name'
|
|
106
108
|
x.add_attribute('reifier', reifier.xtm1_id) if reifier
|
|
@@ -128,7 +130,7 @@ module RTM::IO
|
|
|
128
130
|
end
|
|
129
131
|
end
|
|
130
132
|
|
|
131
|
-
module
|
|
133
|
+
module Role
|
|
132
134
|
def to_xtm1
|
|
133
135
|
warn("TOXTM1: Warning: outputting invalid AssociationRole #{self}") unless valid?
|
|
134
136
|
# role = element role { reifiable, type, topicRef }
|
data/lib/rtm/io/to_xtm2.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
module RTM::IO
|
|
4
6
|
# XTM2 Export.
|
|
@@ -92,7 +94,7 @@ module RTM::IO
|
|
|
92
94
|
# association = element association { reifiable, type, scope?, role+ }
|
|
93
95
|
x = REXML::Element.new 'association'
|
|
94
96
|
x.add_attribute('reifier', reifier.xtm2_id) if reifier
|
|
95
|
-
item_identifiers.each { |ii| x << TOXTM2.
|
|
97
|
+
item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
|
|
96
98
|
x << TOXTM2.type(type) if type
|
|
97
99
|
x << TOXTM2.scope(scope) unless scope.empty?
|
|
98
100
|
roles.each { |r| x << r.to_xtm2 }
|
|
@@ -100,13 +102,13 @@ module RTM::IO
|
|
|
100
102
|
end
|
|
101
103
|
end
|
|
102
104
|
|
|
103
|
-
module
|
|
105
|
+
module Name
|
|
104
106
|
def to_xtm2
|
|
105
|
-
warn("TOXTM2: Warning: outputting invalid
|
|
107
|
+
warn("TOXTM2: Warning: outputting invalid Name #{self}") unless valid?
|
|
106
108
|
# name = element name { reifiable, type?, scope?, value, variant* }
|
|
107
109
|
x = REXML::Element.new 'name'
|
|
108
110
|
x.add_attribute('reifier', reifier.xtm2_id) if reifier
|
|
109
|
-
item_identifiers.each { |ii| x << TOXTM2.
|
|
111
|
+
item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
|
|
110
112
|
x << TOXTM2.type(type) if type
|
|
111
113
|
x << TOXTM2.scope(scope) unless scope.empty?
|
|
112
114
|
(x << REXML::Element.new('value')).text = value # adds the value within a value-element
|
|
@@ -122,7 +124,7 @@ module RTM::IO
|
|
|
122
124
|
# type, scope?, ( resourceRef | resourceData ) }
|
|
123
125
|
x = REXML::Element.new 'occurrence'
|
|
124
126
|
x.add_attribute('reifier', reifier.xtm2_id) if reifier
|
|
125
|
-
item_identifiers.each { |ii| x << TOXTM2.
|
|
127
|
+
item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
|
|
126
128
|
x << TOXTM2.type(type) if type
|
|
127
129
|
x << TOXTM2.scope(scope) unless scope.empty?
|
|
128
130
|
x << TOXTM2.value(datatype, value)
|
|
@@ -136,7 +138,7 @@ module RTM::IO
|
|
|
136
138
|
# role = element role { reifiable, type, topicRef }
|
|
137
139
|
x = REXML::Element.new 'role'
|
|
138
140
|
x.add_attribute('reifier', reifier.xtm2_id) if reifier
|
|
139
|
-
item_identifiers.each { |ii| x << TOXTM2.
|
|
141
|
+
item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
|
|
140
142
|
x << TOXTM2.type(type) if type
|
|
141
143
|
x << player.to_xtm2_ref if player
|
|
142
144
|
x
|
|
@@ -149,7 +151,7 @@ module RTM::IO
|
|
|
149
151
|
# variant = element variant { reifiable, scope, (resourceRef | resourceData) }
|
|
150
152
|
x = REXML::Element.new 'variant'
|
|
151
153
|
x.add_attribute('reifier', reifier.xtm2_id) if reifier
|
|
152
|
-
item_identifiers.each { |ii| x << TOXTM2.
|
|
154
|
+
item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
|
|
153
155
|
x << TOXTM2.scope(scope)
|
|
154
156
|
x << TOXTM2.value(datatype, value)
|
|
155
157
|
x
|
data/lib/rtm/io/to_yaml.rb
CHANGED
|
@@ -1,130 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
2
4
|
module RTM::IO
|
|
3
|
-
#
|
|
4
|
-
# Each Topic Maps Construct gets a
|
|
5
|
-
module
|
|
5
|
+
# Yaml Export.
|
|
6
|
+
# Each Topic Maps Construct gets a to_yaml method.
|
|
7
|
+
module ToYAML
|
|
6
8
|
|
|
7
9
|
module TopicMap
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
y
|
|
16
|
-
end
|
|
17
|
-
# returns the YAML representation of this topic map
|
|
18
|
-
def to_yaml(*a)
|
|
19
|
-
to_yaml_hash.to_yaml(*a)
|
|
10
|
+
# Returns the YAML representation of this topic map as String.
|
|
11
|
+
#
|
|
12
|
+
# :call-seq:
|
|
13
|
+
# to_yaml -> String
|
|
14
|
+
#
|
|
15
|
+
def to_yaml
|
|
16
|
+
to_hash.to_yaml
|
|
20
17
|
end
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
module Topic
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
y['subject_locators'] = subject_locators.map{|i| i.reference} unless subject_locators.empty?
|
|
33
|
-
y['names'] = names.map{|i| i.to_yaml_hash} unless names.empty?
|
|
34
|
-
y['occurrences'] = occurrences.map{|i| i.to_yaml_hash} unless occurrences.empty?
|
|
35
|
-
y
|
|
36
|
-
end
|
|
37
|
-
def to_yaml(*a)
|
|
38
|
-
to_yaml_hash.to_yaml(*a)
|
|
39
|
-
end
|
|
40
|
-
def to_yaml_ref
|
|
41
|
-
if subject_identifiers.first
|
|
42
|
-
return subject_identifiers.first.reference
|
|
43
|
-
end
|
|
44
|
-
if item_identifiers.first
|
|
45
|
-
return item_identifiers.first.reference
|
|
46
|
-
end
|
|
47
|
-
"t#{id}"
|
|
21
|
+
# Returns the YAML representation of this topic as String.
|
|
22
|
+
#
|
|
23
|
+
# :call-seq:
|
|
24
|
+
# to_yaml -> String
|
|
25
|
+
#
|
|
26
|
+
def to_yaml
|
|
27
|
+
to_hash.to_yaml
|
|
48
28
|
end
|
|
49
29
|
end
|
|
50
30
|
|
|
51
31
|
module Association
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
y
|
|
60
|
-
end
|
|
61
|
-
# returns the YAML representation of this association
|
|
62
|
-
def to_yaml(*a)
|
|
63
|
-
to_yaml_hash.to_yaml(*a)
|
|
32
|
+
# Returns the YAML representation of this association as String.
|
|
33
|
+
#
|
|
34
|
+
# :call-seq:
|
|
35
|
+
# to_yaml -> String
|
|
36
|
+
#
|
|
37
|
+
def to_yaml
|
|
38
|
+
to_hash.to_yaml
|
|
64
39
|
end
|
|
65
40
|
end
|
|
66
41
|
|
|
67
|
-
module
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
y['variants'] = variants.map{|i| i.to_yaml_hash} unless variants.empty?
|
|
76
|
-
y
|
|
77
|
-
end
|
|
78
|
-
def to_yaml(*a)
|
|
79
|
-
to_yaml_hash.to_yaml(*a)
|
|
42
|
+
module Name
|
|
43
|
+
# Returns the YAML representation of this name as String.
|
|
44
|
+
#
|
|
45
|
+
# :call-seq:
|
|
46
|
+
# to_yaml -> String
|
|
47
|
+
#
|
|
48
|
+
def to_yaml
|
|
49
|
+
to_hash.to_yaml
|
|
80
50
|
end
|
|
81
51
|
end
|
|
82
52
|
|
|
83
53
|
module Occurrence
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
y['scope'] = scope.map{|i| i.to_yaml_hash} unless scope.empty?
|
|
92
|
-
y
|
|
93
|
-
end
|
|
94
|
-
def to_yaml(*a)
|
|
95
|
-
to_yaml_hash.to_yaml(*a)
|
|
54
|
+
# Returns the YAML representation of this occurrence as String.
|
|
55
|
+
#
|
|
56
|
+
# :call-seq:
|
|
57
|
+
# to_yaml -> String
|
|
58
|
+
#
|
|
59
|
+
def to_yaml
|
|
60
|
+
to_hash.to_yaml
|
|
96
61
|
end
|
|
97
62
|
end
|
|
98
63
|
|
|
99
|
-
module
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
end
|
|
108
|
-
def to_yaml(*a)
|
|
109
|
-
to_yaml_hash.to_yaml(*a)
|
|
64
|
+
module Role
|
|
65
|
+
# Returns the YAML representation of this role as String.
|
|
66
|
+
#
|
|
67
|
+
# :call-seq:
|
|
68
|
+
# to_yaml -> String
|
|
69
|
+
#
|
|
70
|
+
def to_yaml
|
|
71
|
+
to_hash.to_yaml
|
|
110
72
|
end
|
|
111
73
|
end
|
|
112
74
|
|
|
113
75
|
module Variant
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
def to_yaml(*a)
|
|
123
|
-
to_yaml_hash.to_yaml(*a)
|
|
76
|
+
# Returns the YAML representation of this variant as String.
|
|
77
|
+
#
|
|
78
|
+
# :call-seq:
|
|
79
|
+
# to_yaml -> String
|
|
80
|
+
#
|
|
81
|
+
def to_yaml
|
|
82
|
+
to_hash.to_yaml
|
|
124
83
|
end
|
|
125
84
|
end
|
|
126
|
-
|
|
85
|
+
|
|
127
86
|
RTM.register_extension( self )
|
|
87
|
+
|
|
128
88
|
end
|
|
129
89
|
end
|
|
130
|
-
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
require "rtm/navigation/association/players"
|
|
10
|
+
require "rtm/navigation/name/characteristics"
|
|
11
|
+
require "rtm/navigation/name/atomify"
|
|
12
|
+
require "rtm/navigation/occurrence/characteristics"
|
|
13
|
+
require "rtm/navigation/occurrence/atomify"
|
|
14
|
+
require "rtm/navigation/topic/characteristics"
|
|
15
|
+
require "rtm/navigation/topic/indicators"
|
|
16
|
+
require "rtm/navigation/topic/items"
|
|
17
|
+
require "rtm/navigation/topic/locators"
|
|
18
|
+
require "rtm/navigation/topic/players"
|
|
19
|
+
require "rtm/navigation/topic/supertypes"
|
|
20
|
+
require "rtm/navigation/topic/traverse"
|
|
21
|
+
require "rtm/navigation/topic/types"
|
|
22
|
+
|
|
23
|
+
RTM.register_extension(RTM::Navigation)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Association
|
|
7
|
+
|
|
8
|
+
# Returns all players of roles in this association.
|
|
9
|
+
#
|
|
10
|
+
# The optional identifier specifies the type of the roles to be considered.
|
|
11
|
+
# The identifier may be a topic reference.
|
|
12
|
+
#
|
|
13
|
+
# Multiple instances of the same topics are possible.
|
|
14
|
+
#
|
|
15
|
+
# :call-seq:
|
|
16
|
+
# players -> Array of Topics
|
|
17
|
+
# players(identifier) -> Array of Topics
|
|
18
|
+
#
|
|
19
|
+
def players(type = :any)
|
|
20
|
+
return roles(type).map{|r| r.player}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Name
|
|
7
|
+
|
|
8
|
+
# Returns the atomic value of the Characteristic (Name/Occurrence).
|
|
9
|
+
#
|
|
10
|
+
# :call-seq:
|
|
11
|
+
# atomify -> String
|
|
12
|
+
#
|
|
13
|
+
def atomify
|
|
14
|
+
value
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Name
|
|
7
|
+
|
|
8
|
+
# Returns the Topic this Characteristic (Name/Occurrence) belongs to.
|
|
9
|
+
# The optional argument identifier filters the
|
|
10
|
+
# Characteristic for its type. If the type
|
|
11
|
+
# does not match, nil is returned.
|
|
12
|
+
#
|
|
13
|
+
# The identifier may be a topic reference.
|
|
14
|
+
#
|
|
15
|
+
# :call-seq:
|
|
16
|
+
# reverse_characteristics -> Topic
|
|
17
|
+
# reverse_characteristics(identifier) -> Topic or nil
|
|
18
|
+
#
|
|
19
|
+
def reverse_characteristics(type=:any)
|
|
20
|
+
return parent if type == :any
|
|
21
|
+
_topic = topic_map.get(type)
|
|
22
|
+
return nil unless _topic
|
|
23
|
+
#filter the Name/Occurrence for its type:
|
|
24
|
+
if _topic == self.type
|
|
25
|
+
return parent
|
|
26
|
+
else
|
|
27
|
+
return nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Occurrence
|
|
7
|
+
|
|
8
|
+
# Returns the atomic value of the Characteristic (Name/Occurrence).
|
|
9
|
+
#
|
|
10
|
+
# :call-seq:
|
|
11
|
+
# atomify -> String
|
|
12
|
+
#
|
|
13
|
+
def atomify
|
|
14
|
+
value
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Occurrence
|
|
7
|
+
|
|
8
|
+
# Returns the Topic this Characteristic (Name/Occurrence) belongs to.
|
|
9
|
+
# The optional argument identifier filters the
|
|
10
|
+
# Characteristic for its type. If the type
|
|
11
|
+
# does not match, nil is returned.
|
|
12
|
+
#
|
|
13
|
+
# The identifier may be a topic reference.
|
|
14
|
+
#
|
|
15
|
+
# :call-seq:
|
|
16
|
+
# reverse_characteristics -> Topic
|
|
17
|
+
# reverse_characteristics(identifier) -> Topic or nil
|
|
18
|
+
#
|
|
19
|
+
def reverse_characteristics(type=:any)
|
|
20
|
+
return parent if type == :any
|
|
21
|
+
_topic = topic_map.get(type)
|
|
22
|
+
return nil unless _topic
|
|
23
|
+
#filter the Name/Occurrence for its type:
|
|
24
|
+
if _topic == self.type
|
|
25
|
+
return parent
|
|
26
|
+
else
|
|
27
|
+
return nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
|
|
2
|
+
# License: Apache License, Version 2.0
|
|
3
|
+
|
|
4
|
+
module RTM
|
|
5
|
+
module Navigation
|
|
6
|
+
module Topic
|
|
7
|
+
|
|
8
|
+
# Returns all Names and Occurrences of this Topic.
|
|
9
|
+
# If an identifier is given, only those Names and Occurrences are returned,
|
|
10
|
+
# whose type or supertypes include the identifier.
|
|
11
|
+
#
|
|
12
|
+
# Identifier may be a topic reference.
|
|
13
|
+
#
|
|
14
|
+
# The result may be empty.
|
|
15
|
+
#
|
|
16
|
+
# :call-seq:
|
|
17
|
+
# characteristics -> Array of Names and Occurrences
|
|
18
|
+
# characteristics(identifier) -> Array of Names and Occurrences
|
|
19
|
+
#
|
|
20
|
+
def characteristics(type=:any)
|
|
21
|
+
# FIXME which version of the code?
|
|
22
|
+
return names.to_a + occurrences.to_a if type == :any
|
|
23
|
+
_topic = topic_map.get(type)
|
|
24
|
+
return [] unless _topic
|
|
25
|
+
#names.select{|n| n.type.include?(_topic) || n.type.supertypes.include?(_topic)}.to_a +
|
|
26
|
+
#occurrences.select{|o| o.type.include?(_topic) || o.type.supertypes.include?(_topic)}.to_a
|
|
27
|
+
names.select{|n| n.type.supertypes.include?(_topic)}.to_a +
|
|
28
|
+
occurrences.select{|o| o.type.supertypes.include?(_topic)}.to_a
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|