Module: RTM::AR::IO::TOXTM1::TopicMap
- Defined in:
- lib/rtm/activerecord/io/to_xtm1.rb
Instance Method Summary collapse
-
#to_xtm1 ⇒ Object
returns the XTM 2.0 representation of this topic map as an REXML::Document, ready for outputting.
Instance Method Details
#to_xtm1 ⇒ Object
returns the XTM 2.0 representation of this topic map as an REXML::Document, ready for outputting
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rtm/activerecord/io/to_xtm1.rb', line 39 def to_xtm1 # 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.xtm1_id) if reifier x << REXML::Comment.new("Topics count: #{topics.size}") x << REXML::Comment.new("Associations count: #{associations.size}") item_identifiers.each { |ii| x << TOXTM1.locator(ii) } # itemIdentity # mergeMap not used topics.each { |t| x << t.to_xtm1 } associations.each { |a| x << a.to_xtm1 } doc x end |