diff --git a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java index 2052a8c..7136a61 100644 --- a/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqlproject/rentacar/RentACarSimulation.java @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; import eu.larkc.csparql.cep.api.RdfQuadruple; 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.misc.QueryContainer; 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() { String query = "REGISTER QUERY getCarStatusEvents AS " + "PREFIX rdf: " @@ -238,6 +252,7 @@ public class RentACarSimulation implements Runnable { + " }" + "} "; QueryContainer queryContainer = new QueryContainer("getAverageSpeedByCar", query, true); + RentACarSimulation.setUpReasoningOnQueryContainer(queryContainer); return queryContainer; }