Ruby Topic Maps http://rtm.rubyforge.org Benjamin Bock 1 Third - - PowerPoint PPT Presentation

ruby topic maps
SMART_READER_LITE
LIVE PREVIEW

Ruby Topic Maps http://rtm.rubyforge.org Benjamin Bock 1 Third - - PowerPoint PPT Presentation

Getting started with Ruby Topic Maps http://rtm.rubyforge.org Benjamin Bock 1 Third International Conference on Topic Maps Research and Applications 2007-10-12 Schedule Ruby, Rails and RTM Real Source Code Scalability and


slide-1
SLIDE 1

1

Ruby Topic Maps

Benjamin Bock Getting started with

http://rtm.rubyforge.org

Third International Conference on Topic Maps Research and Applications 2007-10-12

slide-2
SLIDE 2

2

Schedule

Ruby, Rails and RTM Real Source Code Scalability and Performance

slide-3
SLIDE 3

3

Introduction

Web 2.0 is about integration Ruby and Ruby on Rails are Big Players there Topic Maps nonexistent in the Ruby world

slide-4
SLIDE 4

4

Why Ruby?

interpreted, object-oriented programming features procedural and functional paradigm dynamically and/but strongly typed

slide-5
SLIDE 5

5

Ideas behind RoR

Optimized for programmer happiness

Writing beautiful source code Convention over Configuration

slide-6
SLIDE 6

6

Goals of RTM

Usable out of the box Direct access Type less, reach more

slide-7
SLIDE 7

7

Current Status

Quick & easy installation Ready for use memory and database back-end XTM 2.0 import and export

slide-8
SLIDE 8

8

Internal Structure

Back-end based on Active Record Main implementation is a wrapper layer Mixed-in modules for serialization, merging, extended API

slide-9
SLIDE 9

9

API Gimmicks

Direct use of String references to Topics Enumerable Sets provide query language Zero overhead command shortcuts

slide-10
SLIDE 10

10

Schedule

Ruby, Rails and RTM Real Source Code Scalability and Performance

slide-11
SLIDE 11

11

Loading

# loading the Ruby Topic Maps library require 'rtm' # Connecting to a back-end RTM.connect # Memory RTM.connect_mysql("database_name", "user_name", "password", "host")

slide-12
SLIDE 12

12

Initialisation

# generate database schema RTM.generate_database # enable SQL statement logging RTM.log # create a TopicMap tm = RTM.create "http://tmra.de/tm1/"

slide-13
SLIDE 13

13

Creation

# create a new Topic t = tm.create_topic # create a new Association a = tm.create_association # create AssociationRoles r = a.cr "player", RTM::PSI[:type]

slide-14
SLIDE 14

14

Navigation

# get a (random) TopicName n = tm.get!("player").names.first # get all scoped Variants of the first scoping Topic found vs = n.scope.first.scoped_variants # get array of Variant values vs.map {|v| v.value}

slide-15
SLIDE 15

15

Querying

# Get all Topics without name nn = m.t.select {|t| t.n.size == 0 } # Get all Association types ti = m.a.map {|a| a.type }.uniq # oblige Robert Barta m.t.each {|t| t.v.each {|v| if v.datatype == PSI[:string] t.cn v.p.to_hash.merge(v.to_hash) else t.co v.p.to_hash.merge(v.to_hash).merge( :type => PSI[:variant_name]) end v.remove }}

slide-16
SLIDE 16

16

Import and Export

# Import an XTM 2.0 file

RTM.from_xtm2(io_stream, "base_locator")

# Export a complete topic map xml_string = m.to_xtm2 # Export other formats m.to_jtm; m.to_yaml; …

slide-17
SLIDE 17

17

Schedule

Ruby, Rails and RTM Real Source Code Scalability and Performance

slide-18
SLIDE 18

18

Yes, but... does it scale?

Speed? NO! unfortunately not (yet) Scaling manpower! Big optimization potential.

slide-19
SLIDE 19

19

Performance

SQLite3: 100 Topics in 13s (committing each) Memory: Creates 10,000 empty Topics in <30s 10,000 empty Associations in <20s 300KB XTM 2.0 takes 45s to import

slide-20
SLIDE 20

20

Schedule

Ruby, Rails and RTM Real Source Code Scalability and Performance

slide-21
SLIDE 21

21

Outlook

Needs to prove itself in real life Higher Level API in sight Community wanted! http://rtm.rubyforge.org

slide-22
SLIDE 22

22

Thank you! Questions?