#96 ✓resolved
Peter Ferne

Bug in relationships.empty?

Reported by Peter Ferne | November 27th, 2009 @ 04:04 PM

It seems as if relationships.empty? does not behave as expected. See the simple example below.

01 $ nigel = Neo4j::Node.new
   # => #<Neo4j::Node:0x1cc198 @internal_node=#<#<Class:01x2c4c7a>:0xea06a1 @java_object=#<Java::JavaObject:0x594d1d>>>
02 $ nobby = Neo4j::Node.new
   # => #<Neo4j::Node:0x74c7fe @internal_node=#<#<Class:01x2c4c7a>:0xf617ce @java_object=#<Java::JavaObject:0x94fde1>>>
03 $ nigel.relationships.empty?
   # => true
04 $ nigel.relationships.outgoing.empty?
   # => true
05 $ nigel.relationships.incoming.empty?
   # => true

So far so good.

06 $ nigel.relationships.outgoing(:knows) << nobby
   # => #<Neo4j::Relationships::Relationship:0xb66999 @internal_r=#<#<Class:01xcedaf2>:0x887d29 @java_object=#<Java::JavaObject:0xd13cab>>> 
07 $ nigel.relationships.empty?                   
   # => false
08 $ nigel.relationships.outgoing.empty?          
   # => false
09 $ nigel.relationships.incoming.empty?          
   # => true

So far so good.

10 $ nobby.relationships.empty?
   # => true
11 $ nobby.relationships.outgoing.empty?
   # => true
12 $ nobby.relationships.incoming.empty?
   # => false

Lines 11 & 12 are as expected but line 10 is not.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket

Pages