From 13c88976deea044455a203ae191632aadbb98adb Mon Sep 17 00:00:00 2001 From: jimingquan Date: Tue, 28 Sep 2021 11:58:37 +0800 Subject: [PATCH] add test case --- .../tck/features/path/AllPath.IntVid.feature | 100 ++++++++++++++++- tests/tck/features/path/AllPath.feature | 104 ++++++++++++++++-- tests/tck/features/path/NoLoop.IntVid.feature | 58 ++++++++-- tests/tck/features/path/NoLoop.feature | 58 ++++++++-- .../features/path/ShortestPath.IntVid.feature | 75 ++++++++++--- tests/tck/features/path/ShortestPath.feature | 75 ++++++++++--- 6 files changed, 412 insertions(+), 58 deletions(-) diff --git a/tests/tck/features/path/AllPath.IntVid.feature b/tests/tck/features/path/AllPath.IntVid.feature index f4599d5897c..c8c7f0b3656 100644 --- a/tests/tck/features/path/AllPath.IntVid.feature +++ b/tests/tck/features/path/AllPath.IntVid.feature @@ -113,11 +113,11 @@ Feature: Integer Vid All Path Scenario: Integer Vid [1] ALL Path With Limit When executing query: """ - FIND ALL PATH FROM hash("Tim Duncan") TO hash("Tony Parker"), hash("Spurs") OVER like,serve UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 3 + FIND ALL PATH FROM hash("Tim Duncan") TO hash("Tony Parker"), hash("Spurs") OVER like,serve UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tim Duncan")-[:like]->("Tony Parker")> | | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:serve]->("Spurs")> | @@ -126,11 +126,11 @@ Feature: Integer Vid All Path When executing query: """ $a = GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst; - FIND ALL PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND ALL PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tony Parker")-[:like@0]->("LaMarcus Aldridge")-[:like@0]->("Tim Duncan")> | | <("Tony Parker")-[:like@0]->("LaMarcus Aldridge")-[:like@0]->("Tony Parker")-[:like@0]->("Tim Duncan")> | | <("Tony Parker")-[:like@0]->("Manu Ginobili")-[:like@0]->("Tim Duncan")> | @@ -253,3 +253,91 @@ Feature: Integer Vid All Path | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Shaquile O'Neal" :player{age: 47, name: "Shaquile O'Neal"})-[:like@0 {likeness: 80}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:teammate@0 {end_year: 2016, start_year: 2010}]->("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2000, start_year: 1997}]->("Raptors" :team{name: "Raptors"})<-[:serve@0 {end_year: 2019, start_year: 2018}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2013, start_year: 2013}]->("Spurs" :team{name: "Spurs"})<-[:serve@0 {end_year: 2018, start_year: 2010}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | + + Scenario: Integer Vid ALL PATH YIELD PATH + When executing query: + """ + FIND ALL PATH FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like BIDIRECT UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Boris Diaw")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")<-[:like]-("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")-[:like]->("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Marco Belinelli")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tony Parker")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tiago Splitter")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + When executing query: + """ + FIND ALL PATH WITH PROP FROM hash("Yao Ming") TO hash("Danny Green") OVER * BIDIRECT + WHERE like.likeness is EMPTY OR like.likeness >= 80 UPTO 3 STEPS YIELD path as p | + YIELD startnode($-.p) as startnode + """ + Then the result should be, in any order, with relax comparison: + | startnode | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + When executing query: + """ + FIND ALL PATH WITH PROP FROM hash("Yao Ming") TO hash("Danny Green") OVER * BIDIRECT + WHERE like.likeness is EMPTY OR like.likeness >= 80 UPTO 3 STEPS YIELD path as p | + YIELD endnode($-.p) as endnode + """ + Then the result should be, in any order, with relax comparison: + | endnode | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + When executing query: + """ + FIND ALL PATH WITH PROP FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like UPTO 3 STEPS YIELD path as p | + YIELD length($-.p) as length + """ + Then the result should be, in any order, with relax comparison: + | length | + | 1 | + | 3 | + | 3 | + When executing query: + """ + FIND ALL PATH WITH PROP FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like UPTO 3 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}], [:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | + When executing query: + """ + FIND ALL PATH WITH PROP FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}), ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | diff --git a/tests/tck/features/path/AllPath.feature b/tests/tck/features/path/AllPath.feature index 99cb1e697dd..dcca1801935 100644 --- a/tests/tck/features/path/AllPath.feature +++ b/tests/tck/features/path/AllPath.feature @@ -81,8 +81,8 @@ Feature: All Path Scenario: [1] ALL Path Run Time Input When executing query: """ - GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst - | FIND ALL PATH FROM $-.src TO $-.dst OVER like UPTO 3 STEPS + GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst | + FIND ALL PATH FROM $-.src TO $-.dst OVER like UPTO 3 STEPS """ Then the result should be, in any order, with relax comparison: | path | @@ -113,11 +113,11 @@ Feature: All Path Scenario: [1] ALL Path With Limit When executing query: """ - FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 3 + FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")-[:like]->("Tony Parker")> | @@ -126,11 +126,11 @@ Feature: All Path When executing query: """ $a = GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst; - FIND ALL PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND ALL PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | | <("Manu Ginobili")-[:like]->("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tim Duncan")> | @@ -253,3 +253,91 @@ Feature: All Path | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Shaquile O'Neal" :player{age: 47, name: "Shaquile O'Neal"})-[:like@0 {likeness: 80}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:teammate@0 {end_year: 2016, start_year: 2010}]->("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2000, start_year: 1997}]->("Raptors" :team{name: "Raptors"})<-[:serve@0 {end_year: 2019, start_year: 2018}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2013, start_year: 2013}]->("Spurs" :team{name: "Spurs"})<-[:serve@0 {end_year: 2018, start_year: 2010}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | + + Scenario: ALL PATH YIELD PATH + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker" OVER like BIDIRECT UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Boris Diaw")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")<-[:like]-("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")-[:like]->("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Marco Belinelli")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Danny Green")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Marco Belinelli")<-[:like]-("Dejounte Murray")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tony Parker")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Manu Ginobili")<-[:like]-("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")-[:like]->("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Dejounte Murray")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + | <("Tim Duncan")<-[:like]-("Tiago Splitter")-[:like]->("Manu Ginobili")<-[:like]-("Tony Parker")> | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Yao Ming" TO "Danny Green" OVER * BIDIRECT + WHERE like.likeness is EMPTY OR like.likeness >= 80 UPTO 3 STEPS YIELD path as p | + YIELD startnode($-.p) as startnode + """ + Then the result should be, in any order, with relax comparison: + | startnode | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Yao Ming" TO "Danny Green" OVER * BIDIRECT + WHERE like.likeness is EMPTY OR like.likeness >= 80 UPTO 3 STEPS YIELD path as p | + YIELD endnode($-.p) as endnode + """ + Then the result should be, in any order, with relax comparison: + | endnode | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + | ("Danny Green" :player{age: 31, name: "Danny Green"}) | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Tony Parker" OVER like UPTO 3 STEPS YIELD path as p | + YIELD length($-.p) as length + """ + Then the result should be, in any order, with relax comparison: + | length | + | 1 | + | 3 | + | 3 | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Tony Parker" OVER like UPTO 3 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}], [:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Tony Parker" OVER like UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}), ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | + | [("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}), ("Tony Parker" :player{age: 36, name: "Tony Parker"})] | diff --git a/tests/tck/features/path/NoLoop.IntVid.feature b/tests/tck/features/path/NoLoop.IntVid.feature index d42ecba0625..04c560ff3bc 100644 --- a/tests/tck/features/path/NoLoop.IntVid.feature +++ b/tests/tck/features/path/NoLoop.IntVid.feature @@ -80,11 +80,11 @@ Feature: Integer Vid NoLoop Path Scenario: Integer Vid [1] NOLOOP Path With Limit When executing query: """ - FIND NOLOOP PATH FROM hash("Tim Duncan") TO hash("Tony Parker"), hash("Spurs") OVER like,serve UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 3 + FIND NOLOOP PATH FROM hash("Tim Duncan") TO hash("Tony Parker"), hash("Spurs") OVER like,serve UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tim Duncan")-[:like]->("Tony Parker")> | | < ("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("Manu Ginobili")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:serve]->("Spurs")> | @@ -93,11 +93,11 @@ Feature: Integer Vid NoLoop Path When executing query: """ $a = GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst; - FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")> | @@ -197,9 +197,49 @@ Feature: Integer Vid NoLoop Path When executing query: """ $a = GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst; - FIND NOLOOP PATH WITH PROP FROM $a.src TO $a.dst OVER like WHERE like.likeness > 90 UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND NOLOOP PATH WITH PROP FROM $a.src TO $a.dst OVER like WHERE like.likeness > 90 UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:like@0 {likeness: 95}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})> | + + Scenario: Integer Vid NOLOOP Path YIELD PATH + When executing query: + """ + FIND NOLOOP PATH WITH PROP FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:like@0 {likeness: 95}]->("Tony Parker" :player{age: 36, name: "Tony Parker"})> | + When executing query: + """ + FIND NOLOOP PATH WITH PROP FROM hash("Tim Duncan") TO hash("Tony Parker"), hash("LaMarcus Aldridge") OVER like UPTO 3 STEPS YIELD path as p | + YIELD startnode($-.p) as startnode + """ + Then the result should be, in any order, with relax comparison: + | startnode | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + When executing query: + """ + $a = GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst; + FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Manu Ginobili"), ("Tim Duncan")] | + | [("Tony Parker"), ("Tim Duncan")] | + | [("Tony Parker"), ("Manu Ginobili"), ("Tim Duncan")] | + | [("Tony Parker"), ("LaMarcus Aldridge"), ("Tim Duncan")] | + When executing query: + """ + FIND NOLOOP PATH FROM hash("Tim Duncan") TO hash("Tony Parker") OVER like REVERSELY UPTO 3 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tony Parker"->"Tim Duncan" @0 {}]] | + | [[:like "LaMarcus Aldridge"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {}]] | + | [[:like "Manu Ginobili"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"Manu Ginobili" @0 {}]] | diff --git a/tests/tck/features/path/NoLoop.feature b/tests/tck/features/path/NoLoop.feature index 472e48dbac8..fbdce3db5c7 100644 --- a/tests/tck/features/path/NoLoop.feature +++ b/tests/tck/features/path/NoLoop.feature @@ -80,11 +80,11 @@ Feature: NoLoop Path Scenario: [1] NOLOOP Path With Limit When executing query: """ - FIND NOLOOP PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 3 + FIND NOLOOP PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:like]->("Tony Parker")> | @@ -93,11 +93,11 @@ Feature: NoLoop Path When executing query: """ $a = GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst; - FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")> | @@ -197,9 +197,49 @@ Feature: NoLoop Path When executing query: """ $a = GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst; - FIND NOLOOP PATH WITH PROP FROM $a.src TO $a.dst OVER like WHERE like.likeness > 90 UPTO 3 STEPS - | ORDER BY $-.path | LIMIT 5 + FIND NOLOOP PATH WITH PROP FROM $a.src TO $a.dst OVER like WHERE like.likeness > 90 UPTO 3 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 5 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:like@0 {likeness: 95}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})> | + + Scenario: NOLOOP Path YIELD PATH + When executing query: + """ + FIND NOLOOP PATH WITH PROP FROM "Tim Duncan" TO "Tony Parker" OVER like UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:like@0 {likeness: 95}]->("Tony Parker" :player{age: 36, name: "Tony Parker"})> | + When executing query: + """ + FIND NOLOOP PATH WITH PROP FROM "Tim Duncan" TO "Tony Parker","LaMarcus Aldridge" OVER like UPTO 3 STEPS YIELD path as p | + YIELD startnode($-.p) as startnode + """ + Then the result should be, in any order, with relax comparison: + | startnode | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + When executing query: + """ + $a = GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst; + FIND NOLOOP PATH FROM $a.src TO $a.dst OVER like UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Manu Ginobili"), ("Tim Duncan")] | + | [("Tony Parker"), ("Tim Duncan")] | + | [("Tony Parker"), ("Manu Ginobili"), ("Tim Duncan")] | + | [("Tony Parker"), ("LaMarcus Aldridge"), ("Tim Duncan")] | + When executing query: + """ + FIND NOLOOP PATH FROM "Tim Duncan" TO "Tony Parker" OVER like REVERSELY UPTO 3 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tony Parker"->"Tim Duncan" @0 {}]] | + | [[:like "LaMarcus Aldridge"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {}]] | + | [[:like "Manu Ginobili"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"Manu Ginobili" @0 {}]] | diff --git a/tests/tck/features/path/ShortestPath.IntVid.feature b/tests/tck/features/path/ShortestPath.IntVid.feature index 6fe16052f59..1ff4e35cb24 100644 --- a/tests/tck/features/path/ShortestPath.IntVid.feature +++ b/tests/tck/features/path/ShortestPath.IntVid.feature @@ -317,42 +317,42 @@ Feature: Integer Vid Shortest Path Scenario: Integer Vid [1] Shortest Path With Limit When executing query: """ - FIND SHORTEST PATH FROM hash("Tim Duncan") TO hash("Nobody"), hash("Spur") OVER like,serve UPTO 3 STEPS | ORDER BY $-.path | LIMIT 3 + FIND SHORTEST PATH FROM hash("Tim Duncan") TO hash("Nobody"), hash("Spur") OVER like,serve UPTO 3 STEPS YIELD path as p | ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | Scenario: Integer Vid [2] Shortest Path With Limit When executing query: """ - FIND SHORTEST PATH FROM hash("Shaquile O\'Neal"), hash("Nobody") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 2 + FIND SHORTEST PATH FROM hash("Shaquile O\'Neal"), hash("Nobody") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 2 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Shaquile O'Neal")-[:serve]->("Lakers")> | | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:like]->("Manu Ginobili")> | Scenario: Integer Vid [3] Shortest Path With Limit When executing query: """ - GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst - | FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 1 + GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst | + FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 1 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Tony Parker")-[:like@0]->("Tim Duncan")> | Scenario: Integer Vid [4] Shortest Path With Limit When executing query: """ - GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst - | FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 10 + GO FROM hash("Tim Duncan") over * YIELD like._dst AS src, serve._src AS dst | + FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 10 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("Tim Duncan")> | @@ -513,3 +513,52 @@ Feature: Integer Vid Shortest Path | <("Tony Parker" :player{age: 36, name: "Tony Parker"})<-[:teammate@0 {end_year: 2016, start_year: 2002}]-("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:like@0 {likeness: 95}]->("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:teammate@0 {end_year: 2018, start_year: 2002}]->("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | + + Scenario: Integer Vid Shortest Path YIELD path + When executing query: + """ + FIND SHORTEST PATH FROM hash("Shaquile O\'Neal"), hash("Nobody") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * UPTO 5 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:serve]->("Spurs")> | + | <("Shaquile O'Neal")-[:serve]->("Lakers")> | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:like]->("Manu Ginobili")> | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:teammate]->("Manu Ginobili")> | + When executing query: + """ + FIND SHORTEST PATH FROM hash("Shaquile O\'Neal"), hash("Nobody") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * UPTO 5 STEPS YIELD path as p | + YIELD length($-.p) as length + """ + Then the result should be, in any order, with relax comparison: + | length | + | 2 | + | 1 | + | 2 | + | 2 | + When executing query: + """ + FIND SHORTEST PATH WITH PROP FROM hash("Tony Parker"), hash("Yao Ming") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * BIDIRECT WHERE teammate.start_year is not EMPTY OR like.likeness > 90 UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + When executing query: + """ + FIND SHORTEST PATH WITH PROP FROM hash("Tony Parker"), hash("Yao Ming") TO hash("Manu Ginobili"), hash("Spurs"), hash("Lakers") OVER * BIDIRECT WHERE teammate.start_year is not EMPTY OR like.likeness > 90 UPTO 3 STEPS YIELD path as p | + YIELD distinct nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + When executing query: + """ + FIND SHORTEST PATH FROM hash("Tiago Splitter") TO hash("Tim Duncan") OVER * UPTO 1 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tiago Splitter"->"Tim Duncan" @0 {}]] | diff --git a/tests/tck/features/path/ShortestPath.feature b/tests/tck/features/path/ShortestPath.feature index 1a534f64b8d..01373bc80ad 100644 --- a/tests/tck/features/path/ShortestPath.feature +++ b/tests/tck/features/path/ShortestPath.feature @@ -317,42 +317,42 @@ Feature: Shortest Path Scenario: [1] Shortest Path With Limit When executing query: """ - FIND SHORTEST PATH FROM "Tim Duncan" TO "Nobody","Spur" OVER like,serve UPTO 3 STEPS | ORDER BY $-.path | LIMIT 3 + FIND SHORTEST PATH FROM "Tim Duncan" TO "Nobody","Spur" OVER like,serve UPTO 3 STEPS YIELD path as p | ORDER BY $-.p | LIMIT 3 """ Then the result should be, in any order, with relax comparison: - | path | + | p | Scenario: [2] Shortest Path With Limit When executing query: """ - FIND SHORTEST PATH FROM "Shaquile O\'Neal", "Nobody" TO "Manu Ginobili", "Spurs", "Lakers" OVER * UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 2 + FIND SHORTEST PATH FROM "Shaquile O\'Neal", "Nobody" TO "Manu Ginobili", "Spurs", "Lakers" OVER * UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 2 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Shaquile O'Neal")-[:serve]->("Lakers")> | | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:like]->("Manu Ginobili")> | Scenario: [3] Shortest Path With Limit When executing query: """ - GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst - | FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 1 + GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst | + FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 1 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | Scenario: [4] Shortest Path With Limit When executing query: """ - GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst - | FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS - | ORDER BY $-.path | LIMIT 10 + GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst | + FIND SHORTEST PATH FROM $-.src TO $-.dst OVER like UPTO 5 STEPS YIELD path as p | + ORDER BY $-.p | LIMIT 10 """ Then the result should be, in any order, with relax comparison: - | path | + | p | | <("Manu Ginobili")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("Tim Duncan")> | @@ -513,3 +513,52 @@ Feature: Shortest Path | <("Tony Parker" :player{age: 36, name: "Tony Parker"})<-[:teammate@0 {end_year: 2016, start_year: 2002}]-("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:like@0 {likeness: 95}]->("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | | <("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:teammate@0 {end_year: 2018, start_year: 2002}]->("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})> | + + Scenario: Shortest Path YIELD path + When executing query: + """ + FIND SHORTEST PATH FROM "Shaquile O\'Neal", "Nobody" TO "Manu Ginobili", "Spurs", "Lakers" OVER * UPTO 5 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:serve]->("Spurs")> | + | <("Shaquile O'Neal")-[:serve]->("Lakers")> | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:like]->("Manu Ginobili")> | + | <("Shaquile O'Neal")-[:like]->("Tim Duncan")-[:teammate]->("Manu Ginobili")> | + When executing query: + """ + FIND SHORTEST PATH FROM "Shaquile O\'Neal", "Nobody" TO "Manu Ginobili", "Spurs", "Lakers" OVER * UPTO 5 STEPS YIELD path as p | + YIELD length($-.p) as length + """ + Then the result should be, in any order, with relax comparison: + | length | + | 2 | + | 1 | + | 2 | + | 2 | + When executing query: + """ + FIND SHORTEST PATH WITH PROP FROM "Tony Parker", "Yao Ming" TO "Manu Ginobili", "Spurs", "Lakers" OVER * BIDIRECT WHERE teammate.start_year is not EMPTY OR like.likeness > 90 UPTO 3 STEPS YIELD path as p | + YIELD nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + When executing query: + """ + FIND SHORTEST PATH WITH PROP FROM "Tony Parker", "Yao Ming" TO "Manu Ginobili", "Spurs", "Lakers" OVER * BIDIRECT WHERE teammate.start_year is not EMPTY OR like.likeness > 90 UPTO 3 STEPS YIELD path as p | + YIELD distinct nodes($-.p) as nodes + """ + Then the result should be, in any order, with relax comparison: + | nodes | + | [("Tony Parker" :player{age: 36, name: "Tony Parker"}), ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})] | + When executing query: + """ + FIND SHORTEST PATH FROM "Tiago Splitter" TO "Tim Duncan" OVER * UPTO 1 STEPS YIELD path as p | + YIELD relationships($-.p) as relationships + """ + Then the result should be, in any order, with relax comparison: + | relationships | + | [[:like "Tiago Splitter"->"Tim Duncan" @0 {}]] |