Re: A few questions about JanusGraph.


Manoj Waikar <mmwa...@...>
 

Thanks so much Jason for the very detailed reply, and also for opening an issue for it.

There are still a few things which need clarification -

The Tinkerpop documentation of Connecting via withRemote that you pointed, mentions the use of gremlin-server-modern.yaml file, and that file is not included in the JanusGraph distribution.

Most of the examples, of connecting to JanusGraph show it through the Gremlin console, and very few using Java. The one which shows how to do it using Java, uses client.submit("[1,2,3,4]").all(); and when I tried to follow the same approach and submitted just "g.V()" I got the following error - No signature of method: org.janusgraph.graphdb.database.StandardJanusGraph.V() is applicable for argument types: ()

Can you please let me know what steps am I missing?


On Tuesday, August 8, 2017 at 11:24:39 PM UTC+5:30, Jason Plurad wrote:
Sounds like the documentation could use some improvements to help make this more clear. I've opened up an issue to track it.

1) What is the relation between Gremlin server (bin/gremlin-server.bat) and the JanusGraph server (bin/janusgraph.sh)?

The pre-packaged distribution of JanusGraph starts an instance of Cassandra, Elasticsearch, and Gremlin Server to allow users to get started quickly.

You can start a Gremlin Server manually with bin/gremlin-server.sh

2) Properties in janusgraph-cassandra-es-server.properties vs. JanusGraphFactory.build().set()...open()

If you want to connect to the same graph that the Gremlin Server has defined, yes, you should use the same properties. Using a properties file could make this easier for reuse JanusGraphFactory.open("conf/gremlin-server/janusgraph-cassandra-es-server.properties"), but if you JanusGraphFactory.build().set()...open() with the same properties, you'll be connecting to the same graph.

3) In the above API, I haven't specified the JanusGraph server endpoint (the URL or the port), so which server is my Java code connecting to?

Your code is connecting to the Cassandra server. When you configure a graph using JanusGraphFactory.open(), your application is creating an embedded graph instance. It is not connecting to the graph instance running on the JanusGraph server. The graph data is ultimately stored in Cassandra, so both the JanusGraph Server and your application are working with the same graph data.

That being said, you could connect to the graph instance on the Gremlin Server using a remote connection as described in the TinkerPop docs.

4) Does Java API use websockets, and can JanusGraph server run on a different machine (right now, my Cassandra and gremlin server run on the same machine)?

In the scenario where you have an embedded graph instance, your calls to the graph are not using WebSockets. Your application is communicating directly with the Cassandra storage backend using Thrift. A Gremlin Server can run on a different machine than the storage backend. The janusgraph-cassandra-es-server.properties lets the Gremlin Server know where to find the storage backend (see the storage.hostname property).

5) Is Java API the same as Gremlin language / API?

JanusGraph implements the Apache TinkerPop APIs, including Gremlin. When you are doing graph traversals, you are dealing with TinkerPop's Gremlin language -- i.e. g.V().has("name", "manoj").toList(). The schema and index APIs are specific to JanusGraph because these are not provided by the TinkerPop abstraction.

6) Where is the documentation / examples for REST API (for adding / querying vertices, edges)?

JanusGraph doesn't currently have much for that at the moment. Gremlin Server can be configured to support an HTTP endpoint which evaluates any Gremlin. It doesn't expose specific endpoints for /vertices or /edges, but you can do all that and more with the Gremlin endpoint.

7) How can one achieve graph namespacing?

If they are completely separate graphs, creating separate keyspaces works great. You could host them all within the same graph by making sure that you don't overlap labels and property names. You could also consider the Partition Strategy.

8) If the graphs have to be stored in different Cassandra keyspaces, how can I connect to these different graphs / keyspaces from the same Java application?

Create a separate graph instance for each keyspace using storage.cassandra.keyspace in the configuration. You can define multiple graphs in the gremlin-server.yaml configuration with different properties files. Similarly you can connect to multiple graph instance from your application.

On Tuesday, August 8, 2017 at 11:54:15 AM UTC-4, Manoj Waikar wrote:
Hi,

I have read the JanusGraph documentation and the GraphOfTheGodsFactory.java file, and I also have a small sample running, However, I am still not clear about the following doubts related to JanusGraph -

1) What is the relation between Gremlin server (bin/gremlin-server.bat) and the JanusGraph server (bin/janusgraph.sh)?

2) I've specified my Cassandra related configuration values in conf/gremlin-server/janusgraph-cassandra-es-server.properties file and this file is being used when running the gremlin server. While using the Java API (from Scala), I do the following -

val graph: JanusGraph = JanusGraphFactory.build().
 
set("storage.backend", "cassandra").
 
set("storage.hostname", "localhost").
 
set("storage.cassandra.keyspace", "MyJG").
 
set("storage.username", "username").
 
set("storage.password", "password").
  open
()

Should I be using the same (conf/gremlin-server/janusgraph-cassandra-es-server.properties) file which I use to start the gremlin server from my Java code?

3) In the above API, I haven't specified the JanusGraph server endpoint (the URL or the port), so which server is my Java code connecting to?

4) Does Java API use websockets, and can JanusGraph server run on a different machine (right now, my Cassandra and gremlin server run on the same machine)?

5) Is Java API the same as Gremlin language / API?

6) Where is the documentation / examples for REST API (for adding / querying vertices, edges)?

7) How can one achieve graph namespacing? So for example, I have to create three different graphs for employees, vehicles and cities, how can I segregate the data for these three graphs? Can I give a name / id to the graph? Or do these graphs have to be stored in different Cassandra keyspaces?

8) If the graphs have to be stored in different Cassandra keyspaces, how can I connect to these different graphs / keyspaces from the same Java application?

Thanks in advance for the help.

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.