From e975f9825e810b8670aab14874c96e85021a2a96 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 11 Oct 2016 16:59:24 +0200 Subject: [PATCH] [TASK] Generic commit. --- .../jpt/csparqlproject/SimulationContext.java | 2 +- .../rentacar/RentACarSimulation.java | 34 ++++++++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/main/java/lu/jpt/csparqlproject/SimulationContext.java b/src/main/java/lu/jpt/csparqlproject/SimulationContext.java index cf9a655..bda0889 100644 --- a/src/main/java/lu/jpt/csparqlproject/SimulationContext.java +++ b/src/main/java/lu/jpt/csparqlproject/SimulationContext.java @@ -187,7 +187,7 @@ public class SimulationContext { engine.registerStream(rdfStreamFormatter); resultProxy.addObserver(rdfStreamFormatter); if(queryContainer.useObserverWindow) { - Observer resultObserver = this.createResultObserverWindow(queryContainer.name); + Observer resultObserver = this.createResultObserverWindow(streamUri); resultProxy.addObserver(resultObserver); } } else { diff --git a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java index a782681..c62df9f 100644 --- a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java @@ -74,9 +74,9 @@ public class RentACarSimulation implements Runnable { private void registerOwnPrefixes() { Main.prefixManager.registerPrefix("event", RentACarSimulation.BASE_OBJECT_IRI+"/event#"); - Main.prefixManager.registerPrefix("carOnt", RentACarSimulation.BASE_ONTOLOGY_IRI); - Main.prefixManager.registerPrefix("car", RentACarSimulation.BASE_OBJECT_IRI+"/Car#"); - Main.prefixManager.registerPrefix("driver", RentACarSimulation.BASE_OBJECT_IRI+"/Driver#"); + Main.prefixManager.registerPrefix("car", RentACarSimulation.BASE_ONTOLOGY_IRI); + Main.prefixManager.registerPrefix("cars", RentACarSimulation.BASE_OBJECT_IRI+"/Car#"); + Main.prefixManager.registerPrefix("drivers", RentACarSimulation.BASE_OBJECT_IRI+"/Driver#"); } public RdfStream getCarStream() { @@ -579,26 +579,22 @@ public class RentACarSimulation implements Runnable { + "PREFIX car: " + "CONSTRUCT { " + " [] rdf:type car:CarMaintenanceNeededEvent " - + " ; car:relatedCar ?car . " + + " ; car:relatedCar ?car " + + " ; car:numberOfWearEvents ?numberWearEvents . " + "} " - + "FROM STREAM [RANGE 5s TUMBLING] " - + "FROM STREAM [RANGE 4h STEP 5m] " + + "FROM STREAM [RANGE 5s TUMBLING] " + "WHERE { " + " { " - + " SELECT ?car " - + " WHERE { " - + " ?wearEvent rdf:type car:CarWearEvent . " - + " ?wearEvent car:relatedCar ?car . " - + " } " - + " GROUP BY ?car " - + " HAVING (COUNT(?wearEvent) > 10) " + + " SELECT (?carWithWear AS ?car) (COUNT(?wearEvent) AS ?numberWearEvents) " + + " WHERE { " + + " ?wearEvent rdf:type car:CarWearEvent . " + + " ?wearEvent car:relatedCar ?carWithWear . " + + " } " + + " GROUP BY ?carWithWear " + + " HAVING (COUNT(?wearEvent) > 10) " + " } " - + " UNION { " - + " ?checkEngineEvent rdf:type car:CarCheckEngineEvent . " - + " ?checkEngineEvent car:relatedCar ?car . " - + " } " - + "}"; - QueryContainer queryContainer = new QueryContainer("getMaintenanceEvents", query, true); + + "}"; + QueryContainer queryContainer = new QueryContainer("getMaintenanceEvents", query, false); queryContainer.useObserverWindow(); return queryContainer; }