Questions tagged [gremlin]

Gremlin is the graph traversal language and virtual machine of Apache TinkerPop™

Gremlin is a graph traversal language and virtual machine, developed by Apache TinkerPop. Gremlin is designed to work with any TinkerPop-enabled graph system, such as Titan, OrientDB, Neo4j, RDF stores like Stardog and Blazegraph, and others.

For more information, see the most recent reference documentation for TinkerPop.

3522 questions
124
votes
9 answers

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/traversal language). Here's what I want to know -…
Rubinsh
  • 4,883
  • 10
  • 34
  • 41
35
votes
8 answers

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 something like SQL TRUNCATE. How do you remove…
Aleksandrenko
  • 2,987
  • 6
  • 28
  • 34
22
votes
2 answers

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 records. I want to fetch them 10 by 10 without…
Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
22
votes
3 answers

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 have a titan running on cassandra and query with…
Mermoz
  • 14,898
  • 17
  • 60
  • 85
21
votes
1 answer

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', 'John') ).next(); What is the purpose of the…
cejast
  • 957
  • 8
  • 18
20
votes
2 answers

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 need to update the properties. I wanted to use…
Rom Eh
  • 1,981
  • 1
  • 16
  • 33
18
votes
2 answers

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 are available how to do this in versions < v3, such…
18
votes
2 answers

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 index... gremlin> :remote connect tinkerpop.server…
Gao
  • 912
  • 6
  • 16
18
votes
1 answer

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 -> Vertex X?
HEART94
  • 307
  • 2
  • 10
17
votes
2 answers

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',…
Fook
  • 5,320
  • 7
  • 35
  • 57
16
votes
1 answer

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…
Auricopter
  • 161
  • 1
  • 4
16
votes
4 answers

Is it possible to visualize the output of a graph query (Gremlin or SPARQL) as nodes and edges in Amazon Neptune?

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 graphs?
The-Big-K
  • 2,672
  • 16
  • 35
16
votes
3 answers

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 a Unix timestamp. They are stored as UTC in the…
F21
  • 32,163
  • 26
  • 99
  • 170
14
votes
0 answers

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 file. Doing that, it seems to work as I can see the…
14
votes
3 answers

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','def')) and then add only those for which the…
Vipul Sharma
  • 768
  • 3
  • 11
  • 25
1
2 3
99 100