diff --git a/src/main/java/lu/jpt/csparqltest/Main.java b/src/main/java/lu/jpt/csparqltest/Main.java index d48d8a3..e2a7007 100644 --- a/src/main/java/lu/jpt/csparqltest/Main.java +++ b/src/main/java/lu/jpt/csparqltest/Main.java @@ -71,7 +71,7 @@ public class Main { testGeneratorThread.start(); // Now build a query to run - interchangeable - String query = Main.getTestPatternQuery(); + String query = Main.getNOTA(); //String query = RentACarSimulation.getEventUsingBackgroundKnowledge(); // Create a result proxy by registering the query at the engine @@ -135,6 +135,54 @@ public class Main { + "}"; } + /* + * WHERE { + OPTIONAL { + ?eventA rdf:type . + } + OPTIONAL { + ?eventB rdf:type . + } + FILTER((BOUND(?eventA) || BOUND(?eventB)) + && NOT (BOUND(?eventA) && BOUND(?eventB))) + } + * */ + private static String getAXORB() { + return "REGISTER QUERY matchAXORB AS " + + "PREFIX f: " + + "PREFIX rdf: " + + "PREFIX xsd: " + + "SELECT ?atype ?btype " + + "FROM STREAM [RANGE 5s STEP 1s] " + + "WHERE { " + + " OPTIONAL { " + + " ?a a . " + + " ?a a ?atype . " + + " } " + + " OPTIONAL { " + + " ?b a . " + + " ?b a ?btype . " + + " } " + + " FILTER( (BOUND(?a) || BOUND(?b)) && !(BOUND(?a) && BOUND(?b)) ) " + + "}"; + } + + private static String getNOTA() { + return "REGISTER QUERY matchNOTA AS " + + "PREFIX f: " + + "PREFIX rdf: " + + "PREFIX xsd: " + + "SELECT ?anyEventType " + + "FROM STREAM [RANGE 5s STEP 1s] " + + "WHERE { " + + " ?anyEvent a ?anyEventType . " + + " OPTIONAL { " + + " ?eventA a . " + + " } " + + " FILTER(!BOUND(?eventA)) " + + "}"; + } + private static String getTestPatternQuery() { return "REGISTER QUERY matchANotBC AS " + "PREFIX f: " diff --git a/src/main/java/lu/jpt/csparqltest/util/TestStreamGenerator.java b/src/main/java/lu/jpt/csparqltest/util/TestStreamGenerator.java index ca2f3cb..d6c0472 100644 --- a/src/main/java/lu/jpt/csparqltest/util/TestStreamGenerator.java +++ b/src/main/java/lu/jpt/csparqltest/util/TestStreamGenerator.java @@ -37,7 +37,7 @@ public class TestStreamGenerator extends RdfStream implements Runnable { ); try { - Thread.sleep(100); + Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }