From fd6156fe71e4fe1247c1464aba7acb468a3bdf08 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Wed, 12 Oct 2016 17:03:40 +0200 Subject: [PATCH] [TASK] Generic commit. --- README.md | 6 ++++-- .../jpt/csparqlproject/gui/FancyTextObserverWindow.java | 8 ++++---- .../jpt/csparqlproject/rentacar/RentACarSimulation.java | 9 +++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 81865a9..2ae7693 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # CSPARQL-Carsimulation -This project uses the CEP engine C-SPARQL to demonstrate how event data from rdf streams can be processed. -It consist of a rudimentary simulation which generates rdf event data that is then fed into the engine through rdf streams. +This project (which is more of a prototype than i am willing to admit) uses the CEP engine C-SPARQL to demonstrate how event data from rdf streams can be processed. +It consist of a very rudimentary simulation that provides rdf event streams that can be fed into the C-SPARQL engine for further processing. It also brings along a bunch of C-SPARQL queries that are based on the results of my bachelor thesis that are meant to process the event stream data from the simulation in order to extract meaningful event patterns. + +The project itself comes with a GUI that provides rough controls over whether the simulation is running plus a bunch of windows that show the data from the rdf streams and the results of the registered C-SPARQL queries for inspection. This project uses maven, so in order to get all the dependencies and build the project, you can run ```mvn package```. diff --git a/src/main/java/lu/jpt/csparqlproject/gui/FancyTextObserverWindow.java b/src/main/java/lu/jpt/csparqlproject/gui/FancyTextObserverWindow.java index d8056de..375eb56 100644 --- a/src/main/java/lu/jpt/csparqlproject/gui/FancyTextObserverWindow.java +++ b/src/main/java/lu/jpt/csparqlproject/gui/FancyTextObserverWindow.java @@ -54,7 +54,7 @@ public class FancyTextObserverWindow extends JFrame implements Observer { private volatile boolean autoScrollToBottom = true; private volatile boolean usePrefixManager = true; private volatile boolean clearInsteadOfEleminatingLines = true; - private volatile boolean updateThisWindow = true; + private volatile boolean updateThisWindow = false; /** * Constructor @@ -162,7 +162,7 @@ public class FancyTextObserverWindow extends JFrame implements Observer { this.setTitle(title); this.setResizable(true); this.setUndecorated(false); - this.setDefaultCloseOperation(EXIT_ON_CLOSE); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = this.getContentPane(); contentPane.setLayout(new BorderLayout()); @@ -209,7 +209,7 @@ public class FancyTextObserverWindow extends JFrame implements Observer { JCheckBox updateWindowCheckbox = new JCheckBox(); updateWindowCheckbox.setText("Update this window"); updateWindowCheckbox.setEnabled(true); - updateWindowCheckbox.setSelected(true); + updateWindowCheckbox.setSelected(this.updateThisWindow); updateWindowCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -320,7 +320,7 @@ public class FancyTextObserverWindow extends JFrame implements Observer { * Helper method to enforce a line limit for the window. */ private void enforceLineLimit() { - int MAX_LINES = 300; + int MAX_LINES = 250; String[] lines = this.textPane.getText().split("\n"); int totalLines = lines.length; int characters = 0; diff --git a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java index b2d51ee..d6e331f 100644 --- a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java @@ -54,7 +54,7 @@ public class RentACarSimulation implements Runnable { public RentACarSimulation(CsparqlEngine engine) { this.engine = engine; this.registerOwnPrefixes(); - int numberOfCars = 2; // Maximum of 10 cars are in the ABox (0-9) + int numberOfCars = 3; // Maximum of 10 cars are in the ABox (0-9) int numberOfCustomers = 5; // Maximum of 5 drivers are in the ABox (0-4) // Create a car pool and drivers this.carPool = new CarPool(numberOfCars); @@ -215,6 +215,7 @@ public class RentACarSimulation implements Runnable { + " FILTER(?speed > 0) " + "}"; QueryContainer queryContainer = new QueryContainer("getMovingCars", query, true); + queryContainer.useObserverWindow(); return queryContainer; } @@ -250,6 +251,7 @@ public class RentACarSimulation implements Runnable { + " FILTER(?deltaSpeed > 25) " + "}"; QueryContainer queryContainer = new QueryContainer("getStronglyAcceleratingCars", query, true); + //queryContainer.useObserverWindow(); return queryContainer; } @@ -285,6 +287,7 @@ public class RentACarSimulation implements Runnable { + " FILTER(?deltaSpeed < -25) " + "}"; QueryContainer queryContainer = new QueryContainer("getStronglyBrakingCars", query, true); + queryContainer.useObserverWindow(); return queryContainer; } @@ -322,7 +325,7 @@ public class RentACarSimulation implements Runnable { + "}"; QueryContainer queryContainer = new QueryContainer("getEngineWear", query, true); RentACarSimulation.setUpReasoningOnQueryContainer(queryContainer); - queryContainer.useObserverWindow(); + //queryContainer.useObserverWindow(); return queryContainer; } @@ -347,6 +350,7 @@ public class RentACarSimulation implements Runnable { + "}"; QueryContainer queryContainer = new QueryContainer("getBrakeWear", query, true); RentACarSimulation.setUpReasoningOnQueryContainer(queryContainer); + queryContainer.useObserverWindow(); return queryContainer; } @@ -374,6 +378,7 @@ public class RentACarSimulation implements Runnable { + "}"; QueryContainer queryContainer = new QueryContainer("getHandbrakeWear", query, true); RentACarSimulation.setUpReasoningOnQueryContainer(queryContainer); + queryContainer.useObserverWindow(); return queryContainer; }