neo4j-ruby-driver
neo4j-ruby-driver copied to clipboard
NoMethodError: undefined method `URI' for #<Neo4j::Driver::Internal::DriverFactory (should the driver work with ruby?)
I am trying to get this to run:
$ cat test/TestNeo4jDriver.rb
# frozen_string_literal: true
require 'test/unit'
require 'neo4j_ruby_driver'
class TestNeo4jDriver < Test::Unit::TestCase
def test_00_mustPass
actualValue = 0
expectedValue = 1
assert_not_equal expectedValue, actualValue
end
def test_01_connect
driverUrl = 'bolt://localhost:7687'
authTokens = Neo4j::Driver::AuthTokens.basic('neo4j', 'pass')
Neo4j::Driver::GraphDatabase.driver(driverUrl, authTokens) do |driver|
driver.session do |session|
expectedValue = 'hello, world' # TODO add a timestamp
greeting = session.write_transaction do |tx|
queryText = "CREATE (a:Greeting) SET a.message = $message RETURN a.message + ', from node ' + id(a)"
result = tx.run(queryText, message: expectedValue)
result.single.first
end # session auto closed at the end of the block if one given
assert_equal expectedValue, greeting
end
end # driver auto closed at the end of the block if one given
end
end
# EOF.
but it fails miserably:
$ rake
/home/claus/.rbenv/versions/3.0.2p107/bin/ruby -I . test/TestNeo4jDriver.rb
Loaded suite test/TestNeo4jDriver
Started
.E
=============================================================================================================================================================================================================
Error: test_01_connect(TestNeo4jDriver): NoMethodError: undefined method `URI' for #<Neo4j::Driver::Internal::DriverFactory:0x000055d670df08a8>
/home/claus/.rbenv/versions/3.0.2p107/lib/ruby/gems/3.0.0/gems/neo4j-ruby-driver-1.7.5/ffi/neo4j/driver/internal/driver_factory.rb:14:in `new_instance'
/home/claus/.rbenv/versions/3.0.2p107/lib/ruby/gems/3.0.0/gems/neo4j-ruby-driver-1.7.5/ffi/neo4j/driver/graph_database.rb:26:in `driver'
/home/claus/.rbenv/versions/3.0.2p107/lib/ruby/gems/3.0.0/gems/neo4j-ruby-driver-1.7.5/lib/neo4j/driver/auto_closable.rb:16:in `block (3 levels) in with_block_definer'
test/TestNeo4jDriver.rb:17:in `test_01_connect'
14: def test_01_connect
15: driverUrl = 'bolt://localhost:7687'
16: authTokens = Neo4j::Driver::AuthTokens.basic('neo4j', 'pass')
=> 17: Neo4j::Driver::GraphDatabase.driver(driverUrl, authTokens) do |driver|
18: driver.session do |session|
19: expectedValue = 'hello, world' # TODO add a timestamp
20: greeting = session.write_transaction do |tx|
=============================================================================================================================================================================================================
Finished in 0.003228576 seconds.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 tests, 1 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
50% passed
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
619.47 tests/s, 309.73 assertions/s
rake aborted!
Command failed with status (1): [/home/claus/.rbenv/versions/3.0.2p107/bin/...]
/home/claus/data.git.CT929562/ruby/experiments/neo4j-01-helloWorld/Rakefile:6:in `block in <top (required)>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
$
I am using the most recent 1.7.5 version of the neo4j-ruby-driver gem:
$ gem info neo4j-ruby-driver
*** LOCAL GEMS ***
neo4j-ruby-driver (1.7.5)
Author: Heinrich Klobuczek
Homepage: https://github.com/neo4jrb/neo4j-ruby-driver
License: MIT
Installed at: /home/claus/.rbenv/versions/3.0.2p107/lib/ruby/gems/3.0.0
Does the neo4j-ruby-driver not work with ruby 3?
I am on this platform:
$ cat /proc/version
Linux version 5.11.0-27-generic (buildd@lcy01-amd64-019) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021
$
I built the seabolt library 1.7.4 from sources on this system:
$ apt list seabolt*
Listing... Done
seabolt17/now 1.7.4-dev amd64 [installed,local]
$
Any clarification/enlightenment/help much appreciated.
Hello, the Seabolt-based version of the Ruby driver is unlikely to work with recent Neo4j versions, since Seabolt has not been maintained for a long while.
Hello, the Seabolt-based version of the Ruby driver is unlikely to work with recent Neo4j versions, since Seabolt has not been maintained for a long while.
Last I saw, Mr Klobuczek was waiting for drivers from the Neo4j team... It doesn't say anything about support being terminated post 4.0.x in the neo4j docs, so there must be SOMETHING i'm missing.
What is the workaround for accessing 4.2+ (external requirement I can't control)?
@soychicka your only option is jRuby https://rubygems.org/gems/neo4j-java-driver or patience (a lot of it) while we are working on the pury ruby driver 4.4.0.
@klobuczek Is there a public repo for the pure Ruby driver to which we can contribute?
@jec just catching up with the issues. The pure ruby driver is being implemented in this repository in ruby
directory.