diff --git a/release/examples/build_examples b/release/examples/build_examples index 1daaae143..81c774faf 100755 --- a/release/examples/build_examples +++ b/release/examples/build_examples @@ -1,7 +1,7 @@ #!/bin/bash -e function print_help () { - echo "Usage: $0 MEMGRAPH_EXE BOLT_CLIENT_EXE" + echo "Usage: $0 MEMGRAPH_EXE MG_CLIENT_EXE" echo "Build example snapshots using the compiled memgraph." } @@ -15,9 +15,9 @@ if [[ ! -x ${memgraph_exe} ]]; then echo "Expected memgraph executable at '${memgraph_exe}'" exit 1 fi -bolt_client_exe="$2" -if [[ ! -x ${bolt_client_exe} ]]; then - echo "Expected bolt_client executable at '${bolt_client_exe}'" +mg_client_exe="$2" +if [[ ! -x ${mg_client_exe} ]]; then + echo "Expected mg_client executable at '${mg_client_exe}'" exit 1 fi @@ -47,16 +47,28 @@ do # run memgraph with durability_directory pointing # to examples snapshots_dir ${memgraph_exe} --data-directory "$script_dir/$snapshots_dir/" \ - --storage-snapshot-on-exit > /dev/null 2>&1 & + --storage-snapshot-on-exit \ + --storage-properties-on-edges & memgraph_pid=$! sleep 2 # wait for memgraph to start - # create data using bolt-client - ${bolt_client_exe} < "$script_dir/$dir/$query" > /dev/null 2>&1 || exit 1 + # create data using mg_client + set +e + ${mg_client_exe} --use-ssl=false < "$script_dir/$dir/$query" + code=$? + set -e - # kill memgraph - kill $memgraph_pid + if [ $code -eq 0 ]; then + # terminate memgraph + kill $memgraph_pid - # wait for memgraph to terminate - wait $memgraph_pid + # wait for memgraph to terminate + wait $memgraph_pid + else + # kill memgraph + kill -9 $memgraph_pid + + # abort + exit $code + fi done diff --git a/release/examples/queries/Backpacking/populate.cyp b/release/examples/queries/Backpacking/populate.cyp index a3af07f95..bdd4fd5bf 100644 --- a/release/examples/queries/Backpacking/populate.cyp +++ b/release/examples/queries/Backpacking/populate.cyp @@ -1,3 +1,4 @@ +CREATE INDEX ON :City (id); CREATE (:City {id: 0, cheapest_hostel: "Flying Pig Downtown", hostel_url: "https://www.priceoftravel.com/AAmsterdamHostel", name: "Amsterdam", country: "Netherlands", local_currency: "Euro", local_currency_code: "EUR", rank: 52, total_USD: 106.764, attractions_USD: 19.84, cost_per_night_USD: 45.756, drinks_USD: 14.88, meals_USD: 19.344, transportation_USD: 6.944 }); CREATE (:City {id: 1, cheapest_hostel: "Zorbas Hostel", hostel_url: "https://www.priceoftravel.com/AAthensHostel", name: "Athens", country: "Greece", local_currency: "Euro", local_currency_code: "EUR", rank: 23, total_USD: 58.9, attractions_USD: 9.92, cost_per_night_USD: 12.4, drinks_USD: 9.3, meals_USD: 23.808, transportation_USD: 3.472 }); CREATE (:City {id: 2, cheapest_hostel: "Amistat Beach Hostel Barcelona", hostel_url: "https://www.priceoftravel.com/ABarcelonaHostel", name: "Barcelona", country: "Spain", local_currency: "Euro", local_currency_code: "EUR", rank: 38, total_USD: 80.104, attractions_USD: 16.12, cost_per_night_USD: 23.684, drinks_USD: 11.16, meals_USD: 23.808, transportation_USD: 5.332 }); @@ -54,6 +55,7 @@ CREATE (:City {id: 52, cheapest_hostel: "Tatamka Hostel", hostel_url: "https://w CREATE (:City {id: 53, cheapest_hostel: "Hostel Temza", hostel_url: "https://www.priceoftravel.com/AZagrebHostel", name: "Zagreb", country: "Croatia", local_currency: "Croatian Kuna", local_currency_code: "HRK", rank: 8, total_USD: 38.08, attractions_USD: 5.1, cost_per_night_USD: 9.18, drinks_USD: 6.12, meals_USD: 14.28, transportation_USD: 3.4 }); CREATE (:City {id: 54, cheapest_hostel: "City Backpacker Hostel Biber", hostel_url: "https://www.priceoftravel.com/AZurichHostel", name: "Zurich", country: "Switzerland", local_currency: "Swiss Franc", local_currency_code: "CHF", rank: 56, total_USD: 123.123, attractions_USD: 15.75, cost_per_night_USD: 40.803, drinks_USD: 22.05, meals_USD: 39.06, transportation_USD: 5.46 }); CREATE (:City {id: 55, cheapest_hostel: "Hostel Merlin", hostel_url: "https://www.priceoftravel.com/AceskyKrumlovHostel", name: "Český Krumlov", country: "Czech Republic", local_currency: "Czech Krona", local_currency_code: "CZK", rank: 12, total_USD: 40.376, attractions_USD: 4.9, cost_per_night_USD: 14.602, drinks_USD: 4.41, meals_USD: 14.112, transportation_USD: 2.352 }); +CREATE INDEX ON :Country (id); CREATE (:Country {id: 0, name: "Austria" }); CREATE (:Country {id: 1, name: "Belgium" }); CREATE (:Country {id: 2, name: "Bosnia and Herzegovina" }); diff --git a/release/examples/queries/Movie/populate.cyp b/release/examples/queries/Movie/populate.cyp index 3b736ceb1..771439dfe 100644 --- a/release/examples/queries/Movie/populate.cyp +++ b/release/examples/queries/Movie/populate.cyp @@ -1,3 +1,4 @@ +create index on :User (id); create (n :User{id:235, name:"Isabel"}); create (n :User{id:539, name:"Valerian"}); create (n :User{id:226, name:"Hillary"}); @@ -669,6 +670,7 @@ create (n :User{id:652, name:"Caroll"}); create (n :User{id:560, name:"Wilhelmina"}); create (n :User{id:140, name:"Danny"}); create (n :User{id:477, name:"Shelly"}); +create index on :Genre (name); create (n :Genre{name: "Mystery"}); create (n :Genre{name: "Crime"}); create (n :Genre{name: "Drama"}); @@ -689,6 +691,7 @@ create (n :Genre{name: "Science Fiction"}); create (n :Genre{name: "Adventure"}); create (n :Genre{name: "Thriller"}); create (n :Genre{name: "Western"}); +create index on :Move (id); create (n :Movie{id: 9073, title: "Free Willy 2 - The Adventure Home"}); match (g:Genre {name:"Adventure"}),(m:Movie{id:9073}) create (m)-[:ofGenre]->(g); create (n :Movie{id: 9070, title: "Mighty Morphin Power Rangers: The Movie"}); diff --git a/release/examples/queries/football/populate.cyp b/release/examples/queries/football/populate.cyp index 27f738aed..e7ccbc9e8 100644 --- a/release/examples/queries/football/populate.cyp +++ b/release/examples/queries/football/populate.cyp @@ -1,3 +1,4 @@ +CREATE INDEX ON :Team (name); MERGE (n :Team {name: "Bergen"}); MERGE (n :Team {name: "Mechelen"}); MERGE (n :Team {name: "Dender"}); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2999a606d..fd7428f95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -348,7 +348,7 @@ install( CODE "execute_process(COMMAND ${examples}/build_examples ${CMAKE_BINARY_DIR}/memgraph - ${CMAKE_BINARY_DIR}/tests/manual/bolt_client + ${CMAKE_BINARY_DIR}/tools/src/mg_client WORKING_DIRECTORY ${examples})") install(DIRECTORY ${examples}/build/ DESTINATION share/memgraph/examples)