[TASK] Create static method to specifically set up reaoning on simulation related QueryContainer.
This commit is contained in:
parent
28afcb4b7f
commit
038a6a85bc
|
@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.larkc.csparql.cep.api.RdfQuadruple;
|
import eu.larkc.csparql.cep.api.RdfQuadruple;
|
||||||
import eu.larkc.csparql.cep.api.RdfStream;
|
import eu.larkc.csparql.cep.api.RdfStream;
|
||||||
|
import eu.larkc.csparql.common.utils.CsparqlUtils;
|
||||||
|
import eu.larkc.csparql.common.utils.ReasonerChainingType;
|
||||||
import lu.jpt.csparqlproject.Main;
|
import lu.jpt.csparqlproject.Main;
|
||||||
import lu.jpt.csparqlproject.misc.QueryContainer;
|
import lu.jpt.csparqlproject.misc.QueryContainer;
|
||||||
import lu.jpt.csparqlproject.util.WindowLoggingRdfStream;
|
import lu.jpt.csparqlproject.util.WindowLoggingRdfStream;
|
||||||
|
@ -147,6 +149,18 @@ public class RentACarSimulation implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void setUpReasoningOnQueryContainer(QueryContainer queryContainer) {
|
||||||
|
try {
|
||||||
|
queryContainer.enableReasoning(
|
||||||
|
CsparqlUtils.fileToString("data/rdfs.rules"),
|
||||||
|
CsparqlUtils.serializeRDFFile("data/carSimulationTBox.rdf"),
|
||||||
|
ReasonerChainingType.HYBRID
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
RentACarSimulation.logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static QueryContainer getEventsQuery() {
|
public static QueryContainer getEventsQuery() {
|
||||||
String query = "REGISTER QUERY getCarStatusEvents AS "
|
String query = "REGISTER QUERY getCarStatusEvents AS "
|
||||||
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
||||||
|
@ -238,6 +252,7 @@ public class RentACarSimulation implements Runnable {
|
||||||
+ " }"
|
+ " }"
|
||||||
+ "} ";
|
+ "} ";
|
||||||
QueryContainer queryContainer = new QueryContainer("getAverageSpeedByCar", query, true);
|
QueryContainer queryContainer = new QueryContainer("getAverageSpeedByCar", query, true);
|
||||||
|
RentACarSimulation.setUpReasoningOnQueryContainer(queryContainer);
|
||||||
return queryContainer;
|
return queryContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue