From 7432fec180a02dff7419997c86199eb348880710 Mon Sep 17 00:00:00 2001 From: medina5 Date: Thu, 23 Oct 2025 07:48:31 +0200 Subject: [PATCH] README --- exercice1.md | 5 +++ README.md => exercice2.md | 85 ++++++++++----------------------------- reponses.md | 55 +++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 64 deletions(-) create mode 100644 exercice1.md rename README.md => exercice2.md (54%) create mode 100644 reponses.md diff --git a/exercice1.md b/exercice1.md new file mode 100644 index 0000000..bcbad39 --- /dev/null +++ b/exercice1.md @@ -0,0 +1,5 @@ +# postgreSQL + +Restaurer la base de données postgreSQL. + +Trouver le chemins le plus rapide à l'aide de l'algorith de Dijkstra entre le casino et la falaise diff --git a/README.md b/exercice2.md similarity index 54% rename from README.md rename to exercice2.md index cf195f9..2e62b78 100644 --- a/README.md +++ b/exercice2.md @@ -3,61 +3,22 @@ docker build -t mon-app . http://localhost:3000 -```cypher -LOAD CSV FROM 'file:///artists.csv' AS row -MERGE (a:Artist { name: row[1], year: toInteger(row[2]) }) -RETURN a.name, a.year -``` + +### Réseau routier ```cypher LOAD CSV WITH HEADERS -FROM 'file:///individus.csv' AS row -FIELDTERMINATOR ';' -MERGE (i:Individu { id: toInteger(row['id']) }) -SET i.prenom = row['prenom'], - i.age = toInteger(row['age']), - i.sexe = row['sexe'], - i.etudes = toInteger(row['etudes']), - i.richesse = toInteger(row['richesse']), - i.lecture = toFloat(row['lecture']), - i.musique = toFloat(row['musique']), - i.sport = toFloat(row['sport']); +FROM 'file:///points.csv' AS row +MERGE (p:Point { id: toInteger(row.id) }) +SET p.nom = row.nom, + p.altitude = toInteger(row.altitude), + p.location = point({ + longitude: toFloat(row.longitude), + latitude: toFloat(row.latitude) + }); ``` -```cypher -MATCH (i:Individu) RETURN i LIMIT 25; ``` - -```cypher -MATCH (i:Individu {id: 58 }) -RETURN i; -``` - -```cypher -LOAD CSV WITH HEADERS -FROM 'file:///edges.csv' AS row -FIELDTERMINATOR ';' -MATCH (a:Individu {id: toInteger(row.source)}) -MATCH (b:Individu {id: toInteger(row.target)}) -MERGE (a)-[r:AMI]->(b) -MERGE (b)-[r2:AMI]->(a); -``` - -```cypher -MATCH (i:Individu) -DETACH DELETE i; -``` - -MATCH path = (a:Individu {id:24})-[:AMI*1..3]->(b:Individu) -RETURN path; - -MATCH (a:Individu {id: 22}), (b:Individu {id: 100}), -path = shortestPath((a)-[:AMI*..15]-(b)) -RETURN path; - -MATCH (a:Point {nom:'Boulangerie'}), (b:Point {nom:'Salle des fêtes'}) -RETURN point.distance(a.location, b.location) - LOAD CSV WITH HEADERS FROM 'file:///routes.csv' AS row WITH row MATCH (a:Lieu {id: toInteger(row.source)}) @@ -75,23 +36,13 @@ WITH a, row MATCH (b:Lieu {id: toInteger(row.target)}) MERGE (b)-[r:ROUTE {route_id: toInteger(row.route_id) * 1000}]->(a) SET r.tag = row.tag, r.cout = toFloat(row.cout_inverse); - - - -### Réseau routier - -```cypher -LOAD CSV WITH HEADERS -FROM 'file:///points.csv' AS row -MERGE (p:Point { id: toInteger(row.id) }) -SET p.nom = row.nom, - p.altitude = toInteger(row.altitude), - p.location = point({ - longitude: toFloat(row.longitude), - latitude: toFloat(row.latitude) - }); ``` +1. Quelle est la distance entre le casino et la falaise + +2. Quel est le plus court chemin entre le casino et la falaise + + ### Réseau d'amis ```cypher @@ -113,3 +64,9 @@ CREATE CONSTRAINT individu_id IF NOT EXISTS FOR (i:Individu) REQUIRE i.id IS UNIQUE; ``` + +1. Quels sont les amis de l'id 58 + +2. Quels sont les amis des amis de l'id 58 + +3. Quelle est la chaine de relation entre l'id 58 et 40 ? diff --git a/reponses.md b/reponses.md new file mode 100644 index 0000000..8f08dc2 --- /dev/null +++ b/reponses.md @@ -0,0 +1,55 @@ +```cypher +LOAD CSV FROM 'file:///artists.csv' AS row +MERGE (a:Artist { name: row[1], year: toInteger(row[2]) }) +RETURN a.name, a.year +``` + + +```cypher +LOAD CSV WITH HEADERS +FROM 'file:///individus.csv' AS row +FIELDTERMINATOR ';' +MERGE (i:Individu { id: toInteger(row['id']) }) +SET i.prenom = row['prenom'], + i.age = toInteger(row['age']), + i.sexe = row['sexe'], + i.etudes = toInteger(row['etudes']), + i.richesse = toInteger(row['richesse']), + i.lecture = toFloat(row['lecture']), + i.musique = toFloat(row['musique']), + i.sport = toFloat(row['sport']); +``` + +```cypher +MATCH (i:Individu) RETURN i LIMIT 25; +``` + +```cypher +MATCH (i:Individu {id: 58 }) +RETURN i; +``` + +```cypher +LOAD CSV WITH HEADERS +FROM 'file:///edges.csv' AS row +FIELDTERMINATOR ';' +MATCH (a:Individu {id: toInteger(row.source)}) +MATCH (b:Individu {id: toInteger(row.target)}) +MERGE (a)-[r:AMI]->(b) +MERGE (b)-[r2:AMI]->(a); +``` + +```cypher +MATCH (i:Individu) +DETACH DELETE i; +``` + +MATCH path = (a:Individu {id:24})-[:AMI*1..3]->(b:Individu) +RETURN path; + +MATCH (a:Individu {id: 22}), (b:Individu {id: 100}), +path = shortestPath((a)-[:AMI*..15]-(b)) +RETURN path; + +MATCH (a:Point {nom:'Boulangerie'}), (b:Point {nom:'Salle des fêtes'}) +RETURN point.distance(a.location, b.location)