From 956cbd0e87d72823de428d4ffd06798fdf8840d3 Mon Sep 17 00:00:00 2001 From: "xiaolei.zl" Date: Tue, 26 Sep 2023 11:39:53 +0800 Subject: [PATCH] add movie sample queries --- flex/interactive/bin/gs_interactive | 4 ++-- flex/interactive/examples/movies/acted_in.cypher | 2 ++ flex/interactive/examples/movies/actor.cypher | 2 ++ flex/interactive/examples/movies/coactors.cypher | 3 +++ flex/interactive/examples/movies/colfilter.cypher | 5 +++++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 flex/interactive/examples/movies/acted_in.cypher create mode 100644 flex/interactive/examples/movies/actor.cypher create mode 100644 flex/interactive/examples/movies/coactors.cypher create mode 100644 flex/interactive/examples/movies/colfilter.cypher diff --git a/flex/interactive/bin/gs_interactive b/flex/interactive/bin/gs_interactive index 42012d403f18..b5a47944b460 100755 --- a/flex/interactive/bin/gs_interactive +++ b/flex/interactive/bin/gs_interactive @@ -1645,8 +1645,8 @@ function do_compile() { if [ ! -f "${HOST_DB_TMP_DIR}/.enable" ]; then touch "${HOST_DB_TMP_DIR}/.enable" fi - # check if the stored_procedure_name is already in .enable - if grep -q "${stored_procedure_name}" "${HOST_DB_TMP_DIR}/.enable"; then + # check if the stored_procedure_name is already in .enable, exact match + if grep -q "^${stored_procedure_name}$" "${HOST_DB_TMP_DIR}/.enable"; then err "stored_procedure_name [${stored_procedure_name}] already exists, please use another name" exit 1 fi diff --git a/flex/interactive/examples/movies/acted_in.cypher b/flex/interactive/examples/movies/acted_in.cypher new file mode 100644 index 000000000000..3ca6e4046b1e --- /dev/null +++ b/flex/interactive/examples/movies/acted_in.cypher @@ -0,0 +1,2 @@ +MATCH (actor:Person {name: $actorName})-[:ACTED_IN]->(movie:Movie) +RETURN actor.name, movie.title, movie.tagline, movie.release; \ No newline at end of file diff --git a/flex/interactive/examples/movies/actor.cypher b/flex/interactive/examples/movies/actor.cypher new file mode 100644 index 000000000000..4673b06b82b4 --- /dev/null +++ b/flex/interactive/examples/movies/actor.cypher @@ -0,0 +1,2 @@ +MATCH (actor:Person {name: $actorName}) +RETURN actor.id, actor.born, actor.name; \ No newline at end of file diff --git a/flex/interactive/examples/movies/coactors.cypher b/flex/interactive/examples/movies/coactors.cypher new file mode 100644 index 000000000000..f923406ca02b --- /dev/null +++ b/flex/interactive/examples/movies/coactors.cypher @@ -0,0 +1,3 @@ +MATCH (tom:Person {name:$actorName})-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(coActors) +RETURN m.title AS movieTitle, m.release AS releasedYear, coActors.name AS coActorName +ORDER BY releasedYear DESC, movieTitle ASC LIMIT 10; \ No newline at end of file diff --git a/flex/interactive/examples/movies/colfilter.cypher b/flex/interactive/examples/movies/colfilter.cypher new file mode 100644 index 000000000000..289cb62284e1 --- /dev/null +++ b/flex/interactive/examples/movies/colfilter.cypher @@ -0,0 +1,5 @@ +MATCH (actor:Person {name: $actorName})-[:ACTED_IN]->(movie1:Movie)<-[:ACTED_IN]- + (coActor:Person)-[:ACTED_IN]->(movie2:Movie)<-[:ACTED_IN]-(coCoActor:Person) +WHERE actor <> coCoActor +AND NOT (actor)-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(coCoActor) +RETURN DISTINCT coCoActor.name LIMIT 10; \ No newline at end of file