Apache TinkerPop

AT

Apache TinkerPop

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

Join

`next(n)` with Gremlin JavaScript

I'm trying to do some basic pagination next(n) seems perfect, but it doesn't appear to be available for JavaScript as per the documentation. Is there a reason for this limitation?...
Solution:
AFAIK, that is only possible via scripts.
No description

Traversal Inspection for properties used

Is there any way to inspect a traversal to figure out what properties are used throughout it? I am looking at the traversal API / steps and can't see anything that looks like it would fulfill the purpose. Something that would tell what properties are used, which are returned. ...

Gremlin with AWS Neptune

Hey Friends, I am working on a project using AWS Neptune with gremlin query language on gremlingo driver. I realize the latest version of neptune is 1.3.1, and tinkerpop version is 3.6.4....
Solution:
note that Neptune 1.3.2.1 now supports the functionality of TinkerPop 3.7.x. You can read more about it at https://aws.amazon.com/blogs/database/exploring-new-features-of-apache-tinkerpop-3-7-x-in-amazon-neptune/

Running Tinkerpop test in Janusgraph repo

Hi I'm trying to run the below Tinkerpop test to test out some of the changes I've made to Janusgraph. By copying the test over from Tinkerpop repo into Janusgraph repo (just for testing one test). ```java @RunWith(Parameterized.class) public class TraversalInterruptionTest extends AbstractGremlinProcessTest {...
Solution:
You should copy the test suite definition test

configure gremlin-server to use remote Neptune server?

Hello, I’m wondering if it is possible to configure gremlin server to use the graph at remote Neptune instance so user can use my own authentication and not having to worry about AWS authentication methods? Many thanks!...

Query optimisation

Hey, I'm optimising some queries, and found that these 2 seemingly identical queries behave very differently in term of performance ```groovy g.V(). union(...
Solution:
If would suggest looking at the profile of the query and post it here as well as what database you are using (e.g. Gremlin Server, JanusGraph, Neptune, etc.) to see where the time is being spent. Without having more information it is difficult to give specifics as to why they query is slow.
Without any additional context I would take a guess that most of the difference in time is being spent doing has("account", "id", "my_account") since the first version is doing that filter twice....

Combine two queries to perform only one

can someone help me figureout how I can combine those two queries? groups = f"g.V().hasLabel('Groups').as('group_data').elementMap().range({start_index}, {end_index}).toList()" users = f"g.V().hasLabel('Groups').as('group_data').bothE('memberOf').otherV().as('members').select('members').by(elementMap()).range({start_index}, {end_index}).toList()"...
Solution:
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()))...

compatibility with Apache Jena Fuseki

Hello! I am new in the community and trying to figure out whether TinkerPop and Gremlin is supported by Jena Fuseki. I had a look at the TinkerPop-enabled graph systems page (https://tinkerpop.apache.org/providers.html) and Fuseki is not listed there, but I see other RDF graph databases in the list, which makes me think there might be some chance for Fuseki too. Could you please help?...
Solution:
There's a lot to unravel with that question. 🙂 Fuseki is a SPARQL server within the Apache Jena project that is mainly targeting RDF workloads and use cases. Whereas Apache TinkerPop is a framework and reference implementation for graph databases that support the Labeled Property Graph paradigm. While there are a few efforts (https://arxiv.org/abs/2110.13348) to integrate RDF and LPG, there are enough differences that make integrating Gremlin over RDF non-trivial. (Note the opposite maybe easier as there is a SPARQL-Gremlin compiler: https://tinkerpop.apache.org/docs/current/reference/#sparql-gremlin). The few RDF stores that are listed in the supported providers list have made certain concessions to provide an integration between Gremlin and RDF. As an example, Blazegraph's implementation stores data in an RDF* format: https://github.com/blazegraph/tinkerpop3. ...

Is the first traversal pattern evaluated by Match well defined

Hi, It seems to me that if the match step is able to dynamically select the first traversal pattern (as it does all other traversal patterns), and this selection isn't the same across all traversers, the behaviour of match isn't well defined. Consider the simple graph...

.mergeV() with Javascript not working

Hi, I have a nodeJS 18 lambda which is closely modeled after this documentation: https://docs.aws.amazon.com/neptune/latest/userguide/lambda-functions-examples.html#lambda-functions-examples-javascript here is my async query function: ```async function query(context) { const { userId } = context;...
Solution:
The solution was to allow neptune to use the default mimetype; removing the mimetype header solved the issue

Unable to deserialize results with Gremlin-go client + JanusGraph

Hi all - I'm trying to set up a JanusGraph database and use the Gremlin-go client to run some gremlin traversals over it. I'm facing some serialization error. My docker-compose file to start a JanusGraph at localhost:8182: ```yml...
Solution:
For Python, you can also use JanusGraph-Python to get better support for JanusGraph types: https://github.com/JanusGraph/janusgraph-python (JanusGraph-Python only extends Gremlin-Python so you will still be using that. It just adds serializers for JanusGraph types)...

Fulltext-search-like features without ElasticSearch, OpenSearch, Solr and such?

I've read in multiple sources that Apache TinkerPop isn't optimized for text search operations like partial string matching or Regex matching. A common "solution" seems to involve integrating the database with fulltext search engines like ElasticSearch or Solr. Is there another way of handling these kind of operations without adding another tool? I'm afraid this is getting way more complex than I wanted. Just some context, what I'm trying to do is filter nodes by one of their properties called legal_name, some similar to SQL...

Conditionally updating a variable with choose()

How do I create and update a variable with a conditional? I need a number to be calculated based on an arrangement of requirements. Here is a very simplified example of what I was trying to do: `g.addV('App').property('name', 'A').property('requirement1', true).property('requirement2', true). addV('App').property('name', 'B').property('requirement1', true).property('requirement2', false). addV('App').property('name', 'C').property('requirement1', false).property('requirement2', false).property('requirement3', true)...
Solution:
sorry, but it looks like this question was missed last week somehow. i think you're mostly on track for the best way to do this by using choose(). you could simplify your syntax a fair bit i think by using sack(): ```gremlin> g.withSack(0).V(). ......1> project('id', 'name', 'requirement1', 'requirement2', 'requirement3', 'value'). ......2> by('id'). ......3> by('name')....

Systems Analysis Report on Apache TinkerPop - Where to Start?

Hey all, I'm currently writing an alaysis on Apache TinkerPop for grad school and was just hoping that someone could point me in the right direction for some good materials or some example uses for this system! Any answers are appreciated, finding out a good chunk on my own through the official docs, but just wanted to see if there are any specific things that the community here thinks are notable. Have not used this before so trying to put together resources in order for me to better explain "w...
Solution:
i'm not sure what you're looking for when it comes to "example uses for this system" - i assume you mean real-world use case examples. you often have to search for the actual TinkerPop implementations to get some of those answers at times. TinkerPop as a framework tends to not get the core mention in blog posts and other news items. anyway, here's a few cases you could look at: https://innovation.ebayinc.com/tech/engineering/how-we-export-billion-scale-graphs-on-transactional-graph-databases/ https://aws.amazon.com/blogs/database/cox-automotive-scales-digital-personalization-using-an-identity-graph-powered-by-amazon-neptune/?pg=ln&sec=c ...

Lambda example in TypeScript

Does anyone know where I can find example code that demonstrates up-to-date best practices for writing TypeScript Lambda Functions that interact with Neptune?

mergeE(): increment counter on match

Hi, is there an easy way to increment an existing edge property based on its current value using mergeE() in one single query? (e.g., counter += 1) Something similar to this: ``` g.mergeE([(T.label):'called', (from): person1, (to):person2])....
Solution:
gremlin> g.mergeE([(Direction.from):44,(Direction.to):8]).valueMap(true)
==>[id:5062,label:route,dist:549]
gremlin> g.mergeE([(Direction.from):44,(Direction.to):8]).valueMap(true)
==>[id:5062,label:route,dist:549]
and then...

Serialization Issue

I have a weird error, when I am connecting with JanusGraph gremlin client using conf/remote-graph-binary.yaml I am able to get results. But when I am trying to use my java application I am getting, java.io.IOException: Serializer for custom type 'janusgraph.RelationIdentifier' not found. Googling around I got that this is due to serialization issue. It looks to me that the gremlin-client and my java application has similar configs but gremlin-client is not having any serialization problem. ``` hosts: [localhost] port: 8182...
Solution:
I have faced a similar issue in the past (but mostly related to gremlin-python) and @Boxuan Li suggested a solution in the JanusGraph discord server. It was something like along these lines: ``` private static MessageSerializer createGraphBinaryMessageSerializerV1() { final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();...

Design decision related to multiple heterogenous relational graphs

I'm working with over 100k instances of heterogeneous, relational node-and-edge attributed graphs, each graph having around 5k vertices and 10k edges. Vertices are of 3 types with 10 attributes (7 numerical, 3 string), and edges are of 5 types with 8 attributes (4 numerical, 4 string). Considering the complexity and size of the data, running queries like traversal paths, average clustering coefficients, and identifying nodes in clustering triangles across all these instances presents a significant challenge. I've been using a naive gremlin-server setup with an in-memory database to run my queries on one graph instance, but it's becoming clear that this approach isn't sustainable for multi-graph persistence or memory efficiency, as a single graph instance consumes about 1.2 GB of RAM. I'm exploring the possibility of switching to JanusGraph with a Berkeley DB backend to support persistent storage of multiple graphs (based on the feedback I got from the gremlin google group, https://groups.google.com/g/gremlin-users/c/UotOZFVvi3k/m/-hVd2oNNAQAJ). Given the data structure and requirements, especially the need for efficient loading and querying of individual graph instances in a possibly serializable fashion, do you think JanusGraph with Berkeley DB is a viable solution, or are there alternative approaches I should consider for managing and querying this volume of graph data effectively?...
Solution:
No we actually recommend using user-defined IDs

Stackoverflow when adding a larger list of property values using traverser.property()

Hey, we encounter a stack overflow: ``` Exception during Transaction, rolling back ... org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(org/apache/tinkerpop/gremlin/process/traversal/step/util/AbstractStep.java:150): Java::JavaLang::StackOverflowError from org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(org/apache/tinkerpop/gremlin/process/traversal/step/util/ExpandableStepIterator.java:55)...