Topic Maps for Ruby
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
lib
misc
test
LICENSE
README
Rakefile
tm4r.gemspec

README


               A minimal Topic Maps Engine written in Ruby.

            (Largely inspired by RTM [http://rtm.topicmapslab.de])

                          Alexander  Mikhailian
             <alexander.mikhailian@spaceapplications.com>
                          <mikhailian@mova.org>


= Prerequisites

MRI Ruby 1.8.6 or Jruby 1.1.2, rubygems.

                             Install
  $ gem build tm4r.gemspec
  $ gem install tm4r*.gem

= Sample usage

  $ irb
  require 'rubygems'
  require 'tm4r'
  require 'tm4r/migrate/001_initial_schema'
  include TM4R
  ActiveRecord::Base.establish_connection(
   :adapter  => "sqlite3")
  InitialSchema.up

= Sample session

  tm = TopicMap.new(:base=>"iri://italian-opera")
  tm.from_xtm2(File.open("misc/ItalianOpera.xtm2"))
  t = tm.topics.first
  t.occurrences
  t.occurrences.each {|o| print "#{o.datatype}\n"}

= Using with MySQL

Create a MySQL database with  the UTF-8 default encoding

  $ echo "create database test DEFAULT CHARSET=utf8" |mysql

Run
  $ irb
  require 'rubygems'
  require 'tm4r'
  require 'tm4r/migrate/001_initial_schema'
  include TM4R
  ActiveRecord::Base.establish_connection(
   :adapter  => "mysql",
   :host     => "localhost",
   :username => "test",
   :password => "test",
   :database => "test",
   :encoding => "utf8")
  InitialSchema.up

Check The ActiveRecord documentation [1] for other usage patterns.

[1] http://ar.rubyonrails.org