Skip to main content

Crate gremlin_rs

Crate gremlin_rs 

Source
Expand description

§gremlin-rs

A parser for the Gremlin graph traversal language, generated from Apache TinkerPop’s official Gremlin.g4 grammar via antlr-rust-runtime.

Unlike a Gremlin client (which builds traversals programmatically and sends bytecode to a server), this crate parses Gremlin text — e.g. g.V().has('name','marko').out('knows').values('name') — into a parse tree you can walk, translate, lint, or analyze.

Because the parser is generated from the same grammar TinkerPop uses for its JVM and JavaScript language variants, it tracks the official language rather than a hand-maintained approximation.

§Example

use gremlin_rs::parse;

let tree = parse("g.V().has('name','marko').out('knows').values('name')")?;
println!("{}", tree.text());

Enums§

GremlinParseError
An error produced while parsing Gremlin text.
ParseTree

Functions§

parse
Parses a Gremlin query list — one or more ;-separated traversals — the grammar’s top-level queryList entry rule.
parse_query
Parses a single Gremlin query (the grammar’s query entry rule) rather than a ;-separated list. Use this when you know the input is exactly one traversal or expression.