-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
62 lines (44 loc) · 1.38 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
A minimal Topic Maps Engine written in Ruby.
(Largely inspired by RTM [http://rtm.topicmapslab.de])
Alexander Mikhailian
= 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