You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2024/11/15 21:53:44 UTC
(tinkerpop) 08/20: wip - add values getter on inject
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch gvalue
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 96434deab73868bb4107251f12456885ae96b8d7
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Thu Aug 22 14:02:19 2024 -0400
wip - add values getter on inject
---
.../gremlin/process/traversal/step/sideEffect/InjectStep.java | 7 +++++++
.../gremlin/sparql/process/traversal/strategy/SparqlStrategy.java | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStep.java
index cc3a970f93..4102cfdd57 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStep.java
@@ -55,4 +55,11 @@ public final class InjectStep<S> extends StartStep<S> {
public GValue<S>[] getInjections() {
return this.injections;
}
+
+ /**
+ * Gets the injections of the step but unwraps the {@link GValue}.
+ */
+ public S[] getInjectionsAsValues() {
+ return (S[]) resolveToValues(this.injections);
+ }
}
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
index a4a95cc1c1..f4938fb219 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -71,7 +71,7 @@ public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.
// assumes that the traversal starts with the single inject step that holds the sparql query
if (traversal.getStartStep() instanceof InjectStep) {
final InjectStep stepWithSparql = (InjectStep) traversal.getStartStep();
- final Object[] injections = stepWithSparql.getInjections();
+ final Object[] injections = stepWithSparql.getInjectionsAsValues();
// further assumes that there is just one argument to that injection which is a string (i.e. sparql query)
if (injections.length == 1 && injections[0] instanceof String) {