[TASK] Add NOTA pattern.
This commit is contained in:
parent
de2d6fa64a
commit
48e01f493f
@ -71,7 +71,7 @@ public class Main {
|
|||||||
testGeneratorThread.start();
|
testGeneratorThread.start();
|
||||||
|
|
||||||
// Now build a query to run - interchangeable
|
// Now build a query to run - interchangeable
|
||||||
String query = Main.getTestPatternQuery();
|
String query = Main.getNOTA();
|
||||||
//String query = RentACarSimulation.getEventUsingBackgroundKnowledge();
|
//String query = RentACarSimulation.getEventUsingBackgroundKnowledge();
|
||||||
|
|
||||||
// Create a result proxy by registering the query at the engine
|
// Create a result proxy by registering the query at the engine
|
||||||
@ -135,6 +135,54 @@ public class Main {
|
|||||||
+ "}";
|
+ "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* WHERE {
|
||||||
|
OPTIONAL {
|
||||||
|
?eventA rdf:type <http://example.org/type/A> .
|
||||||
|
}
|
||||||
|
OPTIONAL {
|
||||||
|
?eventB rdf:type <http://example.org/type/B> .
|
||||||
|
}
|
||||||
|
FILTER((BOUND(?eventA) || BOUND(?eventB))
|
||||||
|
&& NOT (BOUND(?eventA) && BOUND(?eventB)))
|
||||||
|
}
|
||||||
|
* */
|
||||||
|
private static String getAXORB() {
|
||||||
|
return "REGISTER QUERY matchAXORB AS "
|
||||||
|
+ "PREFIX f: <http://larkc.eu/csparql/sparql/jena/ext#> "
|
||||||
|
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
||||||
|
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
|
||||||
|
+ "SELECT ?atype ?btype "
|
||||||
|
+ "FROM STREAM <http://example.org> [RANGE 5s STEP 1s] "
|
||||||
|
+ "WHERE { "
|
||||||
|
+ " OPTIONAL { "
|
||||||
|
+ " ?a a <http://example.org/type/A> . "
|
||||||
|
+ " ?a a ?atype . "
|
||||||
|
+ " } "
|
||||||
|
+ " OPTIONAL { "
|
||||||
|
+ " ?b a <http://example.org/type/B> . "
|
||||||
|
+ " ?b a ?btype . "
|
||||||
|
+ " } "
|
||||||
|
+ " FILTER( (BOUND(?a) || BOUND(?b)) && !(BOUND(?a) && BOUND(?b)) ) "
|
||||||
|
+ "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getNOTA() {
|
||||||
|
return "REGISTER QUERY matchNOTA AS "
|
||||||
|
+ "PREFIX f: <http://larkc.eu/csparql/sparql/jena/ext#> "
|
||||||
|
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
||||||
|
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
|
||||||
|
+ "SELECT ?anyEventType "
|
||||||
|
+ "FROM STREAM <http://example.org> [RANGE 5s STEP 1s] "
|
||||||
|
+ "WHERE { "
|
||||||
|
+ " ?anyEvent a ?anyEventType . "
|
||||||
|
+ " OPTIONAL { "
|
||||||
|
+ " ?eventA a <http://example.org/type/A> . "
|
||||||
|
+ " } "
|
||||||
|
+ " FILTER(!BOUND(?eventA)) "
|
||||||
|
+ "}";
|
||||||
|
}
|
||||||
|
|
||||||
private static String getTestPatternQuery() {
|
private static String getTestPatternQuery() {
|
||||||
return "REGISTER QUERY matchANotBC AS "
|
return "REGISTER QUERY matchANotBC AS "
|
||||||
+ "PREFIX f: <http://larkc.eu/csparql/sparql/jena/ext#> "
|
+ "PREFIX f: <http://larkc.eu/csparql/sparql/jena/ext#> "
|
||||||
|
@ -37,7 +37,7 @@ public class TestStreamGenerator extends RdfStream implements Runnable {
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user