should be it
This commit is contained in:
25
external/duckdb/benchmark/trainbenchmark/queries/connectedsegments.sql
vendored
Normal file
25
external/duckdb/benchmark/trainbenchmark/queries/connectedsegments.sql
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
SELECT
|
||||
mb1.Sensor_id AS sensor,
|
||||
ct1.TrackElement1_id AS segment1,
|
||||
ct2.TrackElement1_id AS segment2,
|
||||
ct3.TrackElement1_id AS segment3,
|
||||
ct4.TrackElement1_id AS segment4,
|
||||
ct5.TrackElement1_id AS segment5,
|
||||
ct5.TrackElement2_id AS segment6
|
||||
FROM Segment
|
||||
INNER JOIN connectsTo as ct1 ON Segment.id = ct1.TrackElement1_id
|
||||
INNER JOIN connectsTo as ct2 ON ct1.TrackElement2_id = ct2.TrackElement1_id
|
||||
INNER JOIN connectsTo as ct3 ON ct2.TrackElement2_id = ct3.TrackElement1_id
|
||||
INNER JOIN connectsTo as ct4 ON ct3.TrackElement2_id = ct4.TrackElement1_id
|
||||
INNER JOIN connectsTo as ct5 ON ct4.TrackElement2_id = ct5.TrackElement1_id
|
||||
INNER JOIN monitoredBy as mb1 ON mb1.TrackElement_id = ct1.TrackElement1_id -- segment1
|
||||
INNER JOIN monitoredBy as mb2 ON mb2.TrackElement_id = ct2.TrackElement1_id -- segment2
|
||||
INNER JOIN monitoredBy as mb3 ON mb3.TrackElement_id = ct3.TrackElement1_id -- segment3
|
||||
INNER JOIN monitoredBy as mb4 ON mb4.TrackElement_id = ct4.TrackElement1_id -- segment4
|
||||
INNER JOIN monitoredBy as mb5 ON mb5.TrackElement_id = ct5.TrackElement1_id -- segment5
|
||||
INNER JOIN monitoredBy as mb6 ON mb6.TrackElement_id = ct5.TrackElement2_id -- segment6
|
||||
WHERE mb1.Sensor_id = mb2.Sensor_id
|
||||
AND mb1.Sensor_id = mb3.Sensor_id
|
||||
AND mb1.Sensor_id = mb4.Sensor_id
|
||||
AND mb1.Sensor_id = mb5.Sensor_id
|
||||
AND mb1.Sensor_id = mb6.Sensor_id;
|
||||
5
external/duckdb/benchmark/trainbenchmark/queries/poslength.sql
vendored
Normal file
5
external/duckdb/benchmark/trainbenchmark/queries/poslength.sql
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
SELECT
|
||||
id AS segment,
|
||||
length AS length
|
||||
FROM Segment
|
||||
WHERE length <= 0;
|
||||
13
external/duckdb/benchmark/trainbenchmark/queries/routesensor.sql
vendored
Normal file
13
external/duckdb/benchmark/trainbenchmark/queries/routesensor.sql
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
SELECT
|
||||
Route.id AS route,
|
||||
Sensor.id AS sensor,
|
||||
SwitchPosition.id AS swP,
|
||||
Switch.id as sw
|
||||
FROM Sensor
|
||||
INNER JOIN monitoredBy ON monitoredBy.Sensor_id = Sensor.id
|
||||
INNER JOIN Switch ON Switch.id = monitoredBy.TrackElement_id
|
||||
INNER JOIN SwitchPosition ON SwitchPosition.target = Switch.id
|
||||
INNER JOIN Route ON Route.id = SwitchPosition.route -- the "SwitchPosition.route" attribute is the inverse of the "Route.follows" edge
|
||||
LEFT OUTER JOIN requires ON requires.Route_id = Route.id
|
||||
AND requires.Sensor_id = Sensor.id
|
||||
WHERE requires.Sensor_id IS NULL
|
||||
39
external/duckdb/benchmark/trainbenchmark/queries/semaphoreneighbor.sql
vendored
Normal file
39
external/duckdb/benchmark/trainbenchmark/queries/semaphoreneighbor.sql
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
SELECT
|
||||
Route1.exit AS semaphore,
|
||||
Route1.id AS route1,
|
||||
Route2.id AS route2,
|
||||
requires1.Sensor_id AS sensor1,
|
||||
requires2.Sensor_id AS sensor2,
|
||||
ct.TrackElement1_id AS te1,
|
||||
ct.TrackElement2_id AS te2
|
||||
|
||||
-- (route1)
|
||||
FROM Route AS Route1
|
||||
|
||||
-- (route1)-[:requires]->(sensor1)
|
||||
INNER JOIN requires AS requires1
|
||||
ON Route1.id = requires1.Route_id
|
||||
|
||||
-- (sensor1)<-[:monitoredBy]-(te1)
|
||||
INNER JOIN monitoredBy AS mb1
|
||||
ON requires1.Sensor_id = mb1.Sensor_id
|
||||
|
||||
-- (te1)-[:connectsTo]->(te2)
|
||||
INNER JOIN connectsTo AS ct
|
||||
ON mb1.TrackElement_id = ct.TrackElement1_id
|
||||
|
||||
-- (te2)-[:monitoredBy]->(sensor2)
|
||||
INNER JOIN monitoredBy AS mb2
|
||||
ON ct.TrackElement2_id = mb2.TrackElement_id
|
||||
|
||||
-- (sensor2)<-[:requires]-(route2)
|
||||
INNER JOIN requires AS requires2
|
||||
ON mb2.Sensor_id = requires2.Sensor_id
|
||||
|
||||
-- (route2)
|
||||
INNER JOIN Route AS Route2
|
||||
ON requires2.Route_id = Route2.id
|
||||
|
||||
WHERE Route1.id != Route2.id
|
||||
AND Route1.exit IS NOT NULL -- semaphore
|
||||
AND (Route2.entry IS NULL OR Route2.entry != Route1.exit);
|
||||
4
external/duckdb/benchmark/trainbenchmark/queries/switchmonitored.sql
vendored
Normal file
4
external/duckdb/benchmark/trainbenchmark/queries/switchmonitored.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
SELECT Switch.id AS sw
|
||||
FROM Switch
|
||||
LEFT JOIN monitoredBy ON monitoredBy.TrackElement_id = Switch.id
|
||||
WHERE monitoredBy.TrackElement_id IS NULL;
|
||||
26
external/duckdb/benchmark/trainbenchmark/queries/switchset.sql
vendored
Normal file
26
external/duckdb/benchmark/trainbenchmark/queries/switchset.sql
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
SELECT
|
||||
Semaphore.id AS semaphore,
|
||||
Route.id AS route,
|
||||
SwitchPosition.id AS swP,
|
||||
Switch.id AS sw,
|
||||
SwitchPosition.position AS position,
|
||||
Switch.currentPosition AS currentPosition
|
||||
|
||||
-- (route)
|
||||
FROM Route
|
||||
|
||||
-- (route)-[:follows]->(swP)
|
||||
INNER JOIN SwitchPosition
|
||||
ON Route.id = SwitchPosition.route -- the "SwitchPosition.route" attribute is the inverse of the "Route.follows" edge
|
||||
|
||||
-- (swP)-[:target]->(sw)
|
||||
INNER JOIN Switch
|
||||
ON SwitchPosition.target = Switch.id
|
||||
|
||||
-- (route)-[:entry]->(semaphore)
|
||||
INNER JOIN Semaphore
|
||||
ON Route.entry = Semaphore.id
|
||||
|
||||
WHERE Route.active = 1
|
||||
AND Switch.currentPosition != SwitchPosition.position
|
||||
AND Semaphore.signal = 2;
|
||||
Reference in New Issue
Block a user