feat(api-core): support label & property filtering for both edge and vertex & support kout dfs mode#2295
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2295 +/- ##
============================================
+ Coverage 65.09% 68.36% +3.27%
- Complexity 981 987 +6
============================================
Files 498 500 +2
Lines 41241 41516 +275
Branches 5738 5786 +48
============================================
+ Hits 26844 28384 +1540
+ Misses 11737 10375 -1362
- Partials 2660 2757 +97
... and 70 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java
Outdated
Show resolved
Hide resolved
Add Steps parser to parse VESteps
…nfo) in Kneighbor
… info) in Kout * add Kout dfs algorithm
Main Changes: 1. move class NestedIterator from HugeTraverser.java to separate file 2. rollback to origin code
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java
Show resolved
Hide resolved
| HugeGraph graph) { | ||
| ConditionQuery query, | ||
| List<HasContainer> hasContainers, | ||
| HugeGraph graph) { |
There was a problem hiding this comment.
can we revert the style changes in all files.
There was a problem hiding this comment.
ok, I reverted the style changes in all files
There was a problem hiding this comment.
ok, I reverted the style changes in all files
after applying the hugegraph-style.xml we still get a string of differ format?
There was a problem hiding this comment.
ok, I reverted the style changes in all files
after apply the
hugegraph-style.xmlwe still get a string of differ format?
The code after applying the hugegraph-style.xml is different from the origin format and these updates are automatically made by IDEA save on action.
There was a problem hiding this comment.
ok, I reverted the style changes in all files
after apply the
hugegraph-style.xmlwe still get a string of differ format?The code after applying the
hugegraph-style.xmlis different from the origin format and these updates are automatically made by IDEAsave on action.
get it,“save on action” need pay more attention,and I'll check it soon
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java
Outdated
Show resolved
Hide resolved
imbajin
left a comment
There was a problem hiding this comment.
The filtering is supported in Kout Post and Kneighbor Post Apis, and is there a need for other apis?
yep if we already supported them & we need update the doc for the changes
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
...aph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java
Outdated
Show resolved
Hide resolved
| public static final String TRAVERSE_MODE_BFS = "breadth_first_search"; | ||
| public static final String TRAVERSE_MODE_DFS = "depth_first_search"; |
There was a problem hiding this comment.
shall we use bfs & dfs for users to input? (just desc the full name in doc)
Co-authored-by: imbajin <[email protected]>
Can I supported this feature of the rest apis in the next PR? As the code submitted this time has already been reviewed. And I will update the doc for all the changes in hugegraph-doc. |
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
imbajin
left a comment
There was a problem hiding this comment.
Can I supported this feature of the rest apis in the next PR? As the code submitted this time has already been reviewed. And I will update the doc for all the changes in hugegraph-doc.
Fine & LGTM
…vertex & support kout dfs mode (apache#2295) - Support label & property filtering for both edge and vertex and the filtering is implemented in Kout Post and Kneighbor - Post Apis, reducing unnecessary graph searches through pruning - Support Kout dfs mode in Kout Post Api Originally only edge label filtering was supported, now label and property filtering for edge and vertex is supported. - add classes VEStepEntity and VEStep to support serialization in request - add class Steps to support filtering of edge and vertex in runtime(core) - add new method edgesOfVertex(Id source, Steps steps) to support label and property filtering for both edge and vertex in HugeTraverser.java --------- Co-authored-by: imbajin <[email protected]>
…vertex & support kout dfs mode (apache#2295) - Support label & property filtering for both edge and vertex and the filtering is implemented in Kout Post and Kneighbor - Post Apis, reducing unnecessary graph searches through pruning - Support Kout dfs mode in Kout Post Api Originally only edge label filtering was supported, now label and property filtering for edge and vertex is supported. - add classes VEStepEntity and VEStep to support serialization in request - add class Steps to support filtering of edge and vertex in runtime(core) - add new method edgesOfVertex(Id source, Steps steps) to support label and property filtering for both edge and vertex in HugeTraverser.java --------- Co-authored-by: imbajin <[email protected]>
…vertex & support kout dfs mode (#2295) - Support label & property filtering for both edge and vertex and the filtering is implemented in Kout Post and Kneighbor - Post Apis, reducing unnecessary graph searches through pruning - Support Kout dfs mode in Kout Post Api Originally only edge label filtering was supported, now label and property filtering for edge and vertex is supported. - add classes VEStepEntity and VEStep to support serialization in request - add class Steps to support filtering of edge and vertex in runtime(core) - add new method edgesOfVertex(Id source, Steps steps) to support label and property filtering for both edge and vertex in HugeTraverser.java --------- Co-authored-by: imbajin <[email protected]>
Purpose of the PR
Main Changes
Label & property filtering for edge and vertex
Originally only edge label filtering was supported, now label and property filtering for edge and vertex is supported.
Kout dfs mode
Add DFS-based Kout mode in Kout Post Api and users can select the algorithm throught request parameters.
Verifying these changes
Kout Postare shown belowInitialize the Graph
Label & property filtering for edge and vertex in Kout Post
{ "source": "1:marko", "steps": { "direction": "BOTH", "edge_steps": [ { "label": "knows", "properties": { "weight": "P.gt(1.2)" } }, { "label": "created", "properties": { "weight": "P.gt(0.39)" } } ], "vertex_steps": [ { "label": "person", "properties": { "age": "P.lt(33)" } }, { "label": "software", "properties": {} } ], "max_degree": 10000, "skip_degree": 100000 }, "max_depth": 3, "nearest": false, "limit": 10000, "with_vertex": false, "with_path": true, "with_edge": false }{ "kout": [ "2:ripple", "2:lop" ], "size": 2, "paths": [ { "objects": [ "1:marko", "2:lop", "1:josh", "2:lop" ] }, { "objects": [ "1:marko", "2:lop", "1:josh", "2:ripple" ] } ], "vertices": [ "2:ripple", "1:marko", "1:josh", "2:lop" ], "edges": [ "S1:josh>2>>S2:ripple", "S1:josh>2>>S2:lop", "S1:marko>2>>S2:lop" ], "measure": { "edge_iterations": 5, "vertice_iterations": 3, "cost(ns)": 175009500 } }Kout Post dfs mode
{ "source": "1:marko", "steps": { "direction": "BOTH", "edge_steps": [ { "label": "knows", "properties": { "weight": "P.gt(1.2)" } }, { "label": "created", "properties": { "weight": "P.gt(0.39)" } } ], "vertex_steps": [ { "label": "person", "properties": { "age": "P.lt(33)" } }, { "label": "software", "properties": {} } ], "max_degree": 10000, "skip_degree": 100000 }, "max_depth": 3, "nearest": false, "limit": 10000, "with_vertex": false, "with_path": true, "with_edge": false, "algorithm": "depth_first_search" }{ "kout": [ "2:ripple", "2:lop" ], "size": 2, "paths": [ { "objects": [ "1:marko", "2:lop", "1:josh", "2:lop" ] }, { "objects": [ "1:marko", "2:lop", "1:josh", "2:ripple" ] } ], "vertices": [ "2:ripple", "1:marko", "1:josh", "2:lop" ], "edges": [ "S1:josh>2>>S2:ripple", "S1:josh>2>>S2:lop", "S1:marko>2>>S2:lop" ], "measure": { "edge_iterations": 6, "vertice_iterations": 3, "cost(ns)": 60305791 } }Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need