Module: RTM::AR::IO::TOXTM2::TopicMap
- Defined in:
- lib/rtm/activerecord/io/to_xtm2.rb
Instance Method Summary collapse
-
#to_xtm2 ⇒ Object
returns the XTM 2.0 representation of this topic map as an REXML::Document, ready for outputting.
Instance Method Details
#to_xtm2 ⇒ Object
returns the XTM 2.0 representation of this topic map as an REXML::Document, ready for outputting
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 41 def to_xtm2 # topicMap = element topicMap { reifiable, version, mergeMap*, # (topic | association)* } doc = REXML::Document.new doc << REXML::XMLDecl.new x = doc.add_element 'topicMap', {'xmlns' => 'http://www.topicmaps.org/xtm/', 'version' => '2.0'} x.add_attribute('reifier', reifier.xtm2_id) if reifier x << REXML::Comment.new("Topics count: #{topics.size}") x << REXML::Comment.new("Associations count: #{associations.size}") item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity # mergeMap not used topics.each { |t| x << t.to_xtm2 } associations.each { |a| x << a.to_xtm2 } doc end |