Module: RTM::AR::IO::TOXTM2
- Defined in:
- lib/rtm/activerecord/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, Occurrence, Topic, TopicMap, TopicName, Variant
Class Method Summary
collapse
Class Method Details
.locator(loc, tagname = "itemIdentity") ⇒ Object
33
34
35
36
37
|
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 33
def self.locator(loc, tagname = "itemIdentity")
x = REXML::Element.new(tagname)
x.add_attribute('href',loc.to_s)
x
end
|
.scope(scope) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 10
def self.scope(scope)
res = REXML::Element.new('scope')
scope.each do |s|
res << s.to_xtm2_ref
end
res
end
|
.type(type) ⇒ Object
17
18
19
20
21
|
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 17
def self.type(type)
res = REXML::Element.new('type')
res << type.to_xtm2_ref
res
end
|
.value(datatype, value) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 22
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
|