Valentyn Kahamlyk
ATApache TinkerPop
•Created by b4lls4ck on 8/1/2024 in #questions
How to find the edges of a node that have a weight of x or greater?
g.V().has("person", "name", "A").out(...
returns Vertices
to get edges need to use outE()
something like
a_friends = g.V().has("person", "name", "A").outE("is friends with").has("weight", P.gt(0.75)).inV().to_list()
8 replies
ATApache TinkerPop
•Created by Lyndon on 6/25/2024 in #questions
C# Profiling Duration
I don't have really good alternative.
Option is to run same traversal from Gremlin Console or java GLV.
If you have GremlinGroovyScriptEngine (it's default for TinkerPop 3.6-3.7) then workaround is to convert response to string or Map before sending back from server, something like
await client.SubmitWithSingleResultAsync<Object>("g.V().profile().toList().toString()");
9 replies
ATApache TinkerPop
•Created by Lyndon on 6/25/2024 in #questions
C# Profiling Duration
profile() will not work, dotnet GLV can't deserialize server response of TraversalMetrics type
9 replies
ATApache TinkerPop
•Created by Lyndon on 6/25/2024 in #questions
C# Profiling Duration
Milliseconds can be get with StopWatch https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stopwatch?view=net-8.0
9 replies
ATApache TinkerPop
•Created by Johan on 6/1/2024 in #questions
Does the TinkerGraph in-memory database support List cardinality properties for vertices?
I think best sources are official docs https://tinkerpop.apache.org/docs/current/reference/#valuemap-step
and Kelvin's book https://kelvinlawrence.net/book/Gremlin-Graph-Guide.html#element-map
8 replies
ATApache TinkerPop
•Created by Johan on 6/1/2024 in #questions
Does the TinkerGraph in-memory database support List cardinality properties for vertices?
elementMap()
assumes that cardinality for each key is single and if it is list then only the first item encountered will be returned.
To get all property values valueMap()
step can be used instead.
gremlin> g.V(1).property("address", "a1").property(list, "address", "a2")
==>v[1]
gremlin> g.V(1).valueMap()
==>[address:[a1,a2],name:[marko],age:[29]]
gremlin> g.V(1).elementMap()
==>[id:1,label:person,address:a2,name:marko,age:29]
8 replies
ATApache TinkerPop
•Created by Blonde Maybe on 3/15/2023 in #questions
Dotnet best practice: converting Vertex properties to Model
options to try:
1. in TinkerPop 3.7.x you can add extension
ToPerson
to Vertex
class
Person person = g.AddV("Person")
.Property("Name", "Frank")
.Property("Age", 33)
.Next()
.ToPerson()
2. in 3.6.x something similar can be done for IDictionary
3. make DSL for working with persons https://tinkerpop.apache.org/docs/current/reference/#gremlin-dotnet-dsl7 replies
ATApache TinkerPop
•Created by danielcraig23 on 5/9/2024 in #questions
Is the insertion order guaranteed with this example code?
for TinkerPop 3.7.x data is updated in the order that it is received, but strictly speaking this is not documented
13 replies
ATApache TinkerPop
•Created by danielcraig23 on 5/9/2024 in #questions
Is the insertion order guaranteed with this example code?
right, there are no any guaranties with
Promise.all
if for some reason the insertion order is important, then you need to call sequentially
gtx.addV("person").property("name", "jorge").iterate();
gtx.addV("person").property("name", "josh").iterate();
this is critical for mergeE/mergeV to avoid concurrent mergeV to add/update Vertex and mergeE which will use this Vertex13 replies
ATApache TinkerPop
•Created by danielcraig23 on 5/8/2024 in #questions
Is tx.close() necessary in Javascript?
not necessary, commit/rollback will also close the transaction
6 replies
ATApache TinkerPop
•Created by Lyndon on 5/7/2024 in #questions
Traversal Inspection for properties used
or Graph return vertex/edge and keeps track of which properties were used, then reads only used one
20 replies
ATApache TinkerPop
•Created by Lyndon on 5/7/2024 in #questions
Traversal Inspection for properties used
like run traversal for single element, collect all used properties and use it when need to get all other results
20 replies
ATApache TinkerPop
•Created by Lyndon on 5/7/2024 in #questions
Traversal Inspection for properties used
other way is to added wrapper for elements and Strategy to get results
20 replies
ATApache TinkerPop
•Created by Andre Pinto on 4/23/2024 in #questions
Combine two queries to perform only one
with pagination a bit more complex
g.V().filter(out().count().is(gt(0))).range({start_index}, {end_index}).group().by(out())
12 replies
ATApache TinkerPop
•Created by Andre Pinto on 4/23/2024 in #questions
Combine two queries to perform only one
Looks like Neptune does not support starting
union
step, but it's better to check with Neptune guys.
for such a result structure is more suitable group
step
g.V().hasLabel('Groups').group().by(out())
12 replies
ATApache TinkerPop
•Created by Andre Pinto on 4/23/2024 in #questions
Combine two queries to perform only one
I'm not sure which is more appropriate in this case...
12 replies
ATApache TinkerPop
•Created by Andre Pinto on 4/23/2024 in #questions
Combine two queries to perform only one
other possible way is like
g.V().as('V0').out().as('V1').range({start_index}, {end_index}).select('V0','V1').by(elementMap())
12 replies
ATApache TinkerPop
•Created by Andre Pinto on 4/23/2024 in #questions
Combine two queries to perform only one
Simple solution is to use
union
step https://tinkerpop.apache.org/docs/current/reference/#union-step
something like
g.union(
V().hasLabel('Groups').range({start_index}, {end_index}).elementMap(), V().hasLabel('Groups').out().range({start_index}, {end_index}).elementMap()))
12 replies
ATApache TinkerPop
•Created by danielcraig23 on 4/18/2024 in #questions
.mergeV() with Javascript not working
what is the type of
userId
?28 replies
ATApache TinkerPop
•Created by dmcmanus on 4/3/2024 in #questions
Lambda example in TypeScript
there is javascript example https://docs.aws.amazon.com/neptune/latest/userguide/lambda-functions-examples.html#lambda-functions-examples-javascript
5 replies