Subgraph query returns String instead of TinkerGraph Object in Fluent Java API

Hi guys. I am running the following query in the console and it works fine: g.V().has('user', 'id', 'Andrei').repeat(bothE().subgraph("subgraph").otherV().simplePath()).dedup().cap("subgraph").next(); I can then do a .traversal() on the Thinkergraph result. When I am using the Tinkerpop Java API, the next() step returns the following as a String: tinkergraph[vertices:11 edges:11] How am I able to view the Edges and Vertices of my subgraph in Java? Per my understanding, a TinkerGraph should have been returned instead of String so I could run .traversal() on it. Thank you!
8 Replies
spmallette
spmallette15mo ago
My guess is that you are using the wrong serializer in your Java configuration. There is a configuration on serializers called serializeResultToString: true which basically just says take every result and call toString() on it, which is really helpful when connecting with a text based tool like Gremlin Console or sometimes for debugging. If you want an Object returned you'll want to set that to false or more simply, just remove the key/value all together.
AndreiHarpa
AndreiHarpa15mo ago
HI @spmallette Thank you for your suggestion. Unfortunately I am getting the same behaviour. I am running a Cassandra DSE with Graph. I have updated the server configuration based on the information from this doc: https://docs.datastax.com/en/dse/6.8/dse-admin/datastax_enterprise/config/configRemoteYaml.html#DSGGremlinbasicoptions
remote.yaml configuration file
The DataStax Enterprise configuration file for the DataStax Graph Gremlin console connection to the Gremlin Server.
spmallette
spmallette15mo ago
The link you provided has serializeResultToString: true. That value on the client should be false or the key removed. Perhaps you should share the code/configuration you use to connect to the server. (note that this shouldn't be a server side change that you need to make. the server can have a serializeResultToString: true configuration option. that just means that the server can respond serialization requests of that type)
AndreiHarpa
AndreiHarpa15mo ago
Understood. On the client(Java app) this is my configuration; @Bean public CqlSession cqlSession () { return CqlSession.builder() .addContactPoint(new InetSocketAddress(host, port)) .withLocalDatacenter(dcName) .withAuthCredentials(userName, password) .withKeyspace(keyspace) .build(); } @Bean public GraphTraversalSource graphTraversalSource(CqlSession cqlSession) { return AnonymousTraversalSource.traversal().withRemote(DseGraph.remoteConnectionBuilder(cqlSession) .withExecutionProfile(cqlSession.getContext().getConfig().getDefaultProfile() .withString(DseDriverOption.GRAPH_NAME, keyspace)).build()); }
spmallette
spmallette15mo ago
hmm - what version of TinkerPop are you using?
AndreiHarpa
AndreiHarpa15mo ago
3.6.2. I have tried downgrading to 3.5 but same This is my pom.xml <dependency> <groupId>com.datastax.oss</groupId> <artifactId>java-driver-query-builder</artifactId> <version>${dse.driver.version}</version> </dependency> <dependency> <groupId>com.datastax.oss</groupId> <artifactId>java-driver-mapper-runtime</artifactId> <version>${dse.driver.version}</version> </dependency> <dependency> <groupId>org.apache.tinkerpop</groupId> <artifactId>gremlin-core</artifactId> <version>${tinkerpop.version}</version> </dependency> <dependency> <groupId>org.apache.tinkerpop</groupId> <artifactId>tinkergraph-gremlin</artifactId> <version>${tinkerpop.version}</version> </dependency> I was also reading this section: https://tinkerpop.apache.org/docs/3.5.2/reference/#connecting-gremlin-server-limitations Is GraphBinary serialization configuration on the server side a possible fix?
spmallette
spmallette15mo ago
i'm not terribly familiar with DS Graph these days so I'm not sure what's going on here. the problem definitely has something to do with the server doing a toString() serialization, but I'm not sure why it would do that. I do note that you are using CqlSession and the DseGraph related RemoteConnection implementation. I wonder if their serializer isn't setup right? i would try to connect with the standard TinkerPop driver which should have the serializer configured correctly be default and see if that makes any difference. i'd also be wary of using the latest version of TinkerPop with DS Graph. I can't recall exactly what version they support, but you may want to go back as far as 3.4.13 to be safe. maybe some folks from @datastaxgraph are around and could jump into help as i'm not sure what else to try at this point
AndreiHarpa
AndreiHarpa15mo ago
@datastaxgraph Your help would be much appreciated.
Want results from more Discord servers?
Add your server
More Posts
Multiple Graphs in Gremlin Server?How do I manage multiple graphs? Is there an option where I can select which graph to use for query Has anyone else encountered "NoSuchElementException" when calling getLeafTrees() on a tree objectDid a little bit of debugging and it seems that the issue has to do with a cast to Tree before calliThe query gets slower as the number of vertices that already exist in JanusGraph gets bigger and bigWhen i start JanusGraph and perform any query like : - g.V().has(properties).limit(10).toList() - g.Is there a limitation on Neptune HTTP API endpoint compatibility when using a proxy and IAM Auth?Hi, Got a weird one today. I'm working on bringing full compatibility for the use of proxies frontiPreventing Janusgraph crash on timeoutAccording to this: https://stackoverflow.com/questions/61985018/janusgraph-image-stop-responding-aftWay to update static vertexhttps://docs.janusgraph.org/schema/advschema/#static-vertices I read document about TTL vertex. And Dotnet best practice: converting Vertex properties to ModelA very common task in Dotnet is to convert a stored entity into a Model class. How is this best accoWhat is the use of adding type information to e.g ElementMap<type> in Gremlin.Net?Consider the query and output in the attached image: What TYPE could be placed inside the `ElemementHow can I find property with a certain data type?I have a situation where the same property has different type under the same label, kind of like theVerifying the count of ingested vertex and edges after bulk loading in Janusgraph.I have bulk loaded around 600k Vertices and 800k Edges into my janusgraph cluster backed with bigtab