rtm-javatmapi 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rtm/javatmapi.rb +34 -11
- data/lib/rtm/javatmapi/aliases.rb +17 -17
- data/lib/rtm/javatmapi/core.rb +1 -0
- data/lib/rtm/javatmapi/core/association.rb +2 -2
- data/lib/rtm/javatmapi/core/construct.rb +30 -6
- data/lib/rtm/javatmapi/core/datatype_aware.rb +60 -0
- data/lib/rtm/javatmapi/core/locator.rb +4 -8
- data/lib/rtm/javatmapi/core/name.rb +65 -39
- data/lib/rtm/javatmapi/core/occurrence.rb +4 -28
- data/lib/rtm/javatmapi/core/reifiable.rb +7 -17
- data/lib/rtm/javatmapi/core/role.rb +3 -3
- data/lib/rtm/javatmapi/core/scoped.rb +7 -12
- data/lib/rtm/javatmapi/core/topic.rb +132 -61
- data/lib/rtm/javatmapi/core/topic_map.rb +88 -57
- data/lib/rtm/javatmapi/core/typed.rb +2 -2
- data/lib/rtm/javatmapi/core/variant.rb +5 -5
- data/lib/rtm/javatmapi/javalibs/ctm-writer-1.0.0a.jar +0 -0
- data/lib/rtm/javatmapi/javalibs/tmapi-2.0.jar +0 -0
- data/lib/rtm/javatmapi/superiseable.rb +9 -52
- metadata +6 -8
- data/lib/rtm/javatmapi/base.rb +0 -30
- data/lib/rtm/javatmapi/inclusion.rb +0 -46
- data/lib/rtm/javatmapi/java_implementations.rb +0 -40
- data/lib/rtm/javatmapi/javalibs/tmapi-2.0a2.jar +0 -0
@@ -2,8 +2,9 @@
|
|
2
2
|
# License: Apache License, Version 2.0
|
3
3
|
|
4
4
|
module Java::OrgTmapiCore::Occurrence
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
include RTM::Occurrence
|
7
|
+
extend Superiseable
|
7
8
|
|
8
9
|
# Returns the Topic this Occurrence belongs to.
|
9
10
|
#
|
@@ -27,30 +28,5 @@ module Java::OrgTmapiCore::Occurrence
|
|
27
28
|
getValue
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
-
# If argument is a String, this methods sets the string value and
|
32
|
-
# the datatype implicitly to xsd:string.
|
33
|
-
#
|
34
|
-
# If argument is a Locator, this method sets the IRI value and
|
35
|
-
# the datatype implicitly to xsd:anyURI.
|
36
|
-
#
|
37
|
-
# If argument is a Float, this method sets the Float value and
|
38
|
-
# the datatype implicitly to xsd:float.
|
39
|
-
#
|
40
|
-
# If argument is a Fixnum, this method sets Fixnum value and
|
41
|
-
# the datatype implicitly to xsd:long.
|
42
|
-
#
|
43
|
-
# If argument is a Bignum, this method sets Bignum value and
|
44
|
-
# the datatype implicitly to xsd:integer.
|
45
|
-
#
|
46
|
-
# :call-seq:
|
47
|
-
# value=(argument)
|
48
|
-
#
|
49
|
-
def value=(argument)
|
50
|
-
setValue(argument)
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
31
|
end
|
32
|
+
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# License: Apache License, Version 2.0
|
3
3
|
|
4
4
|
module Java::OrgTmapiCore::Reifiable
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
include RTM::Reifiable
|
7
7
|
extend Superiseable
|
8
|
-
|
9
|
-
# Returns the reifier (
|
8
|
+
|
9
|
+
# Returns the reifier (a topic) of this Reifiable
|
10
10
|
# or nil if the Reifiable is not reified.
|
11
11
|
#
|
12
12
|
# :call-seq:
|
@@ -15,22 +15,12 @@ module Java::OrgTmapiCore::Reifiable
|
|
15
15
|
def reifier
|
16
16
|
getReifier
|
17
17
|
end
|
18
|
-
|
19
|
-
# Returns the reifier (Topic) of this Reifiable.
|
20
|
-
# If there is no current reifier, then a reifier will be generated.
|
21
|
-
#
|
22
|
-
# :call-seq:
|
23
|
-
# reifier! -> Topic
|
24
|
-
#
|
25
|
-
def reifier!
|
26
|
-
self.reifier ||= self.topic_map.create_topic
|
27
|
-
end
|
28
|
-
|
18
|
+
|
29
19
|
superised
|
30
20
|
# Sets the reifier of this reifiable Construct.
|
31
21
|
# The specified reifier MUST NOT reify another information item.
|
32
22
|
#
|
33
|
-
# Identifier may be a
|
23
|
+
# Identifier may be a topic reference or nil,
|
34
24
|
# if an existing reifier should be removed.
|
35
25
|
#
|
36
26
|
# :call-seq:
|
@@ -39,7 +29,7 @@ module Java::OrgTmapiCore::Reifiable
|
|
39
29
|
#
|
40
30
|
def reifier=(identifier=nil)
|
41
31
|
unless identifier
|
42
|
-
setReifier(
|
32
|
+
setReifier(nil)
|
43
33
|
return
|
44
34
|
end
|
45
35
|
raise("reifier=: identifier muss be a Topic, Locator or String; not given or nil") unless identifier.is_a?(Java::OrgTmapiCore::Topic) || identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String)
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# License: Apache License, Version 2.0
|
3
3
|
|
4
4
|
module Java::OrgTmapiCore::Role
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
include RTM::Role
|
7
7
|
extend Superiseable
|
8
8
|
|
9
9
|
# Returns the Association to which this Role belongs.
|
@@ -28,7 +28,7 @@ module Java::OrgTmapiCore::Role
|
|
28
28
|
superised
|
29
29
|
# Sets the role player. Any previous role player will be overriden.
|
30
30
|
#
|
31
|
-
# Identifier may be a
|
31
|
+
# Identifier may be a topic reference.
|
32
32
|
#
|
33
33
|
# :call-seq:
|
34
34
|
# player=(identifier)
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
module Java::OrgTmapiCore::Scoped
|
5
5
|
|
6
|
+
include RTM::Scoped
|
6
7
|
extend Superiseable
|
7
|
-
#include RTM::Scoped
|
8
8
|
|
9
9
|
# Returns the Topics which define the scope of this scoped Construct.
|
10
10
|
# An empty Set represents the unconstrained scope.
|
@@ -20,7 +20,7 @@ module Java::OrgTmapiCore::Scoped
|
|
20
20
|
superised
|
21
21
|
# Adds a topic given by the identifier to the scope.
|
22
22
|
#
|
23
|
-
# Identifier may be a
|
23
|
+
# Identifier may be a topic reference.
|
24
24
|
#
|
25
25
|
# :call-seq:
|
26
26
|
# add_theme(identifier)
|
@@ -37,7 +37,7 @@ module Java::OrgTmapiCore::Scoped
|
|
37
37
|
|
38
38
|
# Adds one or several topics to the scope.
|
39
39
|
#
|
40
|
-
# An identifier may be a
|
40
|
+
# An identifier may be a topic reference.
|
41
41
|
#
|
42
42
|
# :call-seq:
|
43
43
|
# add_themes(identifier)
|
@@ -60,24 +60,19 @@ module Java::OrgTmapiCore::Scoped
|
|
60
60
|
superised
|
61
61
|
# Removes a topic given by the identifier from the current scope.
|
62
62
|
#
|
63
|
-
# Identifier may be a
|
63
|
+
# Identifier may be a topic reference.
|
64
64
|
#
|
65
65
|
# :call-seq:
|
66
66
|
# remove_theme(identifier)
|
67
67
|
#
|
68
68
|
def remove_theme(identifier)
|
69
|
-
|
70
|
-
|
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
|
69
|
+
identifier = topic_map.get(identifier)
|
70
|
+
removeTheme(identifier) if identifier.is_a?(Java::OrgTmapiCore::Topic)
|
76
71
|
end
|
77
72
|
|
78
73
|
# Removes one or several topics from the scope.
|
79
74
|
#
|
80
|
-
# An identifier may be a
|
75
|
+
# An identifier may be a topic reference.
|
81
76
|
#
|
82
77
|
# :call-seq:
|
83
78
|
# remove_themes(identifier)
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# License: Apache License, Version 2.0
|
3
3
|
|
4
4
|
module Java::OrgTmapiCore::Topic
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
include RTM::Topic
|
7
7
|
extend Superiseable
|
8
|
-
|
8
|
+
|
9
9
|
# Returns all Names and Occurrences parented by this Topic.
|
10
10
|
#
|
11
11
|
# :call-seq:
|
@@ -28,7 +28,7 @@ module Java::OrgTmapiCore::Topic
|
|
28
28
|
# If the identifier equals :default, all Names
|
29
29
|
# which have the default Name type are returned.
|
30
30
|
#
|
31
|
-
# Identifier may be a
|
31
|
+
# Identifier may be a topic reference or Symbol;
|
32
32
|
# or an Array of these.
|
33
33
|
#
|
34
34
|
# :call-seq:
|
@@ -61,7 +61,7 @@ module Java::OrgTmapiCore::Topic
|
|
61
61
|
# of all Occurrences of this Topic, which have one of
|
62
62
|
# the identifiers as Occurrence type.
|
63
63
|
#
|
64
|
-
# Identifier may be a
|
64
|
+
# Identifier may be a topic reference or an Array of these.
|
65
65
|
#
|
66
66
|
# :call-seq:
|
67
67
|
# occurrences -> Set of Occurrences
|
@@ -87,7 +87,7 @@ module Java::OrgTmapiCore::Topic
|
|
87
87
|
# Creates a Name for this Topic with the specified value.
|
88
88
|
# Value has to be a String.
|
89
89
|
#
|
90
|
-
# Type may be a
|
90
|
+
# Type may be a topic reference.
|
91
91
|
# If given, type specifies the Name Type;
|
92
92
|
# else the created Name will have the default name type.
|
93
93
|
#
|
@@ -104,7 +104,7 @@ module Java::OrgTmapiCore::Topic
|
|
104
104
|
def create_name(arg1,arg2 = :nothing, arg3 = :nothing)
|
105
105
|
if (arg2 == :nothing) && (arg3 == :nothing) #arg1 = value
|
106
106
|
raise "create_name(value): value must be a String" unless arg1.is_a?(String)
|
107
|
-
return createName(arg1,
|
107
|
+
return createName(arg1,new_empty_java_topic_array)
|
108
108
|
end
|
109
109
|
if (arg3 == :nothing)
|
110
110
|
if arg2.is_a?(Array) #arg1 = value, arg2 = scope
|
@@ -112,10 +112,10 @@ module Java::OrgTmapiCore::Topic
|
|
112
112
|
arg2.each do |theme|
|
113
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
114
|
end
|
115
|
-
return arg2.empty? ? createName(arg1,
|
115
|
+
return arg2.empty? ? createName(arg1,new_empty_java_topic_array) : createName(arg1,topic_map.get!(arg2))
|
116
116
|
elsif arg2.is_a?(String) #arg1 = type, arg2 = value
|
117
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,
|
118
|
+
return createName(topic_map.get!(arg1),arg2,new_empty_java_topic_array)
|
119
119
|
else
|
120
120
|
raise "create_name(?,?): arguments don't match"
|
121
121
|
end
|
@@ -134,12 +134,12 @@ module Java::OrgTmapiCore::Topic
|
|
134
134
|
# Creates an Occurrence for this Topic with the specified type and value and
|
135
135
|
# optional scope and datatype.
|
136
136
|
#
|
137
|
-
# Type specifies the Occurrence type and may be a
|
137
|
+
# Type specifies the Occurrence type and may be a topic reference.
|
138
138
|
#
|
139
139
|
# Value may be a Locator (then the datatype is set to xsd:AnyURI and
|
140
140
|
# must not be given) or String.
|
141
141
|
#
|
142
|
-
# Scope may be an Array of
|
142
|
+
# Scope may be an Array of topic reference. If no scope
|
143
143
|
# is given, the Occurrence will be in the unconstrained scope.
|
144
144
|
#
|
145
145
|
# Datatype may be a String or Locator and indicates the datatype of the value.
|
@@ -151,23 +151,55 @@ module Java::OrgTmapiCore::Topic
|
|
151
151
|
# create_occurrence(type, value, {:datatype => datatype}) -> Occurrence
|
152
152
|
#
|
153
153
|
def create_occurrence(type,value,params={})
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
154
|
+
# creating a topic for the type
|
155
|
+
type = topic_map.get!(type)
|
156
|
+
# reading the datatype if given. nil otherwise
|
157
|
+
datatype = params[:datatype]
|
158
|
+
# reading value and setting datatype if not done before
|
159
|
+
unless datatype
|
160
|
+
if value.is_a?(Java::OrgTmapiCore::Locator)
|
161
|
+
datatype = RTM::PSI[:IRI]
|
162
|
+
elsif value.is_a?(String)
|
163
|
+
datatype = RTM::PSI[:String]
|
164
|
+
elsif value.is_a?(Float)
|
165
|
+
datatype = RTM::PSI[:Float]
|
166
|
+
elsif value.is_a?(Fixnum)
|
167
|
+
datatype = RTM::PSI[:Long]
|
168
|
+
elsif value.is_a?(Bignum)
|
169
|
+
datatype = RTM::PSI[:Integer]
|
170
|
+
elsif value.is_a?(DateTime) #DateTime is a Time and a Date
|
171
|
+
datatype ||= RTM::PSI[:DateTime]
|
172
|
+
elsif value.is_a?(Time)
|
173
|
+
datatype ||= RTM::PSI[:Time]
|
174
|
+
elsif value.is_a?(Date)
|
175
|
+
datatype ||= RTM::PSI[:Date]
|
176
|
+
else
|
177
|
+
raise NoDatatypeHandlerAvailableException.new(value)
|
160
178
|
end
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
179
|
+
end
|
180
|
+
# creating locator for datatype
|
181
|
+
datatype = topic_map.create_locator(datatype)
|
182
|
+
# value must be a String
|
183
|
+
value = value.to_s
|
184
|
+
# if datatype is xsd:anyURI -> resolve value against base_iri
|
185
|
+
if datatype.reference == RTM::PSI[:IRI]
|
186
|
+
value = topic_map.create_locator(value).reference
|
187
|
+
end
|
188
|
+
|
189
|
+
begin
|
190
|
+
if params[:scope]
|
191
|
+
raise("scope must be an Array") unless params[:scope].is_a?(Array)
|
192
|
+
|
193
|
+
return createOccurrence(type, value, datatype, topic_map.get!(params[:scope]))
|
194
|
+
|
195
|
+
else #no scope
|
196
|
+
return createOccurrence(type, value, datatype, new_empty_java_topic_array)
|
166
197
|
end
|
198
|
+
rescue java.lang.IllegalArgumentException => iae
|
199
|
+
raise(iae.message)
|
167
200
|
end
|
168
201
|
end
|
169
202
|
|
170
|
-
|
171
203
|
# Returns the TopicMap the Topic belongs to.
|
172
204
|
#
|
173
205
|
# :call-seq:
|
@@ -180,7 +212,7 @@ module Java::OrgTmapiCore::Topic
|
|
180
212
|
|
181
213
|
# Calls TMAPI TopicMap.getIndex which
|
182
214
|
# returns the index for the TypeInstanceIndex.
|
183
|
-
#
|
215
|
+
#
|
184
216
|
# :call-seq:
|
185
217
|
# type_instance_index -> TypeInstanceIndex
|
186
218
|
#
|
@@ -194,8 +226,8 @@ module Java::OrgTmapiCore::Topic
|
|
194
226
|
# If given, rtype specifies the type of the Roles to be returned;
|
195
227
|
# If given, atype specifies the type of the Association
|
196
228
|
# from which the returned Roles must be part of.
|
197
|
-
#
|
198
|
-
# rtype and atype may be a
|
229
|
+
#
|
230
|
+
# rtype and atype may be a topic reference or Arrays of these types.
|
199
231
|
#
|
200
232
|
# The result may be empty.
|
201
233
|
#
|
@@ -263,31 +295,18 @@ module Java::OrgTmapiCore::Topic
|
|
263
295
|
# add_subject_identifier(identifier)
|
264
296
|
#
|
265
297
|
def add_subject_identifier(identifier)
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
298
|
+
begin
|
299
|
+
if identifier.is_a? Java::OrgTmapiCore::Locator
|
300
|
+
addSubjectIdentifier(identifier)
|
301
|
+
else
|
302
|
+
addSubjectIdentifier(topic_map.create_locator(identifier))
|
303
|
+
end
|
304
|
+
rescue org.tmapi.core.IdentityConstraintException => ice
|
305
|
+
# TODO add condition to switch off automerge
|
306
|
+
self.mergeIn(self.topic_map.get(identifier))
|
270
307
|
end
|
271
308
|
end
|
272
|
-
alias :subject_identifiers= :add_subject_identifier
|
273
309
|
|
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
310
|
superised
|
292
311
|
# Removes a subject identifier from the this Topic,
|
293
312
|
# if present.
|
@@ -298,10 +317,39 @@ module Java::OrgTmapiCore::Topic
|
|
298
317
|
# remove_subject_identifier(identifier)
|
299
318
|
#
|
300
319
|
def remove_subject_identifier(identifier)
|
301
|
-
identifier = topic_map.create_locator(identifier) if identifier.is_a? String
|
320
|
+
identifier = topic_map.create_locator(identifier) if identifier.is_a? String
|
302
321
|
removeSubjectIdentifier(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
|
303
322
|
end
|
304
323
|
|
324
|
+
# Returns the subject locators assigned to the current topic.
|
325
|
+
#
|
326
|
+
# :call-seq:
|
327
|
+
# subject_locators -> Set of Locators
|
328
|
+
#
|
329
|
+
def subject_locators
|
330
|
+
getSubjectLocators
|
331
|
+
end
|
332
|
+
|
333
|
+
superised
|
334
|
+
# Adds a subject locator to the current topic.
|
335
|
+
# Identifier may be a String or Locator.
|
336
|
+
#
|
337
|
+
# :call-seq:
|
338
|
+
# add_subject_locator(identifier)
|
339
|
+
#
|
340
|
+
def add_subject_locator(identifier)
|
341
|
+
# TODO Spec
|
342
|
+
begin
|
343
|
+
if identifier.is_a? Java::OrgTmapiCore::Locator
|
344
|
+
addSubjectLocator(identifier)
|
345
|
+
else
|
346
|
+
addSubjectLocator(topic_map.create_locator(identifier))
|
347
|
+
end
|
348
|
+
rescue org.tmapi.core.IdentityConstraintException => ice
|
349
|
+
# TODO add condition to switch off automerge
|
350
|
+
self.mergeIn(self.topic_map.topic_by_subject_locator(identifier))
|
351
|
+
end
|
352
|
+
end
|
305
353
|
|
306
354
|
superised
|
307
355
|
# Removes a subject locator from the this Topic,
|
@@ -313,7 +361,7 @@ module Java::OrgTmapiCore::Topic
|
|
313
361
|
# remove_subject_locator(identifier)
|
314
362
|
#
|
315
363
|
def remove_subject_locator(identifier)
|
316
|
-
identifier = topic_map.create_locator(identifier) if identifier.is_a? String
|
364
|
+
identifier = topic_map.create_locator(identifier) if identifier.is_a? String
|
317
365
|
removeSubjectLocator(identifier) if identifier.is_a? Java::OrgTmapiCore::Locator
|
318
366
|
end
|
319
367
|
|
@@ -332,12 +380,12 @@ module Java::OrgTmapiCore::Topic
|
|
332
380
|
# end
|
333
381
|
|
334
382
|
superised
|
335
|
-
# Adds a type given by the identifier to this Topic.
|
383
|
+
# Adds a type given by the identifier to this Topic.
|
336
384
|
#
|
337
|
-
# Identifier may be a
|
385
|
+
# Identifier may be a topic reference.
|
338
386
|
#
|
339
387
|
# :call-seq:
|
340
|
-
# add_type(identifier)
|
388
|
+
# add_type(identifier)
|
341
389
|
#
|
342
390
|
def add_type(identifier)
|
343
391
|
if identifier.is_a?(Java::OrgTmapiCore::Topic)
|
@@ -351,7 +399,7 @@ module Java::OrgTmapiCore::Topic
|
|
351
399
|
|
352
400
|
# Adds one or several types given by the identifiers.
|
353
401
|
#
|
354
|
-
# Identifier may be a
|
402
|
+
# Identifier may be a topic reference.
|
355
403
|
#
|
356
404
|
# :call-seq:
|
357
405
|
# add_types(identifier1, identifier2, ...)
|
@@ -364,12 +412,12 @@ module Java::OrgTmapiCore::Topic
|
|
364
412
|
end
|
365
413
|
|
366
414
|
|
367
|
-
# Adds an instance given by the identifier to this Topic.
|
415
|
+
# Adds an instance given by the identifier to this Topic.
|
368
416
|
#
|
369
|
-
# Identifier may be a
|
417
|
+
# Identifier may be a topic reference.
|
370
418
|
#
|
371
419
|
# :call-seq:
|
372
|
-
# add_instance(identifier)
|
420
|
+
# add_instance(identifier)
|
373
421
|
#
|
374
422
|
def add_instance(identifier)
|
375
423
|
if identifier.is_a?(Java::OrgTmapiCore::Topic)
|
@@ -383,7 +431,7 @@ module Java::OrgTmapiCore::Topic
|
|
383
431
|
|
384
432
|
# Adds one or several instances given by the identifiers.
|
385
433
|
#
|
386
|
-
# Identifier may be a
|
434
|
+
# Identifier may be a topic reference.
|
387
435
|
#
|
388
436
|
# :call-seq:
|
389
437
|
# add_instances(identifier1, identifier2, ...)
|
@@ -416,17 +464,17 @@ module Java::OrgTmapiCore::Topic
|
|
416
464
|
#
|
417
465
|
def reified=(identifier)
|
418
466
|
if identifier.is_a?(Java::OrgTmapiCore::Reifiable)
|
419
|
-
identifier.reifier = self
|
467
|
+
identifier.reifier = self
|
420
468
|
return
|
421
469
|
end
|
422
470
|
raise("reified=: Identifier may be a Name, Variant, Occurrence, Association, Role or TopicMap")
|
423
471
|
end
|
424
472
|
|
425
473
|
superised
|
426
|
-
# Removes a type given by the identifier
|
474
|
+
# Removes a type given by the identifier of this topic,
|
427
475
|
# if present.
|
428
476
|
#
|
429
|
-
# Identifier may be a
|
477
|
+
# Identifier may be a topic reference.
|
430
478
|
#
|
431
479
|
# :call-seq:
|
432
480
|
# remove_type(identifier)
|
@@ -440,6 +488,19 @@ module Java::OrgTmapiCore::Topic
|
|
440
488
|
end
|
441
489
|
end
|
442
490
|
|
491
|
+
# Removes an instance given by the identifier of this topic,
|
492
|
+
# if present.
|
493
|
+
#
|
494
|
+
# Identifier may be a topic reference.
|
495
|
+
#
|
496
|
+
# :call-seq:
|
497
|
+
# remove_instance(identifier)
|
498
|
+
#
|
499
|
+
def remove_instance(identifier)
|
500
|
+
identifier = topic_map.get(identifier)
|
501
|
+
return unless identifier
|
502
|
+
identifier.removeType(self)
|
503
|
+
end
|
443
504
|
|
444
505
|
# TODO extend this, maybe allow for a removal of any topic no matter how important
|
445
506
|
# it may be for the whole topic map
|
@@ -448,6 +509,16 @@ module Java::OrgTmapiCore::Topic
|
|
448
509
|
self.remove
|
449
510
|
end
|
450
511
|
|
512
|
+
private
|
513
|
+
def new_empty_java_topic_array
|
514
|
+
[].to_java(org.tmapi.core.Topic)
|
515
|
+
end
|
516
|
+
|
517
|
+
class NoDatatypeHandlerAvailableException < Exception
|
518
|
+
def initialize(value)
|
519
|
+
super "Cannot map #{value} to an occurrence value+datatype. Maybe you need to add a handler for your Ruby object type."
|
520
|
+
end
|
521
|
+
end
|
451
522
|
end
|
452
523
|
|
453
524
|
|