From b7d9e55bbff5944c45e2dbf3f2e4e409a492119b Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 10 Oct 2016 17:09:55 +0200 Subject: [PATCH] [TASK] Overhaul getMovingCarsQuery. --- .../csparqlproject/rentacar/RentACarSimulation.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java index 0677311..07b62e0 100644 --- a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java @@ -547,18 +547,17 @@ public class RentACarSimulation implements Runnable { + "SELECT ?car " + "FROM STREAM <"+RentACarSimulation.CAR_STREAM_IRI+"> [RANGE 15s STEP 1s] " + "WHERE { " - + " ?standingEvent rdf:type car:CarStatusEvent . " - + " ?standingEvent car:speed ?zeroSpeed . " - + " ?standingEvent car:handbrakeEngaged ?handbrake . " - + " ?standingEvent car:locked ?locked . " + + " ?lockEvent rdf:type car:CarLockEvent . " + + " ?lockEvent car:relatedCar ?car . " + " ?rollingEvent rdf:type car:CarStatusEvent . " + + " ?rollingEvent car:relatedCar ?car . " + " ?rollingEvent car:speed ?speed . " + " ?rollingEvent car:handbrakeEngaged ?handbrake . " + " ?rollingEvent car:locked ?locked . " - + " FILTER(?zeroSpeed = 0) " + + " FILTER(?speed>0) " + " FILTER(?locked) " - + " FILTER(!?handbrake)" - + " FILTER(f:timestamp(?standingEvent,rdf:type,car:CarStatusEvent) < f:timestamp(?rollingEvent,rdf:type,car:CarStatusEvent)) " + + " FILTER(!?handbrake) " + + " FILTER(f:timestamp(?lockEvent,rdf:type,car:CarLockEvent) < f:timestamp(?rollingEvent,rdf:type,car:CarStatusEvent)) " + "}"; QueryContainer queryContainer = new QueryContainer("getLockedMovingCars", query, true); queryContainer.useObserverWindow();