Apache TinkerPop
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
Join ServerApache TinkerPop
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
Join ServerCommunity questions
Channels
Use of by()
by()
is a step modulator, meaning it modifies the step it is being applied to in some way by giving it some additional instruction. an easy example to see this with is groupCount()
:gremlin> g.V().groupCount()
==>[v[1]:1,v[2]:1,v[3]:1,v[4]:1,v[5]:1,v[6]:1]
Calling
groupCount()
without modulation implies the default behavior of grouping on the incoming traverser (i.e. the current Vertex
). Each Vertex
is simply counted once as a result as they are each unique entities. If we want to change that grouping behavior, we modulate that step with by()
, like:gremlin> g.V().groupCount().by(label)
==>[software:2,person:4]
Now we're saying, go ahead and group count the vertices but use the label of the
Vertex
for the grouping. it is important to note that what by()
does is dependent on the step to which it is applied (and that on its own it really doesn't do anything at all).@GremlinDSL support in the GremlinLangScriptEngine
I recently sent a pull-request into the github ArcadeDB repository to add support binding custom TraversalSources to the embedded graph bound in the script engine. ArcadeDb has modes to support both the
GremlinLangScriptEngine
and the GremlinGroovyScriptEngine
.https://github.com/ArcadeData/arcadedb/pull/1239
I realized today that the
GremlinLangScriptEngine
went untested, and after trying to add a test I've come to question whether there is any support at all for DSLs in the Gremli...RepeatStep does not appear to respect barriers
g.V(<ids>).repeat(out()).until(out().count().is(0)).toList()
For the graph implementation in question,
out()
is implemented on top of a CollectingBarrierStep
.I noticed that that fact is not respected by the repeat and it only gets 1 item at a time, i.e no aggregation.
I removed my strategy and changed the query to:
g.V(<ids>).repeat(barrier(10).out()).times(2).toList()
and then put...
Trying to find a Vertex using a variable injected earlier in the traversal
to
Vertex. From business logic, I will know the ID of the from
Vertex for the new Edge . I am able to create the new Vertex without any issue, but when I am having trouble grabbing the from
Vertex to create the edge. Is there a way to do this/what am I doing wrong?```g.inject(["myID": "2", "parentID": "1", "properties": ["key1":"value1"]]).
addV("MyVertex").as("newVertex").
pr...
Individual Vertex per property or Vertex with grouped properties
Filter out empty results
==>{}
==>{}
==>{oncall_roster=[oncall_schedule]}
How to skip or ignore the {} empty results in query
Question on running queries in windows env.
RuntimeError: Event loop is closed
, but after troubleshooting I notice that my script ran just fine. It crashed after the script eded. I suppose I was just ignoring it at first, but should I? I'm using asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
. Should I just ignore the error or should I deal with it? if the latter, how?PropertiesStep.hashcode() not always unique
We're working with Gremlin (groovy) to write queries against an in memory graph model implemented in java.
I've implemented a custom traversal strategy that will find all PropertiesStep instances in the traversal and prepend a custom step to each one (I could go into more detail but it's not actually relevant to my question).
While implementing the
apply
method of the strategy I was getting the index of the PropertiesStep
instances using the indexOf
method:`traversal.g...
Trying to run a local version for a test, what is the correct serializer?
Running this, https://github.com/bricaud/gremlin-server but updated the version to apache-tinkerpop-gremlin-server-3.7.0
I had issue with the
serializers:
section of the gremlin-conf.yaml
so I commented out to see if the defaults would work. The docker image loads fine, but then I can't seem to connect to it. My simple test:
print('Number of nodes {}, number of edges {}.'.format(g.V().count().next(),g.E().count().next()))
My er...
adding edges to multiple vertices at once
Wondering is there anyway around adding an edge from multiple vertices at the same time?
For example
g.V(vertexId).addE(“linked_to”).from(__.V(vertex2,vertex3))
Thanks for any help. This has stumped me for three days 😂
Does .math() always return a Double?
Long tenHours = Long.valueOf(Duration.ofHours(10).toMillis());
g.withSideEffect("tenHours", tenHours).inject(1689570000000L).math("_ + tenHours").next().getClass()
Trying to update a property value based on another property
g.V('9999').hasLabel('someLabel').properties('PropertyName').hasId('1234').property('currentDate',12/12/2023).property('previousDate',10/10/2023)
Using this query when an Id matches the passed value on hasId the data needs to be updated. I'm able to update currentDate & previousDate, which is a meta property, on the following data, however I'd also like to update the 'value' field which is on the same level as the 'id' field. My question i...
Casting issue with Gremlin Java
g.V(..).in(..).<some contraints that do not change it from a vertex).
fold().project("visits", "form").
by(__.unfold().values("...").dedup().count()).
by(__.unfold().
repeat( __.in()).
emit(__.<etc>))
The problem is because of the fold it loses the t...
valueMap and Multivalues
l, err := g.G.V(id).HasLabel("geoname").
ValueMap().With(gremlingo.WithOptions.Tokens).
Map(__.Unfold()).
Group().By(Keys).
By(__.Choose(__.Select(Values).Count(Local).Is(1),
__.Select(Values).Unfold(),
__.Select(Values))).
Unfold().
ToList()
However, what I want is for the properites in Neptune that have...
AWS Neptune bulk load notifications
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 stan...
VertexProgram filter graph before termination
B vertices are "below" A vertices.
The VertexProgram aggregates stuff about the underlying B vertices into their common parent A vertex.
I've successfully done the aggregation, but now I want to filter the A vertices that don't pass a predicate about the aggregated property they've accumulated based on messages from their underlying B vertices.
I was thinking of having a follow-up state machine for the VertexProgram like the S...
Straightforward way to render a force directed graph svg/png
Can't do explain() traversal step using Gremlin-Python ..
g
, but as mentioned on twitch, I'm unable to add an explain() step to one of my first traversals.i start with
g
a connected graphTraversalSource
and perform the followingvertex = g.add_v("my_vertex").next()
vertex = (
g.V(vertex)
.property("~supernode", True)
.property("foo", "bar")
.property("baz", "biz")
.explain()
.next()
)
when the explain ste...