Dragos Ciupureanu
Dragos Ciupureanu
ATApache TinkerPop
Created by Dragos Ciupureanu on 12/6/2023 in #questions
Testing against AWS Neptune
Hi, the app that I'm maintaining has a Neptune integration for which I've written some integration tests. For those tests I'm using gremlin-server which so far is fine, but because of the cardinality difference between Neptune and other Gremlin implementation I get different behaviour in prod vs testing. Of course, this is a known difference, but I'm wondering if there's a solution that emulates the Neptune engine locally for such use cases. I could spin-up a new Neptune instance at testing time, but that seems a bit of an anti-pattern. What do people do to test the clients against multiple engines, if at all?
12 replies
ATApache TinkerPop
Created by Dragos Ciupureanu on 11/12/2023 in #questions
AWS Neptune and gremlin-javascript versions
Hi, I'm using the js gremlin client 3.6.2 with AWS Neptune version 1.2.1.0 and I get the following error when trying to upsert nodes with mergeV()
ResponseError: Server error: {"code":"InternalFailureException","requestId":"aa89ee40-74d5-46c1-9ad5-0bc3f2fde5c1","detailedMessage":"null: .option(LinkedHashMap, LinkedHashMap)","message":"null: .option(LinkedHashMap, LinkedHashMap)"} (599)
ResponseError: Server error: {"code":"InternalFailureException","requestId":"aa89ee40-74d5-46c1-9ad5-0bc3f2fde5c1","detailedMessage":"null: .option(LinkedHashMap, LinkedHashMap)","message":"null: .option(LinkedHashMap, LinkedHashMap)"} (599)
The code I'm writing is
const {
t: { id, label }
} = gremlin.process;

const idMap = new Map([[id, entity.id]]);
const createMap = new Map([
[label, 'my_vertex'],
['prop1', entity.prop1 || '']
]);
const updateMap = new Map([
['prop1', entity.prop1 || '']
]);
return g
.mergeV(idMap)
.option(onCreate, createMap)
.option(onMatch, __.sideEffect(__.property(cardinality.single, updateMap)).constant(new Map()));
const {
t: { id, label }
} = gremlin.process;

const idMap = new Map([[id, entity.id]]);
const createMap = new Map([
[label, 'my_vertex'],
['prop1', entity.prop1 || '']
]);
const updateMap = new Map([
['prop1', entity.prop1 || '']
]);
return g
.mergeV(idMap)
.option(onCreate, createMap)
.option(onMatch, __.sideEffect(__.property(cardinality.single, updateMap)).constant(new Map()));
I've tried with an object instead of a map, but no luck. The only solution I've found is to use the [email protected] which seems to work with the above code correctly, but I'm concerned about the client being too new for the server. My question is: does the version of the javascript client match the version of the server (or should it)? Or should I always strive to use the latest client?
5 replies
ATApache TinkerPop
Created by Dragos Ciupureanu on 11/8/2023 in #questions
Reusing connections
Hi, I'm wondering what's the recommended way of using connections to a graph DB. The documentation uses web sockets like so (in javascript)
const gremlin = require('gremlin');
const traversal = gremlin.process.AnonymousTraversalSource.traversal;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;

const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));
const gremlin = require('gremlin');
const traversal = gremlin.process.AnonymousTraversalSource.traversal;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;

const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));
but I was wondering if there's a way of opening and managing such connections in an app that uses the repository pattern. I have a frontend that runs queries every now and then and opening a new websocket connection every time I want to run a query doesn't seem too efficient, hence thinking of something like a connection pool managed by the driver (similar to what JDBC drivers do). Is the current advice to have one connection (DriverRemoteConnection) and multiple traversals using that connection or multiple connections, one for each traversal?
6 replies
ATApache TinkerPop
Created by Dragos Ciupureanu on 11/3/2023 in #questions
Gremlin console vs REST API
I'm trying to get a path and the properties of the vertices and the edges for that path by running a gremlin script via REST API in Neptune. The query is simple with some filters on the edges, but the result is different from what gremlin console gives me. For example, the following query returns the path with the type of entities (vertex or edge) but only the label and the ID properties.
g.V('efc912d3-6cec-49e2-9717-85625bab5243').inE().outV().path()
g.V('efc912d3-6cec-49e2-9717-85625bab5243').inE().outV().path()
Similarly, by adding a by(valueMap()) modulator I get all the properties of all edges and vertices in the path, but not the types ("@type": "g:Edge" and "@type": "g:Vertex") The call to Neptune is done as described here https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-rest.html I guess the question is: is there a way to get the type of entity and all properties with one single query?
11 replies
ATApache TinkerPop
Created by Dragos Ciupureanu on 10/27/2023 in #questions
Gremlin browser code editor
Hi, I'm looking for a code editor like monaco https://microsoft.github.io/monaco-editor/ to embed in my browser app that supports Gremlin (even very basic completion, etc.). Monaco doesn't have this out of the box and I was wondering if there is one out there?
7 replies
ATApache TinkerPop
Created by Dragos Ciupureanu on 10/19/2023 in #questions
GraphSON mapper
Hi, I'm trying to ingest some data into AWS Neptune and due to its size I'm forced to use a bulk data importer https://tinkerpop.apache.org/docs/current/dev/io/#graphson-3d0 (unless there's a bulk-insert functionality straight from Gremlin - I couldn't find this). Looking at the GraphSON schema/docs I see there are some IDs on the edges that I am not sure how/if I need to generate. https://tinkerpop.apache.org/docs/current/dev/io/#graphson-3d0 I'm doing this mapping in Python (but can be done in other languages if there's better support). Any recommendations/tips for this?
12 replies