From 137425b81a85177790304141dfda03c206c9bb6c Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Wed, 17 Aug 2016 11:24:16 +0200 Subject: [PATCH] [TASK] Add tirePressure for all 4 tires. --- .../java/lu/jpt/csparqltest/rentacar/Car.java | 15 ++++++++++++--- .../csparqltest/rentacar/RentACarSimulation.java | 7 +++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/Car.java b/src/main/java/lu/jpt/csparqltest/rentacar/Car.java index 171589c..0754c3a 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/Car.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/Car.java @@ -38,7 +38,10 @@ public class Car { private boolean motorOn; private int motorRpm; private int speed; - private double tirePressure; + private double tirePressure1; + private double tirePressure2; + private double tirePressure3; + private double tirePressure4; // Sitzplätze? Reservierungen für X Personen? @@ -57,7 +60,10 @@ public class Car { this.motorOn = false; this.motorRpm = 0; this.speed = 0; - this.tirePressure = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0; + this.tirePressure1 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0; + this.tirePressure2 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0; + this.tirePressure3 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0; + this.tirePressure4 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0; // State data this.currentState = CarState.LOCKED; this.currentAction = CarAction.NONE; @@ -224,7 +230,10 @@ public class Car { this.quads.add(new RdfQuadruple(eventIri, baseOnt+"motorRPM", ""+this.motorRpm+"^^http://www.w3.org/2001/XMLSchema#integer", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"speed", ""+this.speed+"^^http://www.w3.org/2001/XMLSchema#integer", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"handbrakeEngaged", ""+this.handbrakeEngaged+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); - this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure", ""+this.tirePressure+"^^http://www.w3.org/2001/XMLSchema#double", time)); + this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure1", ""+this.tirePressure1+"^^http://www.w3.org/2001/XMLSchema#double", time)); + this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure2", ""+this.tirePressure2+"^^http://www.w3.org/2001/XMLSchema#double", time)); + this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure3", ""+this.tirePressure3+"^^http://www.w3.org/2001/XMLSchema#double", time)); + this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure4", ""+this.tirePressure4+"^^http://www.w3.org/2001/XMLSchema#double", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"locked", ""+this.isLocked+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); } diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java index 44c74ad..e86f434 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java @@ -106,7 +106,7 @@ public class RentACarSimulation implements Runnable { + "PREFIX f: " + "PREFIX xsd: " + "PREFIX car: <"+RentACarSimulation.BASE_ONTOLOGY_IRI+"> " - + "SELECT ?car ?locked ?on ?speed ?rpm ?handbrake ?tirePressure " + + "SELECT ?car ?locked ?on ?speed ?rpm ?handbrake ?tirePressure1 ?tirePressure2 ?tirePressure3 ?tirePressure4 " + "FROM STREAM <"+RentACarSimulation.CAR_STREAM_IRI+"> [RANGE 5s STEP 1s] " + "FROM STREAM <"+RentACarSimulation.DRIVER_STREAM_IRI+"> [RANGE 15s STEP 1s] " + "WHERE { " @@ -117,7 +117,10 @@ public class RentACarSimulation implements Runnable { + " ?e car:speed ?speed . " + " ?e car:motorRPM ?rpm . " + " ?e car:handbrakeEngaged ?handbrake . " - + " ?e car:tirePressure ?pressure . " + + " ?e car:tirePressure1 ?pressure1 . " + + " ?e car:tirePressure2 ?pressure2 . " + + " ?e car:tirePressure3 ?pressure3 . " + + " ?e car:tirePressure4 ?pressure4 . " + "}"; }