Apache TinkerPop

AT

Apache TinkerPop

Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.

Join

Cryptic Neptune Gremlin Error Rate Creeping - What Would You Recommend?

This relates more to do with Neptune usage, nevertheless, it is also related to the Gremlin Query error rate that logs in to the Monitor plot page and also triggers cloud watch alert in our case. Situation: We've noticed a gradual increase in unexplained Gremlin error counts — with a few popping up every several hours....

kubehound

If anyone is familiar with KubeHound DSL. Can someone explain why Query 1 is different from Query 2. They are both returning values that are very close to eachother but not exact: Query 1 g.V() .hasLabel('Container') .out().emit().repeat((...
Solution:
I figured it out, I've attached the fixed query 1
No description

Help with visualizing in the graph-notebook

I am trying to visualize a graph in the graph-notebook but no matter what I do I cannot get it to be correct. So I have a very simple graph that has like 6 vertices, connected with maybe 8 edges, and I want to just visualize that graph with the labels of the vertices and edges on the visualization and the properties available if you select the details. I have tried may variations of g.V().out().path / g.V().outE().inV().path() with elementMap() before path, using path().by(elementMap()), as well as trying from g.E() and other things. Nothing seems to work, randomly edges are missing labels, or an exta edge is added to each vertex that just goes to itself. ...
Solution:
Found this https://github.com/aws/graph-notebook/blob/c357870d2a5bce88c986fa114b613ec72ce065f7/src/graph_notebook/notebooks/02-Visualization/Grouping-and-Appearance-Customization-Gremlin.ipynb#L23 and ended up getting a solution with ``` %%gremlin -p v,oute,inv -l 30 g.V().outE().inV().path().by(elementMap())...

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?
Solution:
I can definitely chime in but the short answer is no - I'm actually planning to switch to Monaco in G.V(), best answer I can provide is that there are plenty guides available out there on how to integrate Monaco with an ANTLR grammar to provide both syntax error detection and editor suggestions (with the added use of antlr4-c3 on npm). A quick google search of monaco antlr4 should give you a step by step guide on all that. That being said if you want a fully featured Gremlin query editor you're not gonna find anything better than G.V() wink wink...

Connecting to local gremlin server with websocket address

Hello everyone. I'm looking for help with a client app written in Java that uses Tinkerpop Gremlin to interact with a Janusgraph instance. When developing new features, I run a local Janusgraph with a Gremlin server at localhost. I'm trying demonstrate that I can take a websocket url and establish a connection using that URL. I believe that the default websocket address for a local Gremlin server is ws://127.0.0.1:8182/gremlin. I'm trying to use a Cluster to create the connection and obtain a GraphTraversalSource. Here's what I'm trying. Cluster cluster = Cluster.build("ws://127.0.0.1:8182/gremlin").create(); GraphTraversalSource g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(cluster)); ...
Solution:
By default it will connect via websocket so you can try ``` Cluster cluster = Cluster.build("localhost"). path("/gremlin"). create();...

Clarification on Kerberos configuration for Gremlin Driver

I'm a little bit unclear on the role of the JAAS configuration file for the Gremlin client in the context of the gremlin-driver (rather than just the GremlinConsole). Looking at https://tinkerpop.apache.org/docs/current/reference/#krb5authenticator Is the naming convention around the jaasEntry name at all of relevance or can any gremlin-driver assume the existence of a GremlinConsole jaas entry? I'm assuming the mapping here between jaasEntry name and gremlin-driver configuration is done by setting the jaasEntry value on the ClusterBuilder but just looking for confirmation on that!...

Gremlin Driver and frequently changing servers

In a containerised environment, hosts are frequently replaced and their IP address can change several times a day. As far as I can tell, Gremlin Driver was designed for long-lived hosts given that: (1) Contact Points are resolved on startup and a connection pool is assigned to them at that time - this makes varying contact points over time not possible I think? (2) Unavailable hosts are retried but the list of hosts is not refreshed - wouldn't it make more sense to give up on hosts after a few retries and refresh the list of contact points?...
Solution:
yes, this is a bit of an issue in some cases like the one you describe. a similar issue occurs for Neptune where it would be helpful if the drivers knew the cluster topology. you're basically left to periodically recreate the Cluster object and updating the contact points. Neptune has a special client that wraps the TinkerPop driver to do just that: https://aws.amazon.com/blogs/database/load-balance-graph-queries-using-the-amazon-neptune-gremlin-client/ i've always thought it would be nice if...

Global Search

Is there a way where i can scan all the vertex or edge properties that match a given keyword in gremlin. For ex : g.V().has('name','John') ...
Solution:
you could do: ``` // 3.7.0+ gremlin> g.union(V(), E()).has('name','josh') ==>v[4]...

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 ...
Solution:
Do you already have data in GraphSON format? Or do you just need to use a bulk importer? If the latter, Neptune has it's own bulk load feature: https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load.html

.drop() behavior confussion

I have a basic java app and I'm learning hot to send gremlin queries to a JanusGraph from that java app. I just played around with mkaing some nodes, but the .drop() method is not removing them all like I expected. What am I missing in this context?
Solution:
This issue is addressed in lots of places but you probably just haven't come across them yet. You're missing a terminal step after the drop(). The terminal step actually executes the traversal...drop() is not such a step. You would likely use iterate() in this case as your terminal step. https://tinkerpop.apache.org/docs/current/reference/#terminal-steps
No description

Can I name the result of an anonymous traversal without moving the traverser?

I can currently do the following: ``` Graph graph = TinkerFactory.createModern(); ...
Solution:
You could perhaps play around with store ``` gremlin> g.V().hasLabel("person"). ......1> has("name", "josh"). ......2> where(__.out().has("name", "ripple").store('a'))....

Can GraphBinary be used to save a graph to file?

Can GraphBinary be used to save graph in a file. Any example is welcome.
Solution:
I think you would have to use GraphSON the way @danielcraig23 described. Or if using Java, Gryo. We simply never created GraphBinaryGraphWriter implementations because GraphBinary was built for network serialization. I suppose it could be used that way, but no one has ever really made a request to do that.

How to get cardinality of property?

I have a multi property and I want to find out its cardinality. How can I do that? valueMap/elementMap don't help...
Solution:
TinkerPop really doesn't know, so it can't tell you the answer. It has no notion of schema. You as the user have to know and adjusting your Gremlin accordingly in your application layer. The best that we have internally (and maybe for embedded use cases) is VertexFeatures.getCardinality(String) which, if implemented by the provider, will tell you a hint at the cardinality. https://github.com/apache/tinkerpop/blob/1e3c881d9f157167b53f431898e6d1ee40429cd0/gremlin-core/src/main/java/org/apache/t...

inverted regex search

Hey, In my vertices I store escaped regexp statements as labels (e.g: 'wh.' which in theory should match the string "why"). I have an input string such as for example 'why'. This input parameter string string should be matched against the regexps stored in the vertices and the matching vertices should be returned. What would be the way to do that? Is there a more optimal query to that than let's say ''' g.label().filter(regex(label()).matches('why')) ''''...
Solution:
Sorry, I didn't see this question for some reason. I can't think of a way to do what you want to do. regex is a P which is a form of predicate and P cannot take dynamic values. The only way you could do it is to use a lambda/closure as you already tried to do: ``` gremlin> import java.util.regex.Pattern ==>java.util.regex.Pattern gremlin> g = TinkerGraph.open().traversal()...

Debug message spam from tinkerpop server 3.7

Right now, when connecting to my local tinkerpop server, I am getting incredible amounts of debug log spam, and I am unsure how to configure to reduce it. The docs talk about being able to set environment variables in a bin/gremlin-server.conf next to the server start script, and I have done that, but they only list valid environment variables no examples of usage. If I treat it like a .env file, I would expect something like DEBUG=False to do the trick but this does not seem to be the case? It may be relevant that I am running this on windows, and therefore using the .bat and not the .sh. I feel like I am missing something obvious, but I am not sure what I should be looking at next?...
Solution:
I have configured the logback.xml in both the server and console directories to ERROR level and verified it suppresses all output from both at launch. but as soon as I connect to the server, that seems to be overridden. However, I have found a workable solution running everything in docker(identical configs across the board), so I am going to chalk this up to windows weirdness and leave it. thanks for taking the time to look at this though....

Should by() Modulator Work For More Types?

This works. gremlin> g.V().out().out().path().by("name") ==>[marko,josh,ripple] ==>[marko,josh,lop] ...
Solution:
This is a bug and I know whats' wrong. I will fix it for 3.7.1. Please create a JIRA for it.

InProcess GraphDB with Gremlin Support? (C# or NodeJS)

Hello, is there any in process GraphDB out there in the world? Best would be c# or NodeJS and not Java 😉 #questions <:provider_neptune:1131661367972221059>...
Solution:
Not that I know of for NodeJS. The best I've found is to either spin up a container (I believe there is a docker image for each version) or run gremlin server using a script before the code execution. In my case I needed to run unit-test on Neptune so I used the script method. I've seen this request a couple of times, if you're also interested I can try to make it open source...

Easiest Way to Get List Cardinality Properties As a List?

What is the easiest way to retrieve the vertex properties that have list cardinality back as a list in the traversal stream? The values() step seems to unfold the list. For example, using the "the crew" example graph. `gremlin> g.V().valueMap() ==>[name:[marko],location:[san diego,santa cruz,brussels,santa fe]]...
Solution:
after some reflection i sense that the question you are asking is actually the answer in the first place. i assume this is in relation to string/list functions, in which case use of valueMap() as you did and group() would be the the primary ways you'd end with a List where the former is the most likely one for the average case where you might want to do like:
g.V().valueMap().by(toUpper(local))
g.V().valueMap().by(toUpper(local))
but instead, as there is no local have to do:...

filter lambda in remote console

hi all, i’m trying to do filter on remote console to neptune server but keep getting MalformedQueryException for query like g.V().filter { it.get().label() == ‘person’ }. Advices are appreciated. TIA
Solution:
Neptune does not support closures/lambdas: https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html#feature-gremlin-differences-lambda you would have to use pure Gremlin steps, thus g.V().hasLabel('person')

within() and case insensitive

I need to check if a property of a node is in a list of values. How can I do that in a case insensitive manner? has('name',within('vadas','josh')) (+ case_insensitive?) I can do that naughty step : ...
Solution:
TextP.regex can be used, something like g.V().has("name", TextP.regex("(?i)^(vadas|josh)$"))...