The TinkerPop traversal API

Reference commands and other information for Apache TinkerPop’s Gremlin as used by DataStax Graph.

TinkerPop commands are used in DataStax Graph traversal queries.

Apache TinkerPop graph computing framework

Describe the Apache TinkerPop framework.

General steps, step-modulators, and predicates

TinkerPop general steps, step-modulators, and predicates

TinkerPop Predicates

Predicates are used to determine relationships between data within traversals.

TinkerPop Step-modulators

Helpers for Gremlin steps in traversals.

TinkerPop Vertex Steps

Fundamental steps of Gremlin language

addV

Specify a vertex from a traversal.

addE

Specify an edge from a traversal.

property

How to specify a property from a traversal.

mid-traversal V()

Fetch a vertex in the middle of a graph traversal.

aggregate

Aggregate all objects into a collection at a particular point in a graph traversal.

and

Filter traversals using the AND boolean.

barrier

Causes all steps prior to the barrier step to be executed before moving onto additional steps.

branch

Split a traversal based on values.

cap

Iterates the traversal up to itself and returns the referenced object by the provided key.

choose

Route a traverser to a particular traversal branch option.

coalesce

Return a value based on the first traversal that has an element.

coin

Get a random coin toss value with stated odds.

constant

Set a constant value.

count

Get a count of the traverser that precedes the count step.

cyclicPath

Filter out repeated steps in a traversal

dedup

Deduplicate returned objects from a query.

drop

Drop a traversal object.

explain

Explain the traversal strategies used in a traversal.

fill

Put all results in the provided collection, then return the collection.

filter

Filter the traversal to eliminate some of the returned objects based on a criteria.

flatMap

Create a map of traversal objects and stream to the next traversal step.

fold

Aggregate all the returned objects into a list, then emit the list.

group

Organize returned objects by a function of the objects.

groupCount

Determines the number of objects specified.

has

Filter based on a particular vertex or edge label, property key, or property value.

hasId

Filter based on a particular id.

hasKey

Filter based on a particular property key.

hasLabel

Filter based on a particular vertex or edge label.

hasNext

Determine if results are available from a traversal.

hasNot

Filter based on a particular label or value not present.

hasValue

Filter based on a particular property value.

id

Fetch the id of a graph object.

inject

Inject an object arbitrarily into a traversal stream.

is

Filter for scalar values.

key

Extracts property keys for specified object.

label

Extracts the specified labels.

limit

Limit the objects returned.

local

Limit the operation of the traversal to a single element within the traversal.

loops

Get the number of times a query has gone through a particular loop.

map

Map a portion of the query.

match

Provides a more declarative form of graph querying based on pattern matching.

math

Enables scientific calculator functionality.

max

Get the largest number in a traversal.

mean

Get the mean average in a traversal.

min

Get the smallest number in a traversal.

next

Find the next results.

not

Exclude a specified object from the traversal.

optional

Returns an optional result if the specified traversal yields a result; otherwise, returns the calling element.

or

Yield at least one result from choices.

order

Sorts objects given a certain criteria.

pageRank

Calculates pageRank.

path

Examine the history of a traversal’s path.

peerPressure

Executes a Peer Pressure community detection algorithm over the graph.

profile

Profile a traversal to determine statistical information.

project

Projects the current object into a map keyed by provided labels.

properties

Retrieve properties of a specified element.

propertyMap

Yields a map representation of the properties of an element.

range

Filter only a specified number of objects into the next step.

repeat

Loop until a condition is met.

sack

Read and write sacks.

sample

Sample previous steps in the traversal.

select

Select labeled steps.

sideEffect

Perform some operation on the traverser and pass the result to the next step.

simplePath

Use to prevent a traverser from repeating a path through the graph.

skip

Skip a specified number of return objects.

store

Store information for later use in the traversal.

subGraph

Get a subgraph of the full graph.

sum

Sum the previously returned objects.

tail

Get the last specified number of returned objects.

timeLimit

Limit the traversal to a specified number of milliseconds of execution time.

toBulkSet

Return all restuls in a weighted set.

toList

Return all results in a list.

toSet

Return all results in a set with duplicated removed.

tree

Create a tree of the traversal.

unfold

Unfold a returned object into a linear form.

union

Merge the results of several traversals.

value

Get the value of a property given a specified property.

valueMap

Yields a map representation of the properties of an element.

values

Extract the value of properties for an element.

where

Filters based on a predicate, a sideEffect or a traversal.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com