Questions tagged [gremlin]
Gremlin is the graph traversal language and virtual machine of Apache TinkerPop™
gremlin
3,615
questions
130
votes
9
answers
51k
views
Neo4j - Cypher vs Gremlin query language
I'm starting to develop with Neo4j using the REST API.
I saw that there are two options for performing complex queries - Cypher (Neo4j's query language) and Gremlin (the general purpose graph query/...
36
votes
8
answers
36k
views
Gremlin remove all Vertex
I know how to remove a vertex by id in Gremlin.
But now I'm need to cleanup the database.
How do I delete multiple vertices?
Deleting 1 v is like this:
ver = g.v(1)
g.removeVertex(ver)
I mean ...
23
votes
2
answers
12k
views
How to perform pagination in Gremlin
In Tinkerpop 3, how to perform pagination? I want to fetch the first 10 elements of a query, then the next 10 without having to load them all in memory. For example, the query below returns 1000,000 ...
22
votes
1
answer
8k
views
Why do you need to fold/unfold using coalesce for a conditional insert?
I'm trying to understand how this pattern for a conditional insert works:
g.V()
.hasLabel('person').has('name', 'John')
.fold()
.coalesce(
__.unfold(),
g.addV('person').property('name', ...
22
votes
3
answers
11k
views
How to start Titan graph server and connect with gremlin?
I've been playing with Titan graph server for a while now. And my feeling is that, despite an extensive documentation, there is a lack of Getting started from scratch tutorial.
My final goal is to ...
20
votes
2
answers
7k
views
CosmosDB Graph : "upsert" query pattern
I am new to Gremlin query language.
I have to insert data on a Cosmos DB graph (using Gremlin.Net package), whether the Vertex (or Edge) already exists in the graph or not. If the data exists, I only ...
19
votes
2
answers
694
views
How to start a new connection with CosmoDB graph database using gremlin on version ^3
I am trying to create a new gremlin client in node js, but I cannot find any documentation how to set up the connection with both a URL and a primary key (as generated in Azure CosmosDB).
Examples ...
18
votes
2
answers
10k
views
How can I use gremlin-console to remotely create and access variables?
I remotely connect to a gremlin server using gremlin-console(which is janusgraph), but when I create a variable and access it, it doesn't work. My ultimate goal is to use gremlin-console to create ...
18
votes
1
answer
6k
views
How to create a bidirectional edge between two vertices using gremlin?
What is the best way to create a bidirectional edge between two vertices using gremlin. Is there a direct command which adds the edge or should we add two edges like vertex X -> Vertex Y and vertex Y -...
17
votes
2
answers
2k
views
Unable to create a composite index, stuck at INSTALLED
I'm unable to create an index. My Gremlin code is as follows:
usernameProperty = mgmt.getPropertyKey('username')
usernameIndex = mgmt.buildIndex('byUsernameUnique', Vertex.class).addKey(...
16
votes
4
answers
11k
views
Is it possible to visualize the output of a graph query (Gremlin or SPARQL) as nodes and edges in Amazon Neptune? [closed]
GREMLIN and SPARQL only define the APIs for graph queries. How do I use the API responses and and plot that as an actual graph, with edges and vertices? Is there something like MySQL Workbench for ...
16
votes
3
answers
47k
views
Parsing dates without timezone conversion
I am working with groovy (gremlin to traverse a graph database to be exact). Unfortunately, because I am using gremlin, I cannot import new classes.
I have some date values that I wish to convert to ...
15
votes
1
answer
7k
views
Gremlin update existing property
How do I update an existing property of a node in a graph using Gremlin?
The following method creates two properties "timestamp" with 2 different values, instead of updating the existing property "...
15
votes
0
answers
2k
views
JanusGraph BulkLoading CSV with ScriptInputFormat
I am trying to load a CSV file into a JanusGraph.
As I understand it, I need to create my graph and the schema, then use the BulkLoaderVertexProgram with my own custom groovy script to parse a csv ...
14
votes
3
answers
12k
views
Gremlin - only add a vertex if it doesn't exist
I have an array of usernames (eg. ['abc','def','ghi']) to be added under 'user' label in the graph.
Now I first want to check if the username already exists (g.V().hasLabel('user').has('username','...