rtm-javatmapi 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/DISCLAIMER +13 -0
  2. data/LICENSE +201 -0
  3. data/README +4 -0
  4. data/lib/rtm/javatmapi.rb +189 -0
  5. data/lib/rtm/javatmapi/aliases.rb +43 -0
  6. data/lib/rtm/javatmapi/base.rb +30 -0
  7. data/lib/rtm/javatmapi/core.rb +16 -0
  8. data/lib/rtm/javatmapi/core/association.rb +71 -0
  9. data/lib/rtm/javatmapi/core/construct.rb +68 -0
  10. data/lib/rtm/javatmapi/core/locator.rb +24 -0
  11. data/lib/rtm/javatmapi/core/name.rb +101 -0
  12. data/lib/rtm/javatmapi/core/occurrence.rb +56 -0
  13. data/lib/rtm/javatmapi/core/reifiable.rb +48 -0
  14. data/lib/rtm/javatmapi/core/role.rb +49 -0
  15. data/lib/rtm/javatmapi/core/scoped.rb +99 -0
  16. data/lib/rtm/javatmapi/core/topic.rb +454 -0
  17. data/lib/rtm/javatmapi/core/topic_map.rb +632 -0
  18. data/lib/rtm/javatmapi/core/topic_map_system.rb +6 -0
  19. data/lib/rtm/javatmapi/core/typed.rb +31 -0
  20. data/lib/rtm/javatmapi/core/variant.rb +19 -0
  21. data/lib/rtm/javatmapi/ext.rb +4 -0
  22. data/lib/rtm/javatmapi/ext/java_util_set.rb +10 -0
  23. data/lib/rtm/javatmapi/inclusion.rb +46 -0
  24. data/lib/rtm/javatmapi/java_implementations.rb +40 -0
  25. data/lib/rtm/javatmapi/javalibs/asm-2.2.3.jar +0 -0
  26. data/lib/rtm/javatmapi/javalibs/asm-commons-2.2.3.jar +0 -0
  27. data/lib/rtm/javatmapi/javalibs/ctm-writer-1.0.0a.jar +0 -0
  28. data/lib/rtm/javatmapi/javalibs/jing.jar +0 -0
  29. data/lib/rtm/javatmapi/javalibs/json_simple.jar +0 -0
  30. data/lib/rtm/javatmapi/javalibs/log4j-1.2.14.jar +0 -0
  31. data/lib/rtm/javatmapi/javalibs/ocutil-2.4.2.jar +0 -0
  32. data/lib/rtm/javatmapi/javalibs/openrdf-sesame-2.2.1-onejar.jar +0 -0
  33. data/lib/rtm/javatmapi/javalibs/poi-3.2-FINAL.jar +0 -0
  34. data/lib/rtm/javatmapi/javalibs/poi-3.5-beta6-20090622.jar +0 -0
  35. data/lib/rtm/javatmapi/javalibs/poi-contrib-3.5-beta6-20090622.jar +0 -0
  36. data/lib/rtm/javatmapi/javalibs/poi-ooxml-3.5-beta6-20090622.jar +0 -0
  37. data/lib/rtm/javatmapi/javalibs/poi-scratchpad-3.2-FINAL.jar +0 -0
  38. data/lib/rtm/javatmapi/javalibs/poi-scratchpad-3.5-beta6-20090622.jar +0 -0
  39. data/lib/rtm/javatmapi/javalibs/semagia-mio-0.9.5.jar +0 -0
  40. data/lib/rtm/javatmapi/javalibs/semagia-mio-ctm-0.9.3-working-draft-2009-02-18.jar +0 -0
  41. data/lib/rtm/javatmapi/javalibs/semagia-mio-jtm-0.9.4.jar +0 -0
  42. data/lib/rtm/javatmapi/javalibs/semagia-mio-ltm-0.9.5.jar +0 -0
  43. data/lib/rtm/javatmapi/javalibs/semagia-mio-snello-0.9.3.jar +0 -0
  44. data/lib/rtm/javatmapi/javalibs/semagia-mio-tmxml-0.9.5.jar +0 -0
  45. data/lib/rtm/javatmapi/javalibs/semagia-mio-xtm-0.9.5.jar +0 -0
  46. data/lib/rtm/javatmapi/javalibs/slf4j-api-1.5.8.jar +0 -0
  47. data/lib/rtm/javatmapi/javalibs/slf4j-log4j12-1.5.8.jar +0 -0
  48. data/lib/rtm/javatmapi/javalibs/tinytim-mio-2.0.0a5.jar +0 -0
  49. data/lib/rtm/javatmapi/javalibs/tmapi-2.0a2.jar +0 -0
  50. data/lib/rtm/javatmapi/javalibs/tmapix-io-0.3.0-snapshot-200910281502.jar +0 -0
  51. data/lib/rtm/javatmapi/javalibs/trove-2.0.4.jar +0 -0
  52. data/lib/rtm/javatmapi/superiseable.rb +74 -0
  53. metadata +118 -0
@@ -0,0 +1,99 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ module Java::OrgTmapiCore::Scoped
5
+
6
+ extend Superiseable
7
+ #include RTM::Scoped
8
+
9
+ # Returns the Topics which define the scope of this scoped Construct.
10
+ # An empty Set represents the unconstrained scope.
11
+ #
12
+ # :call-seq:
13
+ # scope -> Set of Topics
14
+ #
15
+ def scope
16
+ getScope
17
+ end
18
+ alias :themes :scope
19
+
20
+ superised
21
+ # Adds a topic given by the identifier to the scope.
22
+ #
23
+ # Identifier may be a Topic or Topic-Reference.
24
+ #
25
+ # :call-seq:
26
+ # add_theme(identifier)
27
+ #
28
+ def add_theme(identifier)
29
+ if identifier.is_a?(Java::OrgTmapiCore::Topic)
30
+ addTheme(identifier)
31
+ elsif identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String)
32
+ addTheme(topic_map.get!(identifier))
33
+ else
34
+ raise("Identifier must be a Topic, String or Locator")
35
+ end
36
+ end
37
+
38
+ # Adds one or several topics to the scope.
39
+ #
40
+ # An identifier may be a Topic or Topic-Reference.
41
+ #
42
+ # :call-seq:
43
+ # add_themes(identifier)
44
+ # add_themes(identifier1, identifier2, ...)
45
+ #
46
+ def add_themes(*args)
47
+ args.flatten!
48
+ args.each do |identifier|
49
+ add_theme(identifier)
50
+ end
51
+ end
52
+ alias :add_scope :add_themes
53
+
54
+ # Future version, TODO
55
+ # def set_scope(*args)
56
+ #
57
+ # end
58
+ # alias :scope= :set_scope
59
+
60
+ superised
61
+ # Removes a topic given by the identifier from the current scope.
62
+ #
63
+ # Identifier may be a Topic or Topic-Reference.
64
+ #
65
+ # :call-seq:
66
+ # remove_theme(identifier)
67
+ #
68
+ def remove_theme(identifier)
69
+ if identifier.is_a?(Java::OrgTmapiCore::Topic)
70
+ removeTheme(identifier)
71
+ elsif identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String)
72
+ removeTheme(topic_map.get!(identifier))
73
+ else
74
+ raise("Identifier must be a Topic, String or Locator")
75
+ end
76
+ end
77
+
78
+ # Removes one or several topics from the scope.
79
+ #
80
+ # An identifier may be a Topic or Topic-Reference.
81
+ #
82
+ # :call-seq:
83
+ # remove_themes(identifier)
84
+ # remove_themes(identifier1, identifier2, ...)
85
+ #
86
+ def remove_themes(*args)
87
+ args.flatten!
88
+ args.each do |identifier|
89
+ remove_theme(identifier)
90
+ end
91
+ end
92
+ alias :remove_scope :remove_themes
93
+
94
+ # Future version, TODO
95
+ # def delete_scope(*args)
96
+ #
97
+ # end
98
+
99
+ end
@@ -0,0 +1,454 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ module Java::OrgTmapiCore::Topic
5
+
6
+ #include RTM::Topic
7
+ extend Superiseable
8
+
9
+ # Returns all Names and Occurrences parented by this Topic.
10
+ #
11
+ # :call-seq:
12
+ # children -> Array of Names and/or Occurrences
13
+ #
14
+ def children
15
+ getNames.to_a + getOccurrences.to_a
16
+ end
17
+ alias :reverse_parent :children
18
+
19
+ superised
20
+ # Returns Names of this Topic.
21
+ #
22
+ # If identifier is given, returns the Names
23
+ # of this Topic for which the Name type equals identifier.
24
+ # If several identifiers are given, returns the union
25
+ # of all Names of this Topic, which have one of
26
+ # the identifiers as Name type.
27
+ #
28
+ # If the identifier equals :default, all Names
29
+ # which have the default Name type are returned.
30
+ #
31
+ # Identifier may be a Topic/Topic-Reference or Symbol;
32
+ # or an Array of these.
33
+ #
34
+ # :call-seq:
35
+ # names -> Set of Names
36
+ # names(identifier) -> Set of Names
37
+ #
38
+ def names(*args)
39
+ identifier = args.flatten
40
+ return getNames if identifier.empty?
41
+ if identifier.size > 1
42
+ result = java.util.HashSet.new
43
+ identifier.each{|i| result.addAll(names(i))}
44
+ return result
45
+ else
46
+ identifier = identifier[0]
47
+ return getNames if identifier == :any
48
+ return getNames(topic_map.get(RTM::PSI[:name_type])) if identifier == :default
49
+ identifier = topic_map.get(identifier)
50
+ return java.util.HashSet.new unless identifier
51
+ return getNames(identifier)
52
+ end
53
+ end
54
+
55
+ superised
56
+ # Returns Occurrences of this Topic.
57
+ #
58
+ # If identifier is given, returns the Occurrences
59
+ # of this Topic for which the Occurrence type equals identifier.
60
+ # If several identifiers are given, returns the union
61
+ # of all Occurrences of this Topic, which have one of
62
+ # the identifiers as Occurrence type.
63
+ #
64
+ # Identifier may be a Topic/Topic-Reference or an Array of these.
65
+ #
66
+ # :call-seq:
67
+ # occurrences -> Set of Occurrences
68
+ # occurrences(identifier) -> Set of Occurrences
69
+ #
70
+ def occurrences(*args)
71
+ identifier = args.flatten
72
+ return getOccurrences if identifier.empty?
73
+ if identifier.size > 1
74
+ result = java.util.HashSet.new
75
+ identifier.each{|i| result.addAll(occurrences(i))}
76
+ return result
77
+ else
78
+ identifier = identifier[0]
79
+ return getOccurrences if identifier == :any
80
+ identifier = topic_map.get(identifier)
81
+ return java.util.HashSet.new unless identifier
82
+ return getOccurrences(identifier)
83
+ end
84
+ end
85
+
86
+ superised
87
+ # Creates a Name for this Topic with the specified value.
88
+ # Value has to be a String.
89
+ #
90
+ # Type may be a Topic/Topic-Reference.
91
+ # If given, type specifies the Name Type;
92
+ # else the created Name will have the default name type.
93
+ #
94
+ # Scope must be an Array of Topics/Topic-References.
95
+ # If given, scope specifies the Name scope; else the Name is
96
+ # in the unconstrained scope.
97
+ #
98
+ # :call-seq:
99
+ # create_name(value) -> Name
100
+ # create_name(value, scope) -> Name
101
+ # create_name(type, value) -> Name
102
+ # create_name(type, value, scope) -> Name
103
+ #
104
+ def create_name(arg1,arg2 = :nothing, arg3 = :nothing)
105
+ if (arg2 == :nothing) && (arg3 == :nothing) #arg1 = value
106
+ raise "create_name(value): value must be a String" unless arg1.is_a?(String)
107
+ return createName(arg1,[].to_java(org.tmapi.core.Topic))
108
+ end
109
+ if (arg3 == :nothing)
110
+ if arg2.is_a?(Array) #arg1 = value, arg2 = scope
111
+ raise "create_name(value, scope): value must be a String" unless arg1.is_a?(String)
112
+ arg2.each do |theme|
113
+ raise "create_name(value, scope): scope must be an Array of Topics/Topic-References" unless (theme.is_a?(String) || theme.is_a?(Java::OrgTmapiCore::Topic) || theme.is_a?(Java::OrgTmapiCore::Locator))
114
+ end
115
+ return arg2.empty? ? createName(arg1,[].to_java(org.tmapi.core.Topic)) : createName(arg1,topic_map.get!(arg2))
116
+ elsif arg2.is_a?(String) #arg1 = type, arg2 = value
117
+ raise "create_name(type, value): type must be a Topic/Topic-Reference" unless (arg1.is_a?(String) || arg1.is_a?(Java::OrgTmapiCore::Topic) || arg1.is_a?(Java::OrgTmapiCore::Locator))
118
+ return createName(topic_map.get!(arg1),arg2,[].to_java(org.tmapi.core.Topic))
119
+ else
120
+ raise "create_name(?,?): arguments don't match"
121
+ end
122
+ end
123
+ #arg1 = type, arg2 = value, arg3 = scope
124
+ raise "create_name(type, value, scope): type must be a Topic/Topic-Reference" unless (arg1.is_a?(String) || arg1.is_a?(Java::OrgTmapiCore::Topic) || arg1.is_a?(Java::OrgTmapiCore::Locator))
125
+ raise "create_name(type, value, scope): value must be a String" unless arg2.is_a?(String)
126
+ raise "create_name(type, value, scope): scope must be an Array" unless arg3.is_a?(Array)
127
+ arg3.each do |theme|
128
+ raise "create_name(type, value, scope): scope must be an Array of Topics/Topic-References" unless (theme.is_a?(String) || theme.is_a?(Java::OrgTmapiCore::Topic) || theme.is_a?(Java::OrgTmapiCore::Locator))
129
+ end
130
+ return createName(topic_map.get!(arg1),arg2,topic_map.get!(arg3))
131
+ end
132
+
133
+ superised
134
+ # Creates an Occurrence for this Topic with the specified type and value and
135
+ # optional scope and datatype.
136
+ #
137
+ # Type specifies the Occurrence type and may be a Topic, String or Locator.
138
+ #
139
+ # Value may be a Locator (then the datatype is set to xsd:AnyURI and
140
+ # must not be given) or String.
141
+ #
142
+ # Scope may be an Array of Topics/Topic-References. If no scope
143
+ # is given, the Occurrence will be in the unconstrained scope.
144
+ #
145
+ # Datatype may be a String or Locator and indicates the datatype of the value.
146
+ #
147
+ # :call-seq:
148
+ # create_occurrence(type, value) -> Occurrence
149
+ # create_occurrence(type, value, {:scope => scope}) -> Occurrence
150
+ # create_occurrence(type, value, {:datatype => datatype, :scope => scope}) -> Occurrence
151
+ # create_occurrence(type, value, {:datatype => datatype}) -> Occurrence
152
+ #
153
+ def create_occurrence(type,value,params={})
154
+ if params[:scope]
155
+ raise("scope must be an Array") unless params[:scope].is_a?(Array)
156
+ if (value.is_a? Java::OrgTmapiCore::Locator) || !params[:datatype]
157
+ return createOccurrence(topic_map.get!(type),value,topic_map.get!(params[:scope]))
158
+ else # datatype given, no locator
159
+ return createOccurrence(topic_map.get!(type),value,topic_map.create_locator(params[:datatype]),topic_map.get!(params[:scope]))
160
+ end
161
+ else #no scope
162
+ if (value.is_a? Java::OrgTmapiCore::Locator) || !params[:datatype]
163
+ return createOccurrence(topic_map.get!(type),value,[].to_java(org.tmapi.core.Topic))
164
+ else #datatype given, no locator
165
+ return createOccurrence(topic_map.get!(type),value,topic_map.create_locator(params[:datatype]),[].to_java(org.tmapi.core.Topic))
166
+ end
167
+ end
168
+ end
169
+
170
+
171
+ # Returns the TopicMap the Topic belongs to.
172
+ #
173
+ # :call-seq:
174
+ # parent -> TopicMap
175
+ #
176
+ def parent
177
+ getParent
178
+ end
179
+ alias :reverse_children :parent
180
+
181
+ # Calls TMAPI TopicMap.getIndex which
182
+ # returns the index for the TypeInstanceIndex.
183
+ #
184
+ # :call-seq:
185
+ # type_instance_index -> TypeInstanceIndex
186
+ #
187
+ def type_instance_index
188
+ topic_map.type_instance_index
189
+ end
190
+
191
+ superised
192
+ # Returns the Roles played by this Topic.
193
+ #
194
+ # If given, rtype specifies the type of the Roles to be returned;
195
+ # If given, atype specifies the type of the Association
196
+ # from which the returned Roles must be part of.
197
+ #
198
+ # rtype and atype may be a Topic/Topic-Reference or Arrays of these types.
199
+ #
200
+ # The result may be empty.
201
+ #
202
+ # :call-seq:
203
+ # roles -> Array of Roles
204
+ # roles(rtype) -> Array of Roles
205
+ # roles(rtype, atype) -> Array of Roles
206
+ #
207
+ def roles_played(rtype=:any, atype=:any)
208
+
209
+ if rtype == :any # -> atype may only be :any
210
+ if atype == :any
211
+ return getRolesPlayed
212
+ else
213
+ raise "Associationtype may only be specified if rtype are specified"
214
+ end
215
+ end
216
+
217
+ # Assume, that rtype is given or set to nil
218
+ # atype may be :any
219
+ rtype = topic_map.get(rtype)
220
+ return Array.new if rtype == nil || (rtype.is_a?(Array) && rtype.include?(nil))
221
+ #Assume that rtype is given and found
222
+
223
+ unless atype == :any
224
+ atype = topic_map.get(atype)
225
+ return Array.new if atype == nil || (atype.is_a?(Array) && atype.include?(nil))
226
+ end
227
+ #Assume that if atype is given, it's found
228
+
229
+ if rtype.is_a?(Array) #several rtype
230
+ if atype == :any #no atype
231
+ return rtype.map{|r| roles_played(r)}.inject(java.util.HashSet.new){|union,element| union.addAll(element); union}
232
+ elsif atype.is_a?(Array) #several atype
233
+ return rtype.map{|r| roles_played(r,atype)}.inject(java.util.HashSet.new){|union,element| union.addAll(element); union}
234
+ else #one associationtype
235
+ return rtype.map{|r| roles_played(r,atype)}.inject(java.util.HashSet.new){|union,element| union.addAll(element); union}
236
+ end
237
+ else #one roletype
238
+ if atype == :any #no atype
239
+ return getRolesPlayed(rtype)
240
+ elsif atype.is_a?(Array) #several atype
241
+ return atype.map{|a| roles_played(rtype,a)}.inject(java.util.HashSet.new){|union,element| union.addAll(element); union}
242
+ else #one associationtype
243
+ return getRolesPlayed(rtype,atype)
244
+ end
245
+ end
246
+ end
247
+ alias :roles :roles_played
248
+
249
+ # Returns the subject identifiers assigned to the current topic.
250
+ #
251
+ # :call-seq:
252
+ # subject_identifiers -> Set of Locators
253
+ #
254
+ def subject_identifiers
255
+ getSubjectIdentifiers
256
+ end
257
+
258
+ superised
259
+ # Adds a subject identifier to the current Topic.
260
+ # Identifier may be a String or Locator.
261
+ #
262
+ # :call-seq:
263
+ # add_subject_identifier(identifier)
264
+ #
265
+ def add_subject_identifier(identifier)
266
+ if identifier.is_a? Java::OrgTmapiCore::Locator
267
+ addSubjectIdentifier(identifier)
268
+ else
269
+ addSubjectIdentifier(topic_map.create_locator(identifier))
270
+ end
271
+ end
272
+ alias :subject_identifiers= :add_subject_identifier
273
+
274
+ superised
275
+ # Adds a subject locator to the current topic.
276
+ # Identifier may be a String or Locator.
277
+ #
278
+ # :call-seq:
279
+ # add_subject_locator(identifier)
280
+ #
281
+ def add_subject_locator(identifier)
282
+ # TODO Spec
283
+ if identifier.is_a? Java::OrgTmapiCore::Locator
284
+ addSubjectLocator(identifier)
285
+ else
286
+ addSubjectLocator(topic_map.create_locator(identifier))
287
+ end
288
+ end
289
+ alias :subject_locators= :add_subject_locator
290
+
291
+ superised
292
+ # Removes a subject identifier from the this Topic,
293
+ # if present.
294
+ #
295
+ # Identifier may be a String or Locator.
296
+ #
297
+ # :call-seq:
298
+ # remove_subject_identifier(identifier)
299
+ #
300
+ def remove_subject_identifier(identifier)
301
+ identifier = topic_map.create_locator(identifier) if identifier.is_a? String
302
+ removeSubjectIdentifier(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
303
+ end
304
+
305
+
306
+ superised
307
+ # Removes a subject locator from the this Topic,
308
+ # if present.
309
+ #
310
+ # Identifier may be a String or Locator.
311
+ #
312
+ # :call-seq:
313
+ # remove_subject_locator(identifier)
314
+ #
315
+ def remove_subject_locator(identifier)
316
+ identifier = topic_map.create_locator(identifier) if identifier.is_a? String
317
+ removeSubjectLocator(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
318
+ end
319
+
320
+ # superised
321
+ # # Removes an item identifer from the this Topic,
322
+ # # if present.
323
+ # #
324
+ # # Identifier may be a String or Locator.
325
+ # #
326
+ # # :call-seq:
327
+ # # remove_item_identifier(identifier)
328
+ # #
329
+ # def remove_item_identifier(identifier)
330
+ # identifier = topic_map.create_locator(identifier) if identifier.is_a? String
331
+ # removeItemIdentifier(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
332
+ # end
333
+
334
+ superised
335
+ # Adds a type given by the identifier to this Topic.
336
+ #
337
+ # Identifier may be a Topic or Topic-Reference.
338
+ #
339
+ # :call-seq:
340
+ # add_type(identifier)
341
+ #
342
+ def add_type(identifier)
343
+ if identifier.is_a?(Java::OrgTmapiCore::Topic)
344
+ addType(identifier)
345
+ elsif identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String)
346
+ addType(topic_map.get!(identifier))
347
+ else
348
+ raise("Identifier must be a Topic, String or Locator")
349
+ end
350
+ end
351
+
352
+ # Adds one or several types given by the identifiers.
353
+ #
354
+ # Identifier may be a Topic or Topic-Reference.
355
+ #
356
+ # :call-seq:
357
+ # add_types(identifier1, identifier2, ...)
358
+ #
359
+ def add_types(*args)
360
+ args.flatten!
361
+ args.each do |identifier|
362
+ add_type(identifier)
363
+ end
364
+ end
365
+
366
+
367
+ # Adds an instance given by the identifier to this Topic.
368
+ #
369
+ # Identifier may be a Topic or Topic-Reference.
370
+ #
371
+ # :call-seq:
372
+ # add_instance(identifier)
373
+ #
374
+ def add_instance(identifier)
375
+ if identifier.is_a?(Java::OrgTmapiCore::Topic)
376
+ identifier.addType(self)
377
+ elsif identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String)
378
+ topic_map.get!(identifier).addType(self)
379
+ else
380
+ raise("Identifier must be a Topic, String or Locator")
381
+ end
382
+ end
383
+
384
+ # Adds one or several instances given by the identifiers.
385
+ #
386
+ # Identifier may be a Topic or Topic-Reference.
387
+ #
388
+ # :call-seq:
389
+ # add_instances(identifier1, identifier2, ...)
390
+ #
391
+ def add_instances(*args)
392
+ args.flatten!
393
+ args.each do |identifier|
394
+ add_instance(identifier)
395
+ end
396
+ end
397
+
398
+ # Returns the reifiable Construct which is reified by this Topic
399
+ # or nil if this Topic does not reify a statement.
400
+ #
401
+ # :call-seq:
402
+ # reifier -> Name, Occurrence, Variant, Association, Role or TopicMap
403
+ #
404
+ def reified
405
+ getReified
406
+ end
407
+
408
+ # Sets this Topic as reifier of the reifiable Construct, given by the
409
+ # identifier.
410
+ #
411
+ # Identifier may be a Name, Variant, Occurrence, Association, Role or
412
+ # TopicMap.
413
+ #
414
+ # :call-seq:
415
+ # reified = identifier
416
+ #
417
+ def reified=(identifier)
418
+ if identifier.is_a?(Java::OrgTmapiCore::Reifiable)
419
+ identifier.reifier = self
420
+ return
421
+ end
422
+ raise("reified=: Identifier may be a Name, Variant, Occurrence, Association, Role or TopicMap")
423
+ end
424
+
425
+ superised
426
+ # Removes a type given by the identifier from this Topic,
427
+ # if present.
428
+ #
429
+ # Identifier may be a Topic or Topic-Reference.
430
+ #
431
+ # :call-seq:
432
+ # remove_type(identifier)
433
+ #
434
+ def remove_type(identifier)
435
+ if identifier.is_a? Java::OrgTmapiCore::Topic
436
+ removeType(identifier)
437
+ else
438
+ identifier = topic_map.get(identifier)
439
+ removeType(identifier) if identifier
440
+ end
441
+ end
442
+
443
+
444
+ # TODO extend this, maybe allow for a removal of any topic no matter how important
445
+ # it may be for the whole topic map
446
+ def force_remove
447
+ self.roles_played.to_a.clone.each{|p| p.parent.remove}
448
+ self.remove
449
+ end
450
+
451
+ end
452
+
453
+
454
+