
Batchimporter does not alllow symbol for keys on relationships
Reported by Andreas Ronge | August 11th, 2011 @ 08:29 AM
Also, the database is in a corrupt state after the error.
Failure:
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #<Neo4j::Batch::Inserter:0xd713fe @rule_inserter=#<Neo4j::Batch::RuleInserter:0x4936f3 @inserter=#<Neo4j::Batch::Inserter:0xd713fe ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x118abfe>>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, :since => '2009') # NOTE: using symbol :since
NativeException: java.lang.ClassCastException: org.jruby.RubySymbol cannot be cast to java.lang.String
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:419:in `createPropertyChain'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:198:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):6:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
jruby-1.6.3 :007 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009') # changed from using a symbol to using a string
NativeException: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[0] not in use
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:229:in `getRecord'
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:96:in `getRecord'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:210:in `connectRelationship'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:195:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):7:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
Success:
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #<Neo4j::Batch::Inserter:0x15b15ab @rule_inserter=#<Neo4j::Batch::RuleInserter:0x1635aad @inserter=#<Neo4j::Batch::Inserter:0x15b15ab ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x186b11c>>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009')
=> nil
jruby-1.6.3 :007 > inserter.shutdown
=> nil
Comments and changes to this ticket
-
Martin Kleppmann August 11th, 2011 @ 08:18 PM
BTW, in both examples this is starting from a completely blank database (I deleted the Neo4j database directory before each irb session.
-
-
Andreas Ronge April 23rd, 2012 @ 11:52 AM
- State changed from new to resolved
(from [7437525af81dfc6922c02d81c20deadcdb82a6b8]) Counting number of nodes is not correct after delete closes #178
Notice the bug fix is done in neo4j-wrapper: https://github.com/andreasronge/neo4j-wrapper/commit/1a1b861f6020ed...
The same issue as #187
https://github.com/andreasronge/neo4j/commit/7437525af81dfc6922c02d... -
Andreas Ronge April 23rd, 2012 @ 11:52 AM
(from [0724e56d1e0d67aa42fee6ee60ea049e5bfa0bba]) Bumped neo4j-wrapper to 0.0.9
- Use Neo4j 1.7
- Fix rule count bug, closes #178
- Update readme https://github.com/andreasronge/neo4j/commit/0724e56d1e0d67aa42fee6...
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.
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