Module: RTM::IO::TOXTM2
- Defined in:
- rtm/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
- + (Object) locator(loc, tagname = "itemIdentity")
- + (Object) scope(scope)
- + (Object) type(type)
- + (Object) value(datatype, value)
Class Method Details
+ (Object) locator(loc, tagname = "itemIdentity")
34 35 36 37 38 |
# File 'rtm/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) # loc could be Locator or String, to_s serves both x end |
+ (Object) scope(scope)
11 12 13 14 15 16 17 |
# File 'rtm/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 |
+ (Object) type(type)
18 19 20 21 22 |
# File 'rtm/lib/rtm/io/to_xtm2.rb', line 18 def self.type(type) res = REXML::Element.new('type') res << type.to_xtm2_ref res end |
+ (Object) value(datatype, value)
23 24 25 26 27 28 29 30 31 32 33 |
# File 'rtm/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 |