Commit c0da0227 authored by Giustozzi Franco's avatar Giustozzi Franco
Browse files

query update

parent f8e0f755
......@@ -470,36 +470,109 @@ public class Example {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory factory = manager.getOWLDataFactory();
String ontologyURI = "http://onto";
String ontologyURI = "http://semanticweb.org/STEaMINg/ContextOntology-COInd4";
String ns = ontologyURI + "#";
final OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(fileOntology));
SensorsStreamer Stream_C_Wtemp = new SensorsStreamer("Stream_C_Wtemp",ns,"C_Wtemp",9,ontology,factory);
SensorsStreamer Stream_TG_temp = new SensorsStreamer("Stream_TG_temp",ns,"TG_temp",9,ontology,factory);
SensorsStreamer Stream_G_temp = new SensorsStreamer("Stream_G_temp",ns,"G_temp",9,ontology,factory);
SensorsStreamer Stream_C_Wtemp = new SensorsStreamer("Stream_S_C_Wtemp",ns,"C_Wtemp",9,ontology,factory);
SensorsStreamer Stream_TG_temp = new SensorsStreamer("Stream_S_TG_temp",ns,"TG_temp",9,ontology,factory);
SensorsStreamer Stream_G_temp = new SensorsStreamer("Stream_S_G_temp",ns,"G_temp",9,ontology,factory);
SensorsStreamer Stream_P_temp = new SensorsStreamer("Stream_S_P_temp",ns,"P_temp",9,ontology,factory);
SensorsStreamer Stream_E_temp = new SensorsStreamer("Stream_S_E_temp",ns,"E_temp",9,ontology,factory);
SensorsStreamer Stream_PowerOutput = new SensorsStreamer("Stream_S_PowerOutput",ns,"PowerOutput",9,ontology,factory);
SensorsStreamer Stream_G_current = new SensorsStreamer("Stream_S_G_current",ns,"G_current",9,ontology,factory);
SensorsStreamer Stream_C_temp = new SensorsStreamer("Stream_S_C_temp",ns,"C_temp",9,ontology,factory);
SensorsStreamer Stream_T_temp = new SensorsStreamer("Stream_S_T_temp",ns,"T_temp",9,ontology,factory);
SensorsStreamer Stream_OilTemp = new SensorsStreamer("Stream_S_OilTemp",ns,"OilTemp",9,ontology,factory);
SensorsStreamer Stream_GB_temp = new SensorsStreamer("Stream_S_GB_temp",ns,"GB_temp",9,ontology,factory);
SensorsStreamer Stream_G_speed = new SensorsStreamer("Stream_S_G_speed",ns,"G_speed",9,ontology,factory);
SensorsStreamer Stream_Conv_temp = new SensorsStreamer("Stream_S_Conv_temp",ns,"Conv_temp",9,ontology,factory);
SensorsStreamer Stream_R_speed = new SensorsStreamer("Stream_S_R_speed",ns,"R_speed",9,ontology,factory);
SensorsStreamer Stream_R_Pangle = new SensorsStreamer("Stream_S_R_Pangle",ns,"R_Pangle",9,ontology,factory);
//Register new streams in the engine
engine.registerStream(Stream_C_Wtemp);
engine.registerStream(Stream_TG_temp);
engine.registerStream(Stream_G_temp);
engine.registerStream(Stream_P_temp);
engine.registerStream(Stream_E_temp);
engine.registerStream(Stream_PowerOutput);
engine.registerStream(Stream_G_current);
engine.registerStream(Stream_C_temp);
engine.registerStream(Stream_T_temp);
engine.registerStream(Stream_OilTemp);
engine.registerStream(Stream_GB_temp);
engine.registerStream(Stream_G_speed);
engine.registerStream(Stream_Conv_temp);
engine.registerStream(Stream_R_speed);
engine.registerStream(Stream_R_Pangle);
Thread Stream_C_Wtemp_Thread = new Thread(Stream_C_Wtemp);
Thread Stream_TG_temp_Thread = new Thread(Stream_TG_temp);
Thread Stream_G_temp_Thread = new Thread(Stream_G_temp);
Thread Stream_P_temp_Thread = new Thread(Stream_P_temp);
Thread Stream_E_temp_Thread = new Thread(Stream_E_temp);
Thread Stream_PowerOutput_Thread = new Thread(Stream_PowerOutput);
Thread Stream_G_current_Thread = new Thread(Stream_G_current);
Thread Stream_C_temp_Thread = new Thread(Stream_C_temp);
Thread Stream_T_temp_Thread = new Thread(Stream_T_temp);
Thread Stream_OilTemp_Thread = new Thread(Stream_OilTemp);
Thread Stream_GB_temp_Thread = new Thread(Stream_GB_temp);
Thread Stream_G_speed_Thread = new Thread(Stream_G_speed);
Thread Stream_Conv_temp_Thread = new Thread(Stream_Conv_temp);
Thread Stream_R_speed_Thread = new Thread(Stream_R_speed);
Thread Stream_R_Pangle_Thread = new Thread(Stream_R_Pangle);
//Register new query in the engine
CsparqlQueryResultProxy c_S1 = engine.registerQuery(queryS1, false);
CsparqlQueryResultProxy c_S2 = engine.registerQuery(queryS2, false);
CsparqlQueryResultProxy c_S3 = engine.registerQuery(queryS3, false);
CsparqlQueryResultProxy c_S4 = engine.registerQuery(queryS4, false);
CsparqlQueryResultProxy c_S5 = engine.registerQuery(queryS5, false);
CsparqlQueryResultProxy c_S6 = engine.registerQuery(queryS6, false);
CsparqlQueryResultProxy c_S7 = engine.registerQuery(queryS7, false);
CsparqlQueryResultProxy c_S8 = engine.registerQuery(queryS8, false);
CsparqlQueryResultProxy c_S9 = engine.registerQuery(queryS9, false);
CsparqlQueryResultProxy c_S10 = engine.registerQuery(queryS10, false);
CsparqlQueryResultProxy c_S11 = engine.registerQuery(queryS11, false);
CsparqlQueryResultProxy c_S12 = engine.registerQuery(queryS12, false);
CsparqlQueryResultProxy c_S13 = engine.registerQuery(queryS13, false);
CsparqlQueryResultProxy c_S14 = engine.registerQuery(queryS14, false);
//Attach a result consumer to the query result proxy to print the results on the console
c_S1.addObserver(new ConsoleFormatter("S1 DETECTED"));
c_S2.addObserver(new ConsoleFormatter("S2 DETECTED"));
c_S3.addObserver(new ConsoleFormatter("S3 DETECTED"));
c_S4.addObserver(new ConsoleFormatter("S4 DETECTED"));
c_S5.addObserver(new ConsoleFormatter("S5 DETECTED"));
c_S6.addObserver(new ConsoleFormatter("S6 DETECTED"));
c_S7.addObserver(new ConsoleFormatter("S7 DETECTED"));
c_S8.addObserver(new ConsoleFormatter("S8 DETECTED"));
c_S9.addObserver(new ConsoleFormatter("S9 DETECTED"));
c_S10.addObserver(new ConsoleFormatter("S10 DETECTED"));
c_S11.addObserver(new ConsoleFormatter("S11 DETECTED"));
c_S12.addObserver(new ConsoleFormatter("S12 DETECTED"));
c_S13.addObserver(new ConsoleFormatter("S13 DETECTED"));
c_S14.addObserver(new ConsoleFormatter("S14 DETECTED"));
//Start streaming data
Stream_C_Wtemp_Thread.start();
Stream_TG_temp_Thread.start();
Stream_G_temp_Thread.start();
Stream_P_temp_Thread.start();
Stream_E_temp_Thread.start();
Stream_PowerOutput_Thread.start();
Stream_G_current_Thread.start();
Stream_C_temp_Thread.start();
Stream_T_temp_Thread.start();
Stream_OilTemp_Thread.start();
Stream_GB_temp_Thread.start();
Stream_G_speed_Thread.start();
Stream_Conv_temp_Thread.start();
Stream_R_speed_Thread.start();
Stream_R_Pangle_Thread.start();
//engine.updateReasoner(c.getSparqlQueryId(),
//CsparqlUtils.fileToString("examples_files/rdfs.rules"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment