msgui commented on code in PR #2242:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2242#discussion_r1261969141


##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java:
##########
@@ -0,0 +1,48 @@
+package org.apache.hugegraph.traversal.algorithm;
+
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.backend.query.ConditionQuery;
+import org.apache.hugegraph.type.HugeType;
+import org.apache.hugegraph.type.define.Directions;
+import org.apache.hugegraph.type.define.HugeKeys;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class EdgeExistenceTraverser extends HugeTraverser {
+    public EdgeExistenceTraverser(HugeGraph graph) {
+        super(graph);
+    }
+
+    public Iterator<Edge> queryEdgeExistence(
+        Id sourceId, Id targetId,
+        String label, long limit) {
+        if ("BOTH".equals(label)) {
+            return queryByNeighbor(sourceId, targetId, limit);
+        }
+        ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE);
+        conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId);
+        conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId);
+        conditionQuery.eq(HugeKeys.LABEL, getEdgeLabelId(label));
+        conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT);
+        conditionQuery.eq(HugeKeys.SORT_VALUES, "");

Review Comment:
   > please check if exists sortkey in the edge label, fallback if yes
   
   Hi @javeme , how exactly is the fallback implemented? I'm not quite sure 
which aspects of ConditionQuery can utilize EdgeLabel.sortkeys.



##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java:
##########
@@ -0,0 +1,48 @@
+package org.apache.hugegraph.traversal.algorithm;
+
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.backend.query.ConditionQuery;
+import org.apache.hugegraph.type.HugeType;
+import org.apache.hugegraph.type.define.Directions;
+import org.apache.hugegraph.type.define.HugeKeys;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class EdgeExistenceTraverser extends HugeTraverser {
+    public EdgeExistenceTraverser(HugeGraph graph) {
+        super(graph);
+    }
+
+    public Iterator<Edge> queryEdgeExistence(
+        Id sourceId, Id targetId,
+        String label, long limit) {
+        if ("BOTH".equals(label)) {
+            return queryByNeighbor(sourceId, targetId, limit);
+        }
+        ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE);
+        conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId);
+        conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId);
+        conditionQuery.eq(HugeKeys.LABEL, getEdgeLabelId(label));
+        conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT);
+        conditionQuery.eq(HugeKeys.SORT_VALUES, "");

Review Comment:
   > please check if exists sortkey in the edge label, fallback if yes
   
   Hi @javeme , how exactly is the fallback implemented? I'm not quite sure 
which aspects of ConditionQuery can utilize EdgeLabel.sortkeys.



##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java:
##########
@@ -0,0 +1,48 @@
+package org.apache.hugegraph.traversal.algorithm;
+
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.backend.query.ConditionQuery;
+import org.apache.hugegraph.type.HugeType;
+import org.apache.hugegraph.type.define.Directions;
+import org.apache.hugegraph.type.define.HugeKeys;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class EdgeExistenceTraverser extends HugeTraverser {
+    public EdgeExistenceTraverser(HugeGraph graph) {
+        super(graph);
+    }
+
+    public Iterator<Edge> queryEdgeExistence(
+        Id sourceId, Id targetId,
+        String label, long limit) {
+        if ("BOTH".equals(label)) {
+            return queryByNeighbor(sourceId, targetId, limit);
+        }
+        ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE);
+        conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId);
+        conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId);
+        conditionQuery.eq(HugeKeys.LABEL, getEdgeLabelId(label));
+        conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT);
+        conditionQuery.eq(HugeKeys.SORT_VALUES, "");

Review Comment:
   > please check if exists sortkey in the edge label, fallback if yes
   
   Hi @javeme , how exactly is the fallback implemented? I'm not quite sure 
which aspects of ConditionQuery can utilize EdgeLabel.sortkeys.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to