Replies: 2 comments 3 replies
-
Thanks for reaching out! There is work under way for bumping the Apache TinkerPop dependency of JanusGraph, see: #3069 |
Beta Was this translation helpful? Give feedback.
-
You are right. Actually, in de janusgraph-full-0.6.2 distribution, the conf/remote-objects.yaml already says:
But this is not reflected in the documentation, indeed. You can discuss in #3069 whether they want to take this into account or rather see a separate issue that depends on #3069 . |
Beta Was this translation helpful? Give feedback.
-
Hi guys,
I have worked with JanusGraph for my master thesis and I think the documentation should be updated https://docs.janusgraph.org/interactions/connecting/java/ for connecting to it using Java.
There is a new version of Gremlin (3.6.0).
To get started with JanusGraph in Java:
mvn archetype:generate -DgroupId=com.mycompany.project -DartifactId=gremlin-example -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Maven:
copy the point 2 https://docs.janusgraph.org/interactions/connecting/java/, then modify it changing the version of Gremlin 3.5.3 to 3.6.0
Grandle:
compile "org.janusgraph:janusgraph-driver:0.6.2" compile "org.apache.tinkerpop:gremlin-driver:3.6.0"
conf/remote-graph.properties:
gremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection gremlin.remote.driver.clusterFile=conf/remote-objects.yaml gremlin.remote.driver.sourceName=g
conf/remote-objects.yaml:
hosts: [localhost] port: 8182 serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
Here you have to use GraphBinary because Gyro has been removed in the last version of Gremlin.
run these two following commands:
sed -i 's/GryoMessageSerializerV3d0/GraphBinaryMessageSerializerV1/g'
remote.yaml
sed -i 's/GryoMessageSerializerV3d0/GraphBinaryMessageSerializerV1/g' remote-objects.yaml
Create a GraphTraversalSource which is the basis for all Gremlin traversals (in your Java application):
import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal; GraphTraversalSource g = traversal().withRemote("conf/remote-graph.properties"); // Reuse 'g' across the application // and close it on shut-down to close open connections with g.close()
Execute a simple traversal:
Object herculesAge = g.V().has("name", "hercules").values("age").next(); System.out.println("Hercules is " + herculesAge + " years old.");
Beta Was this translation helpful? Give feedback.
All reactions