Skip to content

Commit e024c92

Browse files
committed
Rename query to gremlinExpression
1 parent 01b708d commit e024c92

9 files changed

Lines changed: 27 additions & 27 deletions

File tree

CHANGELOG.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
2727
2828
* Added Gremlator, a single page web application, that translates Gremlin into various programming languages like Javascript and Python.
2929
* Removed `uuid` dependency from `gremlin-javascript` in favor of the built-in `globalThis.crypto.randomUUID()`.
30-
* Added declarative `traversalSources` configuration to Gremlin Server YAML for creating `TraversalSource` instances with optional strategy configuration queries.
30+
* Added declarative `traversalSources` configuration to Gremlin Server YAML for creating `TraversalSource` instances with optional strategy configuration via `gremlinExpression`.
3131
* Added Java-based `lifecycleHooks` configuration to Gremlin Server YAML, replacing Groovy init script `LifeCycleHook` creation.
3232
* Added `TinkerFactoryDataLoader` `LifeCycleHook` implementation for loading sample datasets without Groovy.
3333
* Added auto-creation of `TraversalSource` bindings from `graphs` configuration (`graph` maps to `g`, others to `g_<name>`).

docs/src/reference/gremlin-applications.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,22 @@ graphs: {
499499
==== Declarative TraversalSources
500500
501501
For more control, the `traversalSources` YAML section allows explicit `TraversalSource` creation with optional
502-
strategy configuration via a Gremlin query:
502+
strategy configuration via a Gremlin expression:
503503
504504
[source,yaml]
505505
----
506506
traversalSources: {
507507
g: {graph: graph},
508-
gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
508+
gReadOnly: {graph: graph, gremlinExpression: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
509509
----
510510
511511
Each entry supports:
512512
513513
* `graph` (required) — references a key in the `graphs` section
514-
* `query` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`; the result becomes
515-
the final `TraversalSource`
516-
* `language` (optional) — which script engine to use for query evaluation; defaults to `gremlin-lang`, or the sole
517-
configured engine if only one is present
514+
* `gremlinExpression` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`; the
515+
result becomes the final `TraversalSource`
516+
* `language` (optional) — which script engine to use for expression evaluation; defaults to `gremlin-lang`, or the
517+
sole configured engine if only one is present
518518
519519
Graphs with explicit `traversalSources` entries are excluded from auto-creation.
520520

docs/src/upgrade/release-4.x.x.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ A new `traversalSources` YAML section allows explicit `TraversalSource` creation
8080
----
8181
traversalSources: {
8282
g: {graph: graph},
83-
gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
83+
gReadOnly: {graph: graph, gremlinExpression: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
8484
----
8585
8686
Each entry specifies:
8787
8888
- `graph` (required) — references a key in the `graphs` section
89-
- `query` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`
90-
- `language` (optional) — which script engine to use for the query (defaults to `gremlin-lang`, or the sole
89+
- `gremlinExpression` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`
90+
- `language` (optional) — which script engine to use for the expression (defaults to `gremlin-lang`, or the sole
9191
configured engine if only one is present)
9292
9393
===== Java-Based `lifecycleHooks`

gremlin-server/conf/gremlin-server-modern-readonly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ evaluationTimeout: 30000
2121
graphs: {
2222
graph: conf/tinkergraph-empty.properties}
2323
traversalSources: {
24-
g: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)"}}
24+
g: {graph: graph, gremlinExpression: "g.withStrategies(ReadOnlyStrategy)"}}
2525
lifecycleHooks:
2626
- { className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader, config: {graph: graph, dataset: modern}}
2727
serializers:

gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,14 +424,14 @@ public static class TraversalSourceSettings {
424424
public String graph;
425425

426426
/**
427-
* An optional Gremlin query evaluated with a base traversal source bound as {@code g}.
428-
* The result of the query becomes the final {@link TraversalSource}.
427+
* An optional Gremlin expression evaluated with a base traversal source bound as {@code g}.
428+
* The result of the expression becomes the final {@link TraversalSource}.
429429
*/
430-
public String query = null;
430+
public String gremlinExpression = null;
431431

432432
/**
433-
* The script engine language to use for evaluating {@link #query}. If not specified, resolution
434-
* falls back to the single configured engine or {@code gremlin-lang}.
433+
* The script engine language to use for evaluating {@link #gremlinExpression}. If not specified,
434+
* resolution falls back to the single configured engine or {@code gremlin-lang}.
435435
*/
436436
public String language = null;
437437
}

gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,19 @@ public ServerGremlinExecutor(final Settings settings, final ExecutorService grem
228228

229229
graphsWithExplicitTraversalSources.add(tsSettings.graph);
230230

231-
if (tsSettings.query != null && !tsSettings.query.isEmpty()) {
232-
// resolve which script engine to use for the query
231+
if (tsSettings.gremlinExpression != null && !tsSettings.gremlinExpression.isEmpty()) {
232+
// resolve which script engine to use for the expression
233233
final String language = resolveLanguage(tsSettings.language);
234234
try {
235-
// bind a base traversal source as 'g' for the query to operate on
235+
// bind a base traversal source as 'g' for the expression to operate on
236236
final SimpleBindings bindings = new SimpleBindings();
237237
bindings.put("g", graph.traversal());
238238
final TraversalSource ts = (TraversalSource) gremlinExecutor.eval(
239-
tsSettings.query, language, bindings).join();
239+
tsSettings.gremlinExpression, language, bindings).join();
240240
this.graphManager.putTraversalSource(tsName, ts);
241-
logger.info("A {} is now bound to [{}] via query", ts.getClass().getSimpleName(), tsName);
241+
logger.info("A {} is now bound to [{}] via gremlinExpression", ts.getClass().getSimpleName(), tsName);
242242
} catch (Exception ex) {
243-
logger.warn(String.format("Could not create TraversalSource [%s] from query - %s",
243+
logger.warn(String.format("Could not create TraversalSource [%s] from gremlinExpression - %s",
244244
tsName, ex.getMessage()), ex);
245245
}
246246
} else {
@@ -306,7 +306,7 @@ private void registerMetrics(final String engineName) {
306306
}
307307

308308
/**
309-
* Resolves the script engine language to use for evaluating a traversal source query. If an explicit language
309+
* Resolves the script engine language to use for evaluating a traversal source gremlinExpression. If an explicit language
310310
* is provided, it is used directly. Otherwise, if exactly one script engine is configured, that engine is used.
311311
* Falls back to {@code gremlin-lang}.
312312
*/

gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public Settings overrideSettings(final Settings settings) {
121121
case "shouldAliasTraversalSourceVariables":
122122
final Settings.TraversalSourceSettings readOnlyG = new Settings.TraversalSourceSettings();
123123
readOnlyG.graph = "graph";
124-
readOnlyG.query = "g.withStrategies(ReadOnlyStrategy)";
124+
readOnlyG.gremlinExpression = "g.withStrategies(ReadOnlyStrategy)";
125125
settings.traversalSources.put("g", readOnlyG);
126126
final Settings.TraversalSourceSettings writableG1 = new Settings.TraversalSourceSettings();
127127
writableG1.graph = "graph";

gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/SettingsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ public void traversalSourcesParsedFromYaml() throws Exception {
9292

9393
final Settings.TraversalSourceSettings gSettings = settings.traversalSources.get("g");
9494
assertThat(gSettings.graph, is("graph"));
95-
assertThat(gSettings.query, is(nullValue()));
95+
assertThat(gSettings.gremlinExpression, is(nullValue()));
9696
assertThat(gSettings.language, is(nullValue()));
9797

9898
final Settings.TraversalSourceSettings roSettings = settings.traversalSources.get("gReadOnly");
9999
assertThat(roSettings.graph, is("graph"));
100-
assertThat(roSettings.query, is("g.withStrategies(ReadOnlyStrategy)"));
100+
assertThat(roSettings.gremlinExpression, is("g.withStrategies(ReadOnlyStrategy)"));
101101
assertThat(roSettings.language, is("gremlin-groovy"));
102102
}
103103

gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-with-traversal-sources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ graphs: {
2121
graph: conf/tinkergraph-empty.properties}
2222
traversalSources: {
2323
g: {graph: graph},
24-
gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", language: gremlin-groovy}}
24+
gReadOnly: {graph: graph, gremlinExpression: "g.withStrategies(ReadOnlyStrategy)", language: gremlin-groovy}}
2525
lifecycleHooks:
2626
- { className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader, config: {graph: graph, dataset: modern}}
2727
- { className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader, config: {graph: graph, dataset: classic}}

0 commit comments

Comments
 (0)