db4o oo database for ruby?

E

edlich

Dear gerpux,
I saw that the guys at db4o support ruby to some degree and I wanted
to know if anyone tried the db under ruby. Is this functional?http://developer.db4o.com/ProjectSpaces/view.aspx/Tools_And_Add-Ons/L...
(project db4ro)
The issue has two sides:

1. I know that the db4o guys have ideas for a binding of the Java-db4o
to Ruby.
ButI have no knowledge how far this project has gone. Perhaps it's
easier even now with JRuby.
If this is interesting for you (as the Java-Version is fast as hell
and very mature)
you might want to ask in the public db4o Forum about this.

2. The db4ro project on rubyforge.org is a research project. We didn't
have much time
recently because we organize this object database conference http://icoodb.org.
Nevertheless db4ro is a rewritten clone of db4o with the same basic
API and some research more
(but missing a 10000 db4o features). Just yesterday night it started
being able to read simple
objects and read them all (see Listing 1). You might check out he
public code but I can not
recommend this, as the current codebase is horrible, small and needs
to be refactored massively.

Furthermore we have a smart research API that is not yet linked into
the db4ro codebase
but the query codebase is already mature and sometimes reminds you of
AOQL being described
in the paper cited here http://odbms.org/about_news_20071015.html
See Listing 2. The query work has been done by Sten Friedrich and is
still ongoing.

If you have any more questions, don't hesitate to ask here or me
directly
edlich[at]gmail[dot]com

Stefan Edlich
(Author of "The Definitive Guide to db4o" Apress Ic.)

Listing 1
class Simpleexample
def rundb4ro
db = Db4ro.get_object_container ("C:/tmp/db4ro/db" +
(rand*10000).to_i.to_s)
Db4ro.log.info("Starting db4o example...")
t = db.getTransaction()
t.start
p1 = Person.new
p1.name = "John"
p1.age = 42
db.set(p1)
p1.name = "Susy"
p1.age = 42
db.set(p1)
p1.name = "Ben"
p1.age = 42
db.set(p1)
t.commit
plist = db.get(Person.class)
plist.each do |a_person|
Db4ro.log.info("Objekt ausgelesen = #{a_person.to_s}")
end
Db4ro.log.info("Finishing db4o example!")
end
end

Listing 2: (Query Beispiele)

customers_list = customers.qwhere{|c| c.address.city=="London"}

objects_list = customers.qselect{|c| [{:firstname => c.firstname},
c.lastname, {:street => c.address.street.upcase},
c.address.street.upcase]}

customers_group = customers.qgroupby{|c| c}

min_creditlimit = customers.qwhere{|c| c.address.city=="London"}.qmin{|
c| c.creditlimit}

sum_creditlimit = customers.qwhere{|c| c.address.city=="London"}.qsum{|
c| c.creditlimit}

anonym_objects_list = customers.qjoin(orders){|c, o| [c, o.customer,
{:name => c.firstname + " " + c.lastname, :eek:rderdate =>
o.orderdate, :eek:rderprice => o.price, :avgpriceforcustomer =>
c.orders.qavg{|o| o.price}}]}

unique_prices = product_unitprices.qunion(order_prices).qorderby{|p|
p}

and many more ...
 
C

Christof

2. The db4ro project on rubyforge.org is a research project. We didn't
have much time
recently because we organize this object database conferencehttp://icoodb.org.
Nevertheless db4ro is a rewritten clone of db4o with the same basic
API and some research more
(but missing a 10000 db4o features). Just yesterday night it started
being able to read simple
objects and read them all (see Listing 1). You might check out he
public code but I can not
recommend this, as the current codebase is horrible, small and needs
to be refactored massively.

I don't recommend to create a separate rewrite, though. We currently
produce Java and .NET version with a converter called "Sharpen". I
don't know whetehr it would be possible to write a J2R converter, but
I would certainly recommend to investigate this path thoroughly if
there's interest.

Please contact (e-mail address removed) if you're interested to contribute to
this project.

Christof
db4objects, Inc.
 

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

No members online now.

Forum statistics

Threads
474,269
Messages
2,571,338
Members
48,029
Latest member
Anchorman2022

Latest Threads

Top