JanusGraph output subgraph as GraphSON error

Viewed 1260

I am trying to output a subgraph as GraphSON in the Gremlin shell with JanusGraph.

TinkerPop documentation for reference: http://tinkerpop.apache.org/docs/current/reference/#graphson-reader-writer

When I write the full graph this works fine, however, when I want to write a subgraph that I've queried using these commands:

gremlin> subGraph = g.V(45240).repeat(__.bothE().subgraph('subGraph').bothV()).times(4).cap('subGraph').next()

I use the same write command:

gremlin> subGraph.io(IoCore.graphson()).writeGraph("45240_sub4.json")

I get this error:

(was java.lang.IllegalStateException) (through reference chain: org.janusgraph.graphdb.relations.RelationIdentifier["inVertexId"])

Searching around, I found another thread that said I needed to import a package in order to do this properly (for TitanGraph, but I figured it would apply to JanusGraph as well): Import package in gremlin

However, whenever I try to import:

gremlin>  import com.thinkaurelius.titan.graphdb.tinkerpop.io.graphson.TitanGraphSONModule

I get this error:

Invalid import definition: 'com.thinkaurelius.titan.graphdb.tinkerpop.io.graphson.TitanGraphSONModule'; reason: startup failed: script1494618250861805544050.groovy: 1: unable to resolve class com.thinkaurelius.titan.graphdb.tinkerpop.io.graphson.TitanGraphSONModule @ line 1, column 1. import com.thinkaurelius.titan.graphdb.tinkerpop.io.graphson.TitanGraphSONModule ^

1 error

How can I output a subgraph as a GraphSON in Gremlin shell using JanusGraph?

2 Answers
Related