Can I use JanusGraph with C#.net and if so how?

811 views
Skip to first unread message

biniam...@gmail.com

unread,
Sep 23, 2017, 9:57:11 AM9/23/17
to JanusGraph users
Hello,

I am new to JanusGraph and I want to use it in a C# project. I plan to use AWS DynamoDB as a storage engine.

Does JanusGraph support writing the implementation in C# programming language?

If it does, what library can I use?
Can you please provide me with a sample project (may be in Github) or a blog post?

Thanks.

Misha Brukman

unread,
Sep 23, 2017, 10:06:47 AM9/23/17
to biniam...@gmail.com, JanusGraph users
Since JanusGraph is a TinkerPop-compliant graph database, you can use any language drivers on this page: http://tinkerpop.apache.org/

In your case, it sounds like Gremlin.NET (C#) library is the one you want to use — there is a code sample and more API docs on that project's GitHub page.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/6d04fdc2-3e7b-4987-b35e-b7de0695c67e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Florian Hockmann

unread,
Sep 24, 2017, 8:50:37 AM9/24/17
to JanusGraph users
I'm one of the developers of Gremlin.Net and I would suggest that you use one of the Gremlin.Net versions that are now part of TinkerPop although they are only release candidates right now. For JanusGraph, this would be version 3.2.6-rc1.

These newer versions allow to write Gremlin queries directly as C# code whereas older versions can just send gremlin-groovy requests as strings to the server. A simple example looks like this:
var graph = new Graph();
var g = graph.Traversal().WithRemote(new DriverRemoteConnection(new GremlinClient(new GremlinServer("localhost", 8182))));
// reuse 'g' in your application
var persons = g.V().HasLabel("person").Has("age",Gt(30)).Order().By("age",decr).ToList();

The full documentation can be found here:

Am Samstag, 23. September 2017 16:06:47 UTC+2 schrieb Misha Brukman:
Since JanusGraph is a TinkerPop-compliant graph database, you can use any language drivers on this page: http://tinkerpop.apache.org/

In your case, it sounds like Gremlin.NET (C#) library is the one you want to use — there is a code sample and more API docs on that project's GitHub page.
On Sat, Sep 23, 2017 at 7:11 AM, <biniam...@gmail.com> wrote:
Hello,

I am new to JanusGraph and I want to use it in a C# project. I plan to use AWS DynamoDB as a storage engine.

Does JanusGraph support writing the implementation in C# programming language?

If it does, what library can I use?
Can you please provide me with a sample project (may be in Github) or a blog post?

Thanks.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.

yoav...@gmail.com

unread,
Nov 12, 2017, 4:50:58 PM11/12/17
to JanusGraph users
Hi

I am using Visual Studio, added Gremlin.net but I cannot find the Graph class...

Thanks!

Florian Hockmann

unread,
Nov 13, 2017, 5:54:11 AM11/13/17
to JanusGraph users
Which version of Gremlin.Net did you install? It should be 3.2.6-rc1, but you have to tell Visual Studio to "include prerelease" packages. Otherwise it won't show you that version.

Yoav Nativ

unread,
Nov 13, 2017, 6:08:01 AM11/13/17
to Florian Hockmann, JanusGraph users
Great!

Got it to work. It still does find the definition of Gt() in the code but the basic stuff seems to work. 
Is there any link to c# documentation or is still too early?

Thank you,


--
You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/janusgraph-users/txSsuBDlTF8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/09fd4f9f-26a7-4c26-b568-f68d75adf050%40googlegroups.com.

Florian Hockmann

unread,
Nov 13, 2017, 6:29:09 AM11/13/17
to JanusGraph users
You can find the documentation here: http://tinkerpop.apache.org/docs/current/reference/#gremlin-DotNet

The section "Static Enums and Methods" probably addresses your problem with Gt().

Yoav Nativ

unread,
Nov 15, 2017, 6:18:11 AM11/15/17
to Florian Hockmann, JanusGraph users
Hi

That's very helpful.
Is there a reference project example, like "Hello World" in .NET?
I think it will be very helpful to have such project - maybe one of the sample graph like the graph of gods with:
* Read from GraphSON
* Write to GraphSON
* Traversal operations, add Verices


Thanks for the help!

Yoav

To unsubscribe from this group and all its topics, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/c3d95182-2cba-459a-ac74-aae91a29df4b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Yoav

Florian Hockmann

unread,
Nov 15, 2017, 9:48:38 AM11/15/17
to JanusGraph users
No, there isn't an example project for Gremlin.Net, at least not that I know of. We could of course create one, but it would probably just contain examples like those already included in the reference docs that I linked to in my previous post here.

Is there anything specific you're missing in the docs?

add Verices
You can simply add vertices with the AddVertex Step. Just make sure that you call AddV() instead of addV() in Gremlin.Net. 

Regarding GraphSON: GraphSON is only implemented in the Gremlin Language Variants (GLVs) like Gremlin.Net to support serialization of traversals and deserialization of the results from those traversals. So when you write a vertex to GraphSON with Gremlin, then it won't include the properties of that vertex as we don't need that for traversals. When you want to write vertices to files in GraphSON format with Gremlin.Net, then you probably also want to include those properties. So we would have to extend the GraphSON serializers (and also the deserializers as you probably also want to read them back in) in Gremlin.Net for this use case. When you think that Gremlin.Net should support this, then please create a ticket for that in TinkerPop: https://issues.apache.org/jira/projects/TINKERPOP



--

Yoav

Yoav Nativ

unread,
Nov 16, 2017, 1:44:24 AM11/16/17
to Florian Hockmann, JanusGraph users
Hi

What I really like to have is a simple Visual Studio solution that I can open and run as a reference. 

Connect to a local graph on port 8182 over web socket
Add vertex
Do basic operations. 

Read a graph from graphson
Write to a graphson file. 

I currently not able to connect all the dots and have a simple working app. 

Thank you,

Yoav

Florian Hockmann

unread,
Nov 16, 2017, 4:55:52 AM11/16/17
to JanusGraph users
Ok, I'll create a simple example that uses Gremlin.Net and shows some basic traversals and host it on GitHub.

Regarding GraphSON: The best approach is probably to just use the Gremlin Console for that, especially when you only want to do that for a few cases so that it can be done manually. With Gremlin.Net you would have to retrieve the properties separately and then write them to a file in GraphSON which isn't very user-friendly. (As I said, the GraphSON serialization in Gremlin.Net currently only serves for the communication with a Gremlin Server.)

Stephen Mallette

unread,
Nov 16, 2017, 6:18:23 AM11/16/17
to JanusGraph users
Ok, I'll create a simple example that uses Gremlin.Net and shows some basic traversals and host it on GitHub.

For java we have Maven archetypes that generate starter projects that get people going quickly. 


Might be good if we did something like that for every GLV. Does .NET have a similar concept? Would it be dumb to create a maven archetype that generated a .NET project? 

Regarding GraphSON: The best approach is probably to just use the Gremlin Console for that, especially when you only want to do that for a few cases so that it can be done manually. With Gremlin.Net you would have to retrieve the properties separately and then write them to a file in GraphSON

I agree that the console would be the best way to go for GraphSON generation and I didn't read the whole thread fully, but If the driver was used directly to send a script you could do the GraphSON transform on the server and just get back the json string.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/b25aff3d-7362-4ea5-82bb-9338de13330b%40googlegroups.com.

Florian Hockmann

unread,
Nov 16, 2017, 9:35:42 AM11/16/17
to JanusGraph users
I didn't know about Maven archetypes until now, but it really seems to be a good idea for use cases like this. The .NET equivalent are probably dotnet templates:


We could create such a template for Gremlin.Net. Then users could simply execute something like dotnet new gremlin.net (or however we name the template) and get a single project with example code or a complete solution (useful if we also want to include tests).
I think that makes more sense than creating a Maven archetype for this as most .NET developers probably don't want to use Maven. The build and deploy steps however should be basically the same as for Gremlin.Net. So that shouldn't be a problem.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.

Stephen Mallette

unread,
Nov 16, 2017, 9:42:22 AM11/16/17
to JanusGraph users
Sounds good. I created a JIRA for further discussion:


To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/ac2f137f-375c-4fe7-90a6-de8807810854%40googlegroups.com.

janusgra...@gmail.com

unread,
Jan 13, 2018, 9:55:46 AM1/13/18
to JanusGraph users
Hi Stephen Mallette,

I am new in janusgraph and tinkerpop. I am using  Gremlin.Net to connect to janusgraph and all the request that retuen vertexes work fine for me but when I run any operation that return edges like "g.V(61464).outE('father').toList()" an exception occur at the server:

org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0  - Response [ResponseMessage{requestId=11ccb4f5-4917-4271-8f96-929a5999f34a, status=ResponseStatus{code=SUCCESS, message='', attributes={}}, result=ResponseResult{data=[e[ofsz-1bfc-u1h-cns][61464-father->16408]], meta={}}}] could not be serialized by org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0.
org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.janusgraph.graphdb.relations.RelationIdentifier["longRepresentation"]

but its working fine in the gremlin-client console. do you have any suggestion plz?
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.

Florian Hockmann

unread,
Jan 13, 2018, 9:59:38 AM1/13/18
to JanusGraph users
Reply all
Reply to author
Forward
0 new messages