Cannot query neo4j from console

109 views
Skip to first unread message

Dave Bloodworth

unread,
Jan 29, 2019, 11:33:55 AM1/29/19
to Gremlin-users
Hi,

I'd like to migrate an existing java web app to Gremlin from Cypher. I'd like to be able to use other graph dbs rather than be locked into neo4j.

I am trying to start working with gremlin and, after reading the docs, decided to start with gremlin-console (3.4.0)

I was running neo4j version 3.4.9, and tried to connect to it, but got an error similar to the following (note this may not be the exact error - I may have copied this from another post):
  • Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"

Anyway, after playing around with config options as directed I then got the error:
  • Not possible to upgrade a store with version 'v0.A.9' to current store version `v0.A.8` (Neo4j 3.2.3).

Assuming this means that my neo4j installation is too new (3.4.9, data store v0.A.9), I downgraded to 3.2.3 (data store v0.A.8).
I then reloaded all of my data (using my Cypher scripts through neo4j server) and checked it was complete using the neo4j browser.

I started gremlin console, setting config as follows:

gremlin> conf = new BaseConfiguration()
==>org.apache.commons.configuration.BaseConfiguration@7ac9af2a

gremlin> conf.setProperty('gremlin.neo4j.directory','C:\\Users\\me\\work\\docker\\neo4j\\volumes\\neo4j\\data\\databases\\graph.db\\')
==>null

gremlin> graph = Neo4jGraph.open(conf)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/me/work/tools/TinkerPop/apache-tinkerpop-gremlin-console-3.4.0/lib/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/me/work/tools/TinkerPop/apache-tinkerpop-gremlin-console-3.4.0/ext/neo4j-gremlin/lib/slf4j-nop-1.7.22.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
==>neo4jgraph[community single [C:\Users\me\work\docker\neo4j\volumes\neo4j\data\databases\graph.db]]

gremlin> g = graph.traversal()
==>graphtraversalsource[neo4jgraph[community single [C:\Users\me\work\docker\neo4j\volumes\neo4j\data\databases\graph.db]], standard]


As you can see the graph appears to open successfully (albeit with a warning from slf4j) and I can create the graphtraversal instance.

However, it doesn't matter which queries I use, I cannot get any response to be shown in the console.

gremlin> g.V()
gremlin> g.V(133)


As you can tell, I'm very new to gremlin (and console) and would really appreciate any advice on what to try next, log file locations, anything ...

Also, is this a valid approach, should I just forget trying to start with a neo4j instance and just opt for a db that directly supports gremlin? The (main) reason I ask, because it already appears to be necessary to downgrade the data store version in order to get rid of the startup errors.

Thanks,

Dave

Stephen Mallette

unread,
Jan 29, 2019, 12:23:55 PM1/29/19
to gremli...@googlegroups.com
As of 3.4.0 TinkerPop is using Neo4j  3.2.3:


so whatever Neo4j allows in terms of connecting various versions of their datastore will simply apply based on that. There is an open PR for a neo4j upgrade to 3.4.0:


so hopefully that's on it's way for TinkerPop 3.4.1. As for why you can't connect I'd guess that the reason is related to your pathing. 

gremlin> conf.setProperty('gremlin.neo4j.directory','C:\\Users\\me\\work\\docker\\neo4j\\volumes\\neo4j\\data\\databases\\graph.db\\')

isn't "graph.db" a file and not a directory? if so, i think you just want this:

gremlin> conf.setProperty('gremlin.neo4j.directory','C:\\Users\\me\\work\\docker\\neo4j\\volumes\\neo4j\\data\\databases\\)



--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/38d5e0b1-18dd-4820-81d2-c27b263a4032%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Bloodworth

unread,
Jan 29, 2019, 1:10:45 PM1/29/19
to Gremlin-users
Hi Stephen

Thanks for the quick response and the info regarding neo4j version support.

You were right, it was the path, but not 'graph.db' as that is a folder, it was the trailing backslash that caused the problem.

Thanks for your help.
Dave
Reply all
Reply to author
Forward
0 new messages