Module: RTM

Defined in:
lib/rtm/psi.rb,
lib/rtm.rb,
lib/rtm.rb,
lib/rtm/axes.rb,
lib/rtm/engine.rb,
lib/rtm/version.rb,
lib/rtm/extensions.rb,
lib/rtm/navigation.rb,
lib/rtm/validation.rb,
lib/rtm/helpers/locator.rb,
lib/rtm/io/from_xtm2_libxml.rb,
lib/rtm/navigation/topic/items.rb,
lib/rtm/navigation/topic/types.rb,
lib/rtm/navigation/name/atomify.rb,
lib/rtm/navigation/topic/players.rb,
lib/rtm/navigation/topic/locators.rb,
lib/rtm/navigation/topic/traverse.rb,
lib/rtm/navigation/topic/indicators.rb,
lib/rtm/navigation/topic/supertypes.rb,
lib/rtm/navigation/occurrence/atomify.rb,
lib/rtm/navigation/association/players.rb,
lib/rtm/navigation/name/characteristics.rb,
lib/rtm/navigation/topic/characteristics.rb,
lib/rtm/navigation/occurrence/characteristics.rb

Overview

Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. License: Apache License, Version 2.0

Defined Under Namespace

Modules: Association, Axes, AxesExtension, Construct, DatatypeAware, Extendable, IO, ItemIdentifier, Locator, LocatorHelpers, Name, Navigation, Occurrence, RTM, Reifiable, Role, Scoped, SubjectIdentifier, SubjectLocator, Sugar, Topic, TopicMap, TopicMapSystem, Typed, VERSION, Validation, Variant Classes: Engine

Constant Summary collapse

PSI =
{}
PSI1 =
{}
PREFIX =
{}

Class Method Summary collapse

Class Method Details

.[](args = nil) ⇒ Object

Returns all connections. The optional argument may specify the backend the connections should use.

:call-seq:

[] -> all connections as Hash
[:tinytim] -> all connections using TinyTiM
[:ontopia] -> all connections using Ontopia
[:sesame] -> all connections using SesameTM
[:activerecord] -> all connectioms using RTM AR


119
120
121
122
# File 'lib/rtm.rb', line 119

def self.[](args = nil)
    return @connections[args] if args
    connections
end

.connect(params = {}, *args) ⇒ Object

Connects to a topic map engine. The optional parameter can be used to select the backend.

:call-seq:

RTM.connect(:implementation => :ontopia)            -> Ontopia backend
RTM.connect(:implementation => :tinytim)            -> tinyTim backend
RTM.connect(:implementation => :activerecord)       -> Active Record backend
RTM.connect(:implementation => :sesametm)           -> SesameTM backend
RTM.connect(:implementation => :merged)             -> Merged TMAPI backend


92
93
94
95
96
97
# File 'lib/rtm.rb', line 92

def self.connect(params = {}, *args)
  engine = Engine.load!(params[:implementation])
  connection = engine.new(params)
  add_connection(connection)
  connection
end

.connectionsObject

Returns all connections grouped by their backend

:call-seq:

connections -> Hash


104
105
106
107
# File 'lib/rtm.rb', line 104

def self.connections
  @connections ||= Hash.new{|h,k| h[k] = []}
  @connections
end

.from_xtm2lx(*args) ⇒ Object



5
6
7
# File 'lib/rtm/io/from_xtm2_libxml.rb', line 5

def self.from_xtm2lx(*args)
  RTM::IO::FROMXTM2LX.from_xtm2(*args)
end

.included(klass) ⇒ Object



124
125
126
127
128
# File 'lib/rtm.rb', line 124

def self.included(klass)
  @@meine_implementierungen ||= []
  @@meine_implementierungen << klass
  self.included_modules.each {|im| klass.extend(im)}
end

.register_extension(module_with_modules) ⇒ Object

Register a module as extension to RTM.

Example: module MyExtension

module Topic
  def my_new_function_for_all_topics
     # ...
   end
end
RTM.register_extension(self)

end



17
18
19
20
21
22
# File 'lib/rtm/extensions.rb', line 17

def self.register_extension(module_with_modules)
  # puts "[RTMEXT] registering extension #{module_with_modules}"
  module_with_modules.constants.each do |sub_module|
    self.const_get(sub_module).register_extension(module_with_modules.const_get(sub_module)) if self.const_defined?(sub_module)
  end
end