thevalzo commented on a change in pull request #1237: TINKERPOP-2325 - 
Modifications for use of indexes in FILTER
URL: https://github.com/apache/tinkerpop/pull/1237#discussion_r371278669
 
 

 ##########
 File path: 
sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
 ##########
 @@ -47,79 +49,248 @@
     /**
      * Converts a general {@code Expr} to an anonymous {@link GraphTraversal}.
      */
-    static GraphTraversal<?, ?> transform(final Expr expression) {
-        if (expression instanceof E_Equals) return transform((E_Equals) 
expression);
-        if (expression instanceof E_NotEquals) return transform((E_NotEquals) 
expression);
-        if (expression instanceof E_LessThan) return transform((E_LessThan) 
expression);
-        if (expression instanceof E_LessThanOrEqual) return 
transform((E_LessThanOrEqual) expression);
-        if (expression instanceof E_GreaterThan) return 
transform((E_GreaterThan) expression);
-        if (expression instanceof E_GreaterThanOrEqual) return 
transform((E_GreaterThanOrEqual) expression);
-        if (expression instanceof E_LogicalAnd) return 
transform((E_LogicalAnd) expression);
-        if (expression instanceof E_LogicalOr) return transform((E_LogicalOr) 
expression);
-        if (expression instanceof E_Exists) return transform((E_Exists) 
expression);
-        if (expression instanceof E_NotExists) return transform((E_NotExists) 
expression);
+    public static GraphTraversal<?, ?> transform(final Expr expression, 
List<Triple> triples) {
+        if (expression instanceof E_Equals) return transform((E_Equals) 
expression, triples);
+        if (expression instanceof E_NotEquals) return transform((E_NotEquals) 
expression, triples);
+        if (expression instanceof E_LessThan) return transform((E_LessThan) 
expression, triples);
+        if (expression instanceof E_LessThanOrEqual) return 
transform((E_LessThanOrEqual) expression, triples);
+        if (expression instanceof E_GreaterThan) return 
transform((E_GreaterThan) expression, triples);
+        if (expression instanceof E_GreaterThanOrEqual) return 
transform((E_GreaterThanOrEqual) expression, triples);
+        if (expression instanceof E_LogicalAnd) return 
transform((E_LogicalAnd) expression, triples);
+        if (expression instanceof E_LogicalOr) return transform((E_LogicalOr) 
expression, triples);
+        if (expression instanceof E_Exists) return transform((E_Exists) 
expression, triples);
+        if (expression instanceof E_NotExists) return transform((E_NotExists) 
expression, triples);
         throw new IllegalStateException(String.format("Unhandled expression: 
%s", expression));
     }
 
-    private static GraphTraversal<?, ?> transform(final E_Equals expression) {
-        final Object value = 
expression.getArg2().getConstant().getNode().getLiteralValue();
-        return __.as(expression.getArg1().getVarName()).is(P.eq(value));
+   public static GraphTraversal<?, ?> transform(final E_Equals e, List<Triple> 
triples) {
+        GraphTraversal traversal = null;
+         for(final Triple triple : triples){
 
 Review comment:
   In this function I iterate over "triples" to search for the variable used in 
FILTER condition, ( ?b in my example) so I can replace it with the label 
(name). Once i found it, i can discard the others triples. Maybe  I could add a 
breack instruction in the last IF for clarity.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to