Module: RTM::IO::TOXTM2
- Defined in:
- lib/rtm/io/to_xtm2.rb
Overview
XTM2 Export. Each Topic Maps Construct gets a to_xtm2 method. The result is a REXML::Element except for TopicMap where it is a REXML::Document.
Defined Under Namespace
Modules: Association, AssociationRole, Name, Occurrence, Topic, TopicMap, Variant
Class Method Summary
collapse
Class Method Details
.locator(loc, tagname = "itemIdentity") ⇒ Object
34
35
36
37
38
|
# File 'lib/rtm/io/to_xtm2.rb', line 34
def self.locator(loc, tagname = "itemIdentity")
x = REXML::Element.new(tagname)
x.add_attribute('href',loc.to_s) x
end
|
.scope(scope) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/rtm/io/to_xtm2.rb', line 11
def self.scope(scope)
res = REXML::Element.new('scope')
scope.each do |s|
res << s.to_xtm2_ref
end
res
end
|
.type(type) ⇒ Object
18
19
20
21
22
|
# File 'lib/rtm/io/to_xtm2.rb', line 18
def self.type(type)
res = REXML::Element.new('type')
res << type.to_xtm2_ref
res
end
|
.value(datatype, value) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/rtm/io/to_xtm2.rb', line 23
def self.value(datatype, value)
if datatype == RTM::PSI[:IRI]
res = REXML::Element.new 'resourceRef'
res.add_attribute('href', value)
else
res = REXML::Element.new 'resourceData'
res.add_attribute('datatype', datatype) if datatype
res.text = value
end
res
end
|