diff --git a/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/ReactKnowledgeInteraction.java b/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/ReactKnowledgeInteraction.java index e062217c..312bb412 100644 --- a/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/ReactKnowledgeInteraction.java +++ b/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/ReactKnowledgeInteraction.java @@ -41,18 +41,18 @@ public ReactKnowledgeInteraction(CommunicativeAct act, GraphPattern argument, Gr } public ReactKnowledgeInteraction(CommunicativeAct act, GraphPattern argument, GraphPattern result, - boolean anIsFullMatch) { - this(act, argument, result, null, false, anIsFullMatch, null); + boolean anIncludeMetaKIs) { + this(act, argument, result, null, false, anIncludeMetaKIs, null); } public ReactKnowledgeInteraction(CommunicativeAct act, GraphPattern argument, GraphPattern result, boolean anIsMeta, - boolean anIsFullMatch) { - this(act, argument, result, null, anIsMeta, anIsFullMatch, null); + boolean anIncludeMetaKIs) { + this(act, argument, result, null, anIsMeta, anIncludeMetaKIs, null); } public ReactKnowledgeInteraction(CommunicativeAct act, GraphPattern argument, GraphPattern result, String name, - boolean anIsMeta, boolean anIsFullMatch, MatchStrategy aMatchStrategy) { - super(act, name, anIsMeta, anIsFullMatch, false, aMatchStrategy); + boolean anIsMeta, boolean anIncludeMetaKIs, MatchStrategy aMatchStrategy) { + super(act, name, anIsMeta, anIncludeMetaKIs, false, aMatchStrategy); this.argument = argument; this.result = result; } diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerReactWithGapsEnabled.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerReactWithGapsEnabled.java index 48be7d47..7a57de4a 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerReactWithGapsEnabled.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerReactWithGapsEnabled.java @@ -8,6 +8,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map; +import java.util.concurrent.CountDownLatch; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -34,7 +35,7 @@ public void setUpServer() { } @Test - public void testAskAnswerReactWithGaps() throws IOException { + public void testAskAnswerReactWithGaps() throws IOException, InterruptedException { // In this test there will be an Ask KB with an AskKI with 2 triplepatterns, // an AnswerKB with a single AnswerKI that answers only the first triplepattern @@ -46,6 +47,10 @@ public void testAskAnswerReactWithGaps() throws IOException { URL url = new URL("http://localhost:" + PORT + "/rest"); + // sync between threads to make sure the ask is not activated before the others + // are ready. + CountDownLatch KBReady = new CountDownLatch(2); + // activate the answer SC, KB, KI in a separate thread var answeringSc = new AsyncTester(new Runnable() { @Override @@ -70,6 +75,8 @@ public void run() { "Content-Type", "application/json", "Accept", "*/*")); registerAnswerKi.expectStatus(200); + KBReady.countDown(); + // get the handle for the answerKB to see if there are requests to be handled var test = new HttpTester(new URL(url.toString() + "/sc/handle"), "GET", null, Map .of("Knowledge-Base-Id", answerKBId, "Content-Type", "application/json", "Accept", "*/*")); @@ -128,6 +135,8 @@ public void run() { "Content-Type", "application/json", "Accept", "*/*")); registerReactKi.expectStatus(200); + KBReady.countDown(); + System.out.println("Getting the handle for the reactKBId"); // get the handle for the reactKB to see if there are requests to be handled => // NOTE: it should never exit/return this handle for this test @@ -161,6 +170,8 @@ public void run() { }); reactingSc.start(); + KBReady.await(); + // register the AskKB HttpTester registerKb = new HttpTester(new URL(url + "/sc"), "POST", "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerEnabled\" : true}",