Functions, Tokens and Values

between: the same as P.between, without the class name.

containing: the same as P.containing, without the class name.

empty: Creates a new empty graph, private to the script, and returns its traversal source.

GraphSource::empty().v().count().next()   // 0

ending_with · endingWith: the same as P.ending_with, without the class name.

eq: the same as P.eq, without the class name.

Fake: A seeded generator of English test data and random numbers: the same seed and calls give the same values; without a seed it picks one (see the book page Generating test data).

Fake(1).full_name()   // Victoria Vargas

file: Loads a graph file (.xml/.graphml, GraphSON .json) into a new private graph (needs file access).

GraphSource::file("modern.graphml").v().count().next()

file_tree: Creates a private sample graph of a file tree (directories, files, symlinks), as used by glob_path().

GraphSource::file_tree().v().count().next()   // 37

gt: the same as P.gt, without the class name.

gte: the same as P.gte, without the class name.

inside: the same as P.inside, without the class name.

jpath: Builds a JSONPath property key for nested values, usable wherever a property name is (see the book page Path keys (jpath)).

g.inject(#{a: #{b: [5, 6]}}).values(jpath("a.b[1]")).to_list()   // [6]

lt: the same as P.lt, without the class name.

lte: the same as P.lte, without the class name.

neq: the same as P.neq, without the class name.

not: the same as P.not, without the class name.

not_containing · notContaining: the same as P.not_containing, without the class name.

not_ending_with · notEndingWith: the same as P.not_ending_with, without the class name.

not_regex · notRegex: the same as TextP.not_regex, without the class name.

not_starting_with · notStartingWith: the same as P.not_starting_with, without the class name.

outside: the same as P.outside, without the class name.

regex: the same as TextP.regex, without the class name.

starting_with · startingWith: the same as P.starting_with, without the class name.

tinkerpop_modern: Creates a private copy of TinkerPop's modern sample graph (6 vertices, 6 edges).

GraphSource::tinkerpop_modern().e().count().next()   // 6

typeOf: the same as P.typeOf, without the class name.

UUID: Returns a new random UUID value.

type_of(UUID())   // Uuid

within: the same as P.within, without the class name.

without: the same as P.without, without the class name.

By.JsonPath: A by() argument that reads a nested value by a JSONPath.

g.inject(#{a: #{b: 2}}, #{a: #{b: 1}}).order().by(By.JsonPath("a.b")).to_list()   // [#{"a": #{"b": 1}}, #{"a": #{"b": 2}}]

By.Property: A by() argument that reads the named property (the same as by("name")).

g.v().has_label("person").order().by(By.Property("age")).values("name").to_list()   // ["vadas", "marko", "josh", "peter"]

By.Traversal: A by() argument that runs a child traversal (the same as by(__.x())).

g.v().has_label("person").order().by(By.Traversal(__.out_e().count())).values("name").to_list()   // ["vadas", "peter", "josh", "marko"]

Cardinality.list: A property value tagged with Cardinality.list; writing it fails (one value per key, see the book page Upserts).

type_of(Cardinality.list(5))   // CardinalityValue

Cardinality.set: A property value tagged with Cardinality.set; writing it fails (one value per key, see the book page Upserts).

type_of(Cardinality.set(5))   // CardinalityValue

Cardinality.single: A property value tagged with Cardinality.single, for merge_v()/merge_e() option maps.

g.merge_v(#{"T.id": "1"}).option(Merge.onMatch, #{age: Cardinality.single(30)}).values("age").next()   // 30

CastPolicy.Default: A cast policy that replaces a value that does not convert with the given fallback.

g.inject("x", "1").as_number(GType.LONG, CastPolicy.Default(0)).to_list()   // [0, 1]

UUID.from_string · UUID.fromString: Parses a UUID value from its canonical text.

UUID.from_string("123e4567-e89b-12d3-a456-426614174000").as_string()   // 123e4567-e89b-12d3-a456-426614174000

Uuid.as_string · Uuid.asString: The canonical text of the UUID value.

UUID.from_string("123e4567-e89b-12d3-a456-426614174000").as_string().len()   // 36

Set.of: A set value (duplicates dropped) of the given values, e.g. to seed a set side effect.

g.with_side_effect("s", Set.of()).v().out().values("name").aggregate("s").cap("s").next()   // ["josh", "lop", "vadas", "ripple"]

Set.of_list · Set.ofList: A set value (duplicates dropped) of the elements of the given list.

g.with_side_effect("s", Set.of_list(["lop"])).v().out().values("name").aggregate("s").cap("s").next()   // ["lop", "josh", "vadas", "ripple"]

Map.contains: Whether a map with non-string keys has the given key.

g.v().group().by("age").next().contains(29)   // true

Map.contains_key · Map.containsKey: Whether a map with non-string keys has the given key (alias of contains()).

g.v().group().by("age").next().contains_key(30)   // false

Map.is_empty · Map.isEmpty: Whether a map with non-string keys has no entries.

g.v().group().by("age").next().is_empty()   // false

Map.keys: The keys of a map with non-string keys (group(), group_count() results).

g.v().has_label("person").group_count().by("age").next().keys()   // [29, 27, 32, 35]

Map.len: The number of entries of a map with non-string keys.

g.v().group().by("age").next().len()   // 4

Map.to_map · Map.toMap: Converts the map to a plain Rhai object map; fails when a key is not a string.

g.v().group_count().by("age").next().to_map()   // error: non-string key 29

Map.values: The values of a map with non-string keys.

g.v().has_label("person").group_count().by("age").next().values()   // [1, 1, 1, 1]

V.Auto: The default display format: chosen by the result's shape.

g.v(1).values("name").visualize(V.Auto)

V.Json: Display format: JSON text.

g.v(1).values("name").visualize(V.Json)

V.JsonSchema: Display format: the JSON Schema of the results (a schema map as JSON Schema; other results as JSON per line).

g.v(1).values("name").visualize(V.JsonSchema)   // "marko"

V.Markdown: Display format: a Markdown table.

g.v(1).values("name").visualize(V.Markdown)

V.Mermaid: Display format: Mermaid (a schema map as a diagram; other results as JSON per line).

g.v(1).values("name").visualize(V.Mermaid)   // "marko"

V.PlantUML: Display format: PlantUML (a schema map as a diagram; other results as JSON per line).

g.v(1).values("name").visualize(V.PlantUML)   // "marko"

V.Table: Display format: a text table.

g.v(1).values("name").visualize(V.Table)

V.Tree: Display format: an indented tree.

g.v(1).out().visualize(V.Tree)

GraphSource.empty: Creates a new empty graph, private to the script, and returns its traversal source.

GraphSource::empty().v().count().next()   // 0

GraphSource.file: Loads a graph file (.xml/.graphml, GraphSON .json) into a new private graph (needs file access).

GraphSource::file("modern.graphml").v().count().next()

GraphSource.file_tree: Creates a private sample graph of a file tree (directories, files, symlinks), as used by glob_path().

GraphSource::file_tree().v().count().next()   // 37

GraphSource.tinkerpop_modern: Creates a private copy of TinkerPop's modern sample graph (6 vertices, 6 edges).

GraphSource::tinkerpop_modern().e().count().next()   // 6

map.subgraph: The meta-graph of one label of a schema map (private to the script).

g.infer_schema().subgraph("person").v().count().next()   // 1

map.subgraph_labels: The meta-graph of the given labels of a schema map (private to the script).

g.infer_schema().subgraph_labels(["person", "software"]).v().count().next()   // 2

map.to_graph · map.toGraph: Builds the meta-graph of a schema map: one vertex per label, one edge per declared connection (private to the script).

g.infer_schema().to_graph().v().count().next()   // 2

TraversalMetrics.to_json · TraversalMetrics.toJson: The profile as JSON text.

g.v().count().profile().to_json().contains("count_pushdown")   // true

TraversalMetrics.to_map · TraversalMetrics.toMap: The profile as a map: duration_ns, metrics per step, optimizer_rules_applied.

g.v().count().profile().to_map()["optimizer_rules_applied"]   // ["count_pushdown"]

TraversalMetrics.to_table · TraversalMetrics.toTable: The profile as the text table that profile() shows.

g.v().count().profile().to_table().contains("v().count()")   // true

Execution.to_json · Execution.toJson: The execution (results, error, profile) as JSON text.

g.v().count().execute().to_json()   // {"results":[6],"error":null,"profile":null}

Execution.to_map · Execution.toMap: The execution as a map: results, error, profile, mutated, changes.

g.v().count().execute().to_map()["results"]   // [6]