diff --git a/P4/queries.cyp b/P4/queries.cyp index 9f726a1..d63acc3 100644 --- a/P4/queries.cyp +++ b/P4/queries.cyp @@ -1,6 +1,7 @@ # 1 -MATCH (:Country {name:"Greece"})-[:Borders]->(c:Country)<-[e:Encompasses]-(k:Continent WHERE k.name <> 'Europe' OR e.percentage <> "100.0") +MATCH (k:Continent {name:"Europe"})-[e:Encompasses]->(c:Country)-[:Borders]->(:Country {name:"Greece"}) +WHERE e.percentage <> "100.0" RETURN DISTINCT c.name; # 2 - VALID @@ -9,14 +10,16 @@ MATCH (:Country {name:"China"})-[:Borders]->(c:Country)-[:Borders]->(c2:Country) WHERE c.name < c2.name RETURN c.name, c2.name; -# 3 +# 3 - VALID -MATCH (:Continent {name:"Europe"})-[:Encompasses {percentage:"100.0"}]->(c:Country)-[:Borders]->(:Country)<-[e:Encompasses]-(k:Continent WHERE k.name <> "Europe" OR e.percentage <> "100.0") +MATCH (:Continent {name:"Europe"})-[:Encompasses {percentage:100.0}]->(c:Country)-[:Borders]->(:Country)<-[e:Encompasses]-(k:Continent) +WHERE k.name <> "Europe" OR e.percentage <> 100.0 RETURN DISTINCT c.name; -# 4 +# 4 - VALID -MATCH (:Country {name:"Turkey"})-[:Borders *..2]->(c:Country WHERE c.name <> "Turkey")<-[:Encompasses]-(k:Continent {name:"Asia"}) +MATCH (:Country {name:"Turkey"})-[:Borders *..2]->(c:Country)<-[:Encompasses]-(k:Continent {name:"Asia"}) +WHERE c.name <> "Turkey" RETURN DISTINCT c.name ORDER BY c.name; @@ -40,9 +43,10 @@ LIMIT 1; MATCH p=shortestPath((:Country {name:"Belgium"})-[:Borders *]->(:Country {name:"China"})) RETURN p; -# 8 +# 8 - VALID -MATCH p=shortestPath((:Country {name:"Belgium"})-[:Borders *]->(d:Country WHERE d.name <> "Belgium")) +MATCH p=shortestPath((:Country {name:"Belgium"})-[:Borders *]->(d:Country)) +WHERE d.name <> "Belgium" RETURN d.name ORDER BY length(p) DESC LIMIT 1