2025-10-21 10:13:57 +02:00
|
|
|
docker build -t mon-app .
|
|
|
|
|
|
2025-10-23 12:08:18 +02:00
|
|
|
http://localhost:7474
|
2025-10-22 07:51:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-23 07:48:31 +02:00
|
|
|
### Réseau routier
|
2025-10-22 07:51:05 +02:00
|
|
|
|
|
|
|
|
```cypher
|
|
|
|
|
LOAD CSV WITH HEADERS
|
2025-10-23 07:48:31 +02:00
|
|
|
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)
|
|
|
|
|
});
|
2025-10-22 07:51:05 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
2025-10-23 07:17:58 +02:00
|
|
|
LOAD CSV WITH HEADERS FROM 'file:///routes.csv' AS row
|
|
|
|
|
WITH row
|
2025-10-23 12:08:18 +02:00
|
|
|
MATCH (a:Point {id: toInteger(row.source)})
|
2025-10-23 07:17:58 +02:00
|
|
|
WITH a, row
|
2025-10-23 12:08:18 +02:00
|
|
|
MATCH (b:Point {id: toInteger(row.target)})
|
2025-10-23 07:17:58 +02:00
|
|
|
MERGE (a)-[r:ROUTE {route_id: toInteger(row.route_id)}]->(b)
|
|
|
|
|
SET r.tag = row.tag, r.cout = toFloat(row.cout);
|
2025-10-23 12:08:18 +02:00
|
|
|
```
|
2025-10-23 07:17:58 +02:00
|
|
|
|
|
|
|
|
-- routes inverses si cout_inverse != -1
|
2025-10-23 12:08:18 +02:00
|
|
|
```
|
2025-10-23 07:17:58 +02:00
|
|
|
LOAD CSV WITH HEADERS FROM 'file:///routes.csv' AS row
|
|
|
|
|
WITH row
|
|
|
|
|
WHERE toFloat(row.cout_inverse) <> -1
|
2025-10-23 12:08:18 +02:00
|
|
|
MATCH (a:Point {id: toInteger(row.source)})
|
2025-10-23 07:17:58 +02:00
|
|
|
WITH a, row
|
2025-10-23 12:08:18 +02:00
|
|
|
MATCH (b:Point {id: toInteger(row.target)})
|
2025-10-23 07:17:58 +02:00
|
|
|
MERGE (b)-[r:ROUTE {route_id: toInteger(row.route_id) * 1000}]->(a)
|
|
|
|
|
SET r.tag = row.tag, r.cout = toFloat(row.cout_inverse);
|
2025-10-23 07:48:31 +02:00
|
|
|
```
|
2025-10-23 07:17:58 +02:00
|
|
|
|
2025-10-23 07:48:31 +02:00
|
|
|
1. Quelle est la distance entre le casino et la falaise
|
2025-10-23 07:17:58 +02:00
|
|
|
|
2025-10-23 07:48:31 +02:00
|
|
|
2. Quel est le plus court chemin entre le casino et la falaise
|
2025-10-23 07:17:58 +02:00
|
|
|
|
2025-10-22 07:51:05 +02:00
|
|
|
|
|
|
|
|
### Réseau d'amis
|
|
|
|
|
|
|
|
|
|
```cypher
|
|
|
|
|
LOAD CSV WITH HEADERS
|
|
|
|
|
FROM 'file:///individus.csv' AS row
|
|
|
|
|
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
|
|
|
|
|
CREATE CONSTRAINT individu_id IF NOT EXISTS
|
|
|
|
|
FOR (i:Individu)
|
|
|
|
|
REQUIRE i.id IS UNIQUE;
|
|
|
|
|
```
|
2025-10-23 07:48:31 +02:00
|
|
|
|
2025-10-23 12:11:01 +02:00
|
|
|
```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);
|
|
|
|
|
```
|
|
|
|
|
|
2025-10-23 11:29:32 +02:00
|
|
|
1. Combien d'amis a l'id 58 ?
|
2025-10-23 07:48:31 +02:00
|
|
|
|
2025-10-23 11:29:32 +02:00
|
|
|
2. Quels sont les amis de l'id 58 ?
|
2025-10-23 07:48:31 +02:00
|
|
|
|
2025-10-23 11:29:32 +02:00
|
|
|
3. Quels sont les amis des amis de l'id 58
|
|
|
|
|
|
|
|
|
|
4. Quelle est la chaine de relation entre l'id 58 et 40 ?
|
|
|
|
|
|
|
|
|
|
5. Quels sont les personnes qui ont un niveau d'études à 3 et un niveau de richesse à 0
|