Jim Idle
ATApache TinkerPop
•Created by Jim Idle on 8/22/2023 in #questions
valueMap and Multivalues
I was going to use the recipe from @KelvinL 's book to return lists only when the property has multiple values:
However, what I want is for the properites in Neptune that have been specified as multi-valued to always be lists even if they only currently have one value. This is because I want to populate my go structures from the return properties.
I don't immediately see any way to do that. It's fine, I can code around it and just return all properties as lists, but I wondered if there was a way to specify that behavior? We have the two extremes of all lists with ValueMap and all single (even if Multivalued) with ElementMap(), and nothing in between.
BUt maybe I am overlooking some WithOption?
9 replies
ATApache TinkerPop
•Created by Jim Idle on 8/17/2023 in #questions
AWS Neptune bulk load notifications
I wonder if anyone has knowledge of a way to receive a notification event(s) for bulk loading. Right now, one can poll via the https endpoint, but that would require having a container running somewhere that did this.
I was rather hoping to configure an SNS notification for say status change "LOAD_STARTED"... etc. The JSON given by the https: calls would be fine as having received the notification, I can use the standard calls to retrieve errors and more detailed information etc. Fairly standard pattern:
I was rather hoping to configure an SNS notification for say status change "LOAD_STARTED"... etc. The JSON given by the https: calls would be fine as having received the notification, I can use the standard calls to retrieve errors and more detailed information etc. Fairly standard pattern:
SNS->lambda function-><do something>
Apologies if this is somehow buried in the existing notifications, but I cannot see the wood for the trees if that is the case.7 replies
ATApache TinkerPop
•Created by Jim Idle on 6/19/2023 in #questions
Direct and indirect Edges
This may also be an "it depends" question, but here I have labels
Or, to also to have:
A
, B
and C
where entity C
is created by entity B
on behalf of entity A
.
At the creation time of C
I know the instance of both B
and A
The cardinality will be roughly say ten B
s for each A
(though the B
s can be used by many A
s and there are potentially millions of C
s, which belong to only one B
Sometimes I want to start with all C
s for A
and sometimes with all C
s created by a particular B
on behalf of A
.
So my choice seems to be only have edges:
A
->B
->C
Or, to also to have:
A
->C
There will be storage for A
->C
of course, but given the low cardinality of B
, is A
->C
overkill and I can just find all C
by iterating B
for A
without too much cost.12 replies
ATApache TinkerPop
•Created by Jim Idle on 6/19/2023 in #questions
Advantage/Disadvantage of In and out edge vs one edge
I realize that the answer to this questions might be "it depends", but if I have a bunch of vertices labeled
A
and B
and they always have an edge between them, is there any advantage either generically or in AWS Neptune to having an edge that is directed from A
-> B
and a different edge directed B
-> A
. Or is it just as good to have a single undirected edge (by whihic I mean use the both() step on the edge to ignore direction), and construct the traversal appropriately?
In this particular case, I will have relatively few A
s very many B
s6 replies
ATApache TinkerPop
•Created by Jim Idle on 6/19/2023 in #questions
MergeV uint32 properties inserted as long
Using a property map with OnCreate in MergeV exhibits different behavior if the property type is uint32 rather than int32.
If the property is uint32 then the property is serialized as a long.
If the property is int32, then it is serialized as integer.
I suspect that the type test does not cater for uintnn.
I can use int32 in this case, and I suppose long does not harm and probably needs to be long for int64, but is this an oversight?
8 replies
ATApache TinkerPop
•Created by Jim Idle on 6/15/2023 in #questions
Concurrent MergeV gremlingo - Vertex Id exists
If I use more than one go routine to update the gremlin server, so each has its own connection and traversal, then use MergeV using the gremlingo.T.Id as the merge match property set, I can occasionally get an error that "A vertex with id xxx-ssss-ssss-sss already exists". I have both Merge options specified.
This makes me think that the server cannot support more than one concurrent MergeV to the same VertexId. Is that correct, or is there some configuration I should be doing to make them lock?
A single threaded run works as expected.
10 replies
ATApache TinkerPop
•Created by Jim Idle on 6/9/2023 in #questions
Gremlingo with Neptune - Read loop error
Code that works perfectly on my local TinkerPop Gremlin server, fails in a (to me right now anyway ;), strange manner when connected to AWS Neptune serverless.
The connection is fine and a tiny test to do a vertex count, then write and delete a test works, but when I try and insert vertices, it immediately files and closes the web socket with:
2023/06/09 07:49:44 Read loop error 'websocket: close 1000 (normal): Bye', closing read loop.
2023/06/09 07:49:44 Read loop error 'websocket: close 1000 (normal): Bye', closing read loop.
2023/06/09 07:49:44 Connection error callback invoked, closing protocol.
2023/06/09 07:49:44 Error upserting record: websocket: close 1000 (normal): Bye
I can only think that this must be some kind of configuration issue or some coding issue that I am getting away with on TinkerPop but not AWS Neptune. My connection code is as per the AWS example:
gc, err = gremlingo.NewDriverRemoteConnection("wss://xxxxxxxxxx.neptune.amazonaws.com:8182/gremlin",
func(settings *gremlingo.DriverRemoteConnectionSettings) {
settings.TraversalSource = "g"
})
And then all I am doing (after stripping down to bare bones is:
g := gremlingo.Traversal_().WithRemote(gc)
match := map[interface{}]interface{}{
gremlingo.T.Id: ac.Identifier, // I have also tried without the T.Id
gremlingo.T.Label: "areacode",
}
res, err := g.MergeV(match).HasNext()
But my simple test code for connection verification:
g.AddV("LUFC").Property("captain", "Billy").Next()
Is fine.
I know I am staring the answer in the face and it is perhaps something that Gremlin Server allows, but Neptune doesn't, such as specifying the T.Id (they are strings OK). So what am I missing such that GremlinServer has no problems, but Neptune just seems to want to connect when the query is sent, but fails to connect and th at's the end of it? Is this maybe just the Neptune connection timing out?11 replies
ATApache TinkerPop
•Created by Jim Idle on 5/29/2023 in #questions
MergeV in Go - setting the label
I am having a hard time finding any docs for the Go client, and the code itself does not reveal too much. I see some syntax magic for setting the label in Groovy, but I cannot work out what the equivalent is in Go.
Specifically, using:
g.MergeV(match).
Option(gremlingo.Merge.OnCreate, props).
Where match and props are [string]interface{} - how do I set the label type?
10 replies