Major Commit and Refactorings

2 views
Skip to first unread message

Andreas Ronge

unread,
Dec 18, 2009, 5:12:20 PM12/18/09
to neo...@googlegroups.com
Hi

I've just made a huge commit.
Neo4j.rb can now be used without the Neo4j to Ruby class mapping via
the classname property.

You can create a Java (org.neo4j.core.api.Node) Neo4j object like this:
Neo4j::Node.new

This is the same as in Java:
NeoService service = ...
service.createNode();

I have added ruby methods (!) on the Java Node and Relationship Classes
The Neo4j::NodeMixin and Neo4j::RelationshipMixin simply forwards
method calls to the Java Node object.

The reason for this is to speed up traversals so that Neo4j.rb does
not need to create wrapped Ruby objects
for each traversed node (we should be able to choose).

Have added a lot of RSpecs for the readme.rdoc file, so the first half
should be correct.
I have improved some of the RSpecs so that it can be used as documentation.
It should now follow the template:
describe <Class> do
describe #<Method> do
it "should ..."
it "should ..." etc.

The goal is be able to use the RSpecs as detailed documentation.

jruby -S rake spec works but I have disabled some RSpecs for the neo4j.rb
extensions.
The following neo4j.rb extensions does not work: aggregates, tx_tracker
Examples in the example folder might not work - have not checked.
The rest neo4j.rb extension should however work.

Happy Hacking
Andreas

Peter Neubauer

unread,
Dec 20, 2009, 2:21:22 PM12/20/09
to neo...@googlegroups.com
Awesome Andreas!

Will rerun my little performance check and see how thing are improving
now. Maybe you could write a blog on the differences in approach?
Sounds like a very interesting topic ...

Cheers,

/peter neubauer

COO and Sales, Neo Technology

GTalk: neubauer.peter
Skype peter.neubauer
Phone +46 704 106975
LinkedIn http://www.linkedin.com/in/neubauer
Twitter http://twitter.com/peterneubauer

http://www.neo4j.org - Relationships count.
http://gremlin.tinkerpop.com - PageRank in 2 lines of code.
http://www.linkedprocess.org - Computing at LinkedData scale.

> --
>
> You received this message because you are subscribed to the Google Groups "neo4jrb" group.
> To post to this group, send email to neo...@googlegroups.com.
> To unsubscribe from this group, send email to neo4jrb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/neo4jrb?hl=en.
>
>
>

Andreas Ronge

unread,
Dec 20, 2009, 3:05:01 PM12/20/09
to neo...@googlegroups.com
Thanks.
You can try just working with Neo4j::Node and traversals on it.
Like
node = Neo4j::Node.new
node.outgoing(:friends, :location).depth(:all).each { ... }

The traverse method on the Neo4j::Node is the same as calling
the raw Java org.neo4j.core.api.Node.traverse method.
If you want to use the Neo4j.rb DSL for traversals you should use
the Neo4j::Node.outgoing and incoming methods instead.
Since there are clashes in the API between neo4j.rb and Neo4j java api
I have changed a lot of the method names (like the traverse to
outgoing and incoming methods).

Here are some of the rename of methods for the Neo4j::Node class
relationships => rels
relationship => rel
relationship? => rel?
delete => del

I have also added to some of those method an extra parameter 'raw'
that will disable the loading of the Ruby object (for better
performance) - this is not quite ready yet, no RSpecs ...

I will include your example and do some experimentation my self.

/Andreas

Craig Taverner

unread,
Dec 21, 2009, 12:52:19 AM12/21/09
to neo...@googlegroups.com
Extra, super cool. We might be able to start using this immediately.
Reply all
Reply to author
Forward
0 new messages