[ANN] Object Database Access v 1.0 released

H

Hannes Wyss

Hi all!

Here comes yet another way to map Ruby-Objects to a Relational Database:

ODBA is an unintrusive Object Cache system. It adresses the crosscutting=20
concern of object storage by disconnecting and serializing objects into=20
storage. All disconnected connections are replaced by instances of=20
ODBA::Stub, thus enabling transparent object-loading.

ODBA supports:=20
* transparent loading of connected objects
* index-vectors
* transactions
* transparently fetches Hash-Elements without loading the entire Hash

An Example:
include 'odba'

#connect default storage manager to a relational database=20
ODBA.storage.dbi =3D ODBA::ConnectionPool.new('DBI::pg::database', 'user'=
, 'pw')

class Counter=20
include ODBA::persistable
def initialize
@pos =3D 0
end
def up
@pos +=3D 1
self.odba_store
@pos
end
def down
@pos -=3D 1
self.odba_store
@pos
end
end

Thanks in advance for any feedback that comes my way!

Cheers=20
Hannes

--=20
Mit freundlichen Gr=FCssen / best regards

Hannes Wyss
Konzeption & Entwicklung

pub 1024D/60312B5F 2003-10-09 Hannes Wyss <[email protected]>
Key fingerprint =3D 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B=
5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org
 
H

Hannes Wyss

L

Lou Vanek

Interesting.

How would you do a search?
For example, how would you find all Counters with a pos > 10 but not 13?
Is the search done centrally, or must you download all Counters before
you can do the search?
 
H

Hannes Wyss

Lou=20

How would you do a search?

I'll have to eat my own example here: we've only ever been interested in
string search - i.e. find all users whose last name begins with 'Van':

<example>

require 'odba'
require 'odba/index_definition'

class User
attr_accessor :first_name, :last_name
include ODBA::persistable
def initialize(first_name, last_name)
@first_name =3D first_name
@last_name =3D last_name
end
end

index_def =3D ODBA::IndexDefinition.new
index_def.index_name =3D 'users_by_last_name'
index_def.origin_klass =3D 'User'
index_def.target_klass =3D 'User'
index_def.resolve_search_term =3D 'last_name.downcase'

ODBA.storage.dbi =3D DBI.connect('DBI:pg:test', 'test', '')
ODBA.cache.create_index(index_def, Object)

composer =3D User.new('Ludwig', 'Van Beethoven')
composer.odba_store
painter =3D User.new('Vincent', 'Van Gogh')
painter.odba_store
scientist =3D User.new('Albert', 'Einstein')
scientist.odba_store

ODBA.cache.retrieve_from_index('users_by_last_name', 'van')=20
-> [composer, painter]

For example, how would you find all Counters with a pos > 10 but not 13?
Is the search done centrally, or must you download all Counters before
you can do the search?
The numerical Counter#pos case could be done, but is not implemented..

Hannes=20

--=20
Mit freundlichen Gr=FCssen / best regards

Hannes Wyss
Konzeption & Entwicklung

pub 1024D/60312B5F 2003-10-09 Hannes Wyss <[email protected]>
Key fingerprint =3D 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B=
5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org
 
L

Lou Vanek

Thanks.

Hannes said:
Lou

How would you do a search?


I'll have to eat my own example here: we've only ever been interested in
string search - i.e. find all users whose last name begins with 'Van':

<example>

require 'odba'
require 'odba/index_definition'

class User
attr_accessor :first_name, :last_name
include ODBA::persistable
def initialize(first_name, last_name)
@first_name = first_name
@last_name = last_name
end
end

index_def = ODBA::IndexDefinition.new
index_def.index_name = 'users_by_last_name'
index_def.origin_klass = 'User'
index_def.target_klass = 'User'
index_def.resolve_search_term = 'last_name.downcase'

ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'test', '')
ODBA.cache.create_index(index_def, Object)

composer = User.new('Ludwig', 'Van Beethoven')
composer.odba_store
painter = User.new('Vincent', 'Van Gogh')
painter.odba_store
scientist = User.new('Albert', 'Einstein')
scientist.odba_store

ODBA.cache.retrieve_from_index('users_by_last_name', 'van')
-> [composer, painter]

For example, how would you find all Counters with a pos > 10 but not 13?
Is the search done centrally, or must you download all Counters before
you can do the search?

The numerical Counter#pos case could be done, but is not implemented..

Hannes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,104
Latest member
LesliVqm09
Top