Method: RTM::JavaTMAPI#create

Defined in:
lib/rtm/javatmapi.rb

#create(locator) ⇒ Object Also known as: create_topic_map, createTopicMap

Creates and returns a new topic map given a locator. The locator may be a String or a Locator.

:call-seq:

create(locator) -> Topic Map


108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/rtm/javatmapi.rb', line 108

def create(locator)
  locator = @tms.create_locator(locator) if locator.is_a?(String)
  raise("locator must be a String or Locator but is: #{locator.inspect}") unless locator.is_a?(RTM::Locator)
  if (@tms.getLocators.include?(locator))
    tm = @tms.getTopicMap(locator)
    tm.add_prefix("xsd", RTM::PREFIX[:xsd]) # hack, default prefix for xsd
    tm.engine = self # hack
  else
    tm = @tms.createTopicMap(locator)
    tm.add_prefix("xsd", RTM::PREFIX[:xsd]) # default prefix for xsd
    tm.engine = self
  end
  tm
end