diff --git a/pom.xml b/pom.xml
index bead2b4..3393873 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
eu.larkc.csparql
csparql-core
- 0.9.6
+ 0.9.7
it.polimi.deib
diff --git a/src/main/java/lu/jpt/csparqltest/Main.java b/src/main/java/lu/jpt/csparqltest/Main.java
index c7fdfe8..4d46b6e 100644
--- a/src/main/java/lu/jpt/csparqltest/Main.java
+++ b/src/main/java/lu/jpt/csparqltest/Main.java
@@ -2,6 +2,7 @@ package lu.jpt.csparqltest;
import java.text.ParseException;
+import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -17,11 +18,18 @@ public class Main {
private static Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
- logger.debug("Let's go!");
-
+ System.out.println("Hallo!");
+ try {
+ PropertyConfigurator.configure("./src/main/resources/log4j.properties");
+ } catch(Throwable t) {
+ PropertyConfigurator.configure("/log4j.properties");
+ }
+
// Instantiate and initialize engine
CsparqlEngine engine = new CsparqlEngineImpl();
engine.initialize(true);
+ logger.debug("CWD: " + System.getProperty("user.dir"));
+ logger.debug("Engine from: " + engine.getClass().getProtectionDomain().getCodeSource());
// Create and register stream generator at specific URI
RdfStream carStreamGenerator = new CarStreamGenerator("http://myexample.org/cars");
@@ -32,7 +40,7 @@ public class Main {
t.start();
// Now build a query to run - interchangeable
- String query = Main.getAcceleratingCars();
+ String query = Main.getBasicCarInfoQuery();
// Create a result proxy by registering the query at the engine
CsparqlQueryResultProxy resultProxy = null;
@@ -71,8 +79,9 @@ public class Main {
+ "SELECT ?car ?speed ?temp) "
+ "FROM STREAM [RANGE 5s STEP 1s] "
+ "WHERE { "
- + " ?car cars:currentSpeed ?speed . "
- + " ?car cars:currentTemperature ?temp . "
+ + " ?e cars:carID ?car . "
+ + " ?e cars:currentSpeed ?speed . "
+ + " ?e cars:currentTemperature ?temp . "
+ "}";
}
diff --git a/src/main/java/lu/jpt/csparqltest/carexample/CarStreamGenerator.java b/src/main/java/lu/jpt/csparqltest/carexample/CarStreamGenerator.java
index f2e04b7..50ae9a7 100644
--- a/src/main/java/lu/jpt/csparqltest/carexample/CarStreamGenerator.java
+++ b/src/main/java/lu/jpt/csparqltest/carexample/CarStreamGenerator.java
@@ -31,18 +31,26 @@ public class CarStreamGenerator extends RdfStream implements Runnable {
this.updateCars();
for(Car currentCar : this.cars) {
long currentTime = System.currentTimeMillis();
+ String eventID = this.getIRI() + "/event#" + currentTime;
this.put(new RdfQuadruple(
- getIRI() + "/" + currentCar.getID(),
+ eventID,
+ getIRI() + "#carID",
+ ""+currentCar.getID(),
+ currentTime
+ )
+ );
+ this.put(new RdfQuadruple(
+ eventID,
getIRI() + "#currentSpeed",
- ""+currentCar.getKilometersPerHour(),// + "^^http://www.w3.org/2001/XMLSchema#integer",
+ ""+currentCar.getKilometersPerHour() + "^^http://www.w3.org/2001/XMLSchema#integer",
currentTime
)
);
this.put(new RdfQuadruple(
getIRI() + "/" + currentCar.getID(),
getIRI() + "#currentTemperature",
- ""+currentCar.getMotorTemperature(),// + "^^http://www.w3.org/2001/XMLSchema#integer",
+ ""+currentCar.getMotorTemperature() + "^^http://www.w3.org/2001/XMLSchema#integer",
currentTime
)
);
diff --git a/src/main/resources/csparql_readyToGoPack_log4j.properties b/src/main/resources/csparql_readyToGoPack_log4j.properties
new file mode 100644
index 0000000..bb19db9
--- /dev/null
+++ b/src/main/resources/csparql_readyToGoPack_log4j.properties
@@ -0,0 +1,41 @@
+log4j.rootLogger=TRACE,CONSOLE_APPENDER,ERROR_FILE_APPENDER,DEBUG_FILE_APPENDER,INFO_FILE_APPENDER
+
+# CONSOLE_APPENDER
+log4j.appender.CONSOLE_APPENDER.Threshold=DEBUG
+log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=%-5p %r [%d] [%t] %c %x - %m%n
+
+# FILE_APPENDER
+log4j.appender.ERROR_FILE_APPENDER.Threshold=ERROR
+log4j.appender.ERROR_FILE_APPENDER=org.apache.log4j.RollingFileAppender
+log4j.appender.ERROR_FILE_APPENDER.File=log/csparql_error.log
+log4j.appender.ERROR_FILE_APPENDER.MaxFileSize=10MB
+log4j.appender.ERROR_FILE_APPENDER.MaxBackupIndex=10
+log4j.appender.ERROR_FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.ERROR_FILE_APPENDER.layout.ConversionPattern=%-5p %r [%d] [%t] %c %x - %m%n
+
+# FILE_APPENDER
+log4j.appender.DEBUG_FILE_APPENDER.Threshold=DEBUG
+log4j.appender.DEBUG_FILE_APPENDER=org.apache.log4j.RollingFileAppender
+log4j.appender.DEBUG_FILE_APPENDER.File=log/csparql_debug.log
+log4j.appender.DEBUG_FILE_APPENDER.MaxFileSize=10MB
+log4j.appender.DEBUG_FILE_APPENDER.MaxBackupIndex=10
+log4j.appender.DEBUG_FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.DEBUG_FILE_APPENDER.layout.ConversionPattern=%-5p %r [%d] [%t] %c %x - %m%n
+
+# FILE_APPENDER
+log4j.appender.INFO_FILE_APPENDER.Threshold=INFO
+log4j.appender.INFO_FILE_APPENDER=org.apache.log4j.RollingFileAppender
+log4j.appender.INFO_FILE_APPENDER.File=log/csparql_info.log
+log4j.appender.INFO_FILE_APPENDER.MaxFileSize=10MB
+log4j.appender.INFO_FILE_APPENDER.MaxBackupIndex=10
+log4j.appender.INFO_FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.INFO_FILE_APPENDER.layout.ConversionPattern=%-5p %r [%d] [%t] %c %x - %m%n
+
+log4j.logger.com.hp.hpl.jena=ERROR
+log4j.logger.polimi.deib=INFO
+log4j.logger.org.apache=ERROR
+log4j.logger.org.restlet=ERROR
+log4j.logger.sun.net=ERROR
+log4j.logger.com.espertech=ERROR
\ No newline at end of file
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
new file mode 100644
index 0000000..208a8da
--- /dev/null
+++ b/src/main/resources/log4j.properties
@@ -0,0 +1,42 @@
+# Root logger option
+log4j.rootLogger=DEBUG, stdout
+
+log4j.logger.com.espertech=INFO
+log4j.logger.org.apache.http=INFO
+log4j.logger.org.apache.jena.riot=INFO
+log4j.logger.com.hp.hpl.jena.sparql.engine.iterator=DEBUG
+log4j.logger.com.hp.hpl.jena.sparql.engine.main.iterator=DEBUG
+
+# Direct log messages to a log file
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=C:\\logging.log
+log4j.appender.file.MaxFileSize=10MB
+log4j.appender.file.MaxBackupIndex=10
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%-5p %c{100}:%L - %m%n
+
+
+# shen trun off the debugger
+log4j.logger.org.apache.http=OFF
+log4j.logger.org.apache.jena.riot=OFF
+log4j.logger.com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern=OFF
+log4j.logger.com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch=OFF
+log4j.logger.com.hp.hpl.jena.shared.LockMRSW=OFF
+log4j.logger.eu.larkc.csparql.core.engine.CsparqlEngineImpl=INFO
+log4j.logger.eu.larkc.csparql.core.Configuration=OFF
+log4j.logger.eu.larkc.csparql.core.streams.formats.CSparqlQueryImpl=OFF
+log4j.logger.com.hp.hpl.jena.sparql.engine.acqua.CacheAcqua=OFF
+log4j.logger.eu.larkc.csparql.sparql.jena.JenaEngine=OFF
+log4j.logger.eu.larkc.csparql.cep.esper.EsperEngine=OFF
+log4j.logger.org.apache.commons.beanutils.converters=INFO
+# iterators
+log4j.logger.com.hp.hpl.jena.sparql.engine.main.iterator.QueryIterService=DEBUG
+
+