diff --git a/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java b/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java index 8fffe533..1f753a2a 100644 --- a/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java +++ b/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java @@ -16,7 +16,7 @@ * Knowledge Bases within the network and also provides REST APIs to access the * same information including relations between knowledge bases. */ -public class AdminUI extends MetaKB { +public class AdminUI extends MetadataKB { private static final Logger LOG = LoggerFactory.getLogger(AdminUI.class); diff --git a/admin-ui/src/main/java/eu/knowledge/engine/admin/MetaKB.java b/admin-ui/src/main/java/eu/knowledge/engine/admin/MetadataKB.java similarity index 97% rename from admin-ui/src/main/java/eu/knowledge/engine/admin/MetaKB.java rename to admin-ui/src/main/java/eu/knowledge/engine/admin/MetadataKB.java index 86159491..d2025691 100644 --- a/admin-ui/src/main/java/eu/knowledge/engine/admin/MetaKB.java +++ b/admin-ui/src/main/java/eu/knowledge/engine/admin/MetadataKB.java @@ -24,7 +24,7 @@ import eu.knowledge.engine.smartconnector.api.ReactExchangeInfo; import eu.knowledge.engine.smartconnector.api.ReactKnowledgeInteraction; import eu.knowledge.engine.smartconnector.api.Vocab; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; /** * Knowledge Base that keeps track of all other KBs in the network. It does this @@ -35,9 +35,9 @@ * interactions. * */ -public class MetaKB extends MockedKnowledgeBase { +public class MetadataKB extends EasyKnowledgeBase { - private static final Logger LOG = LoggerFactory.getLogger(MetaKB.class); + private static final Logger LOG = LoggerFactory.getLogger(MetadataKB.class); private static final String META_GRAPH_PATTERN_STR = "?kb rdf:type ke:KnowledgeBase . ?kb ke:hasName ?name . ?kb ke:hasDescription ?description . ?kb ke:hasKnowledgeInteraction ?ki . ?ki rdf:type ?kiType . ?ki ke:isMeta ?isMeta . ?ki ke:hasCommunicativeAct ?act . ?act rdf:type ke:CommunicativeAct . ?act ke:hasRequirement ?req . ?act ke:hasSatisfaction ?sat . ?req rdf:type ?reqType . ?sat rdf:type ?satType . ?ki ke:hasGraphPattern ?gp . ?gp rdf:type ?patternType . ?gp ke:hasPattern ?pattern ."; @@ -62,7 +62,7 @@ public class MetaKB extends MockedKnowledgeBase { * Intialize a AdminUI that regularly retrieves and prints metadata about the * available knowledge bases. */ - public MetaKB(String id, String name, String description) { + public MetadataKB(String id, String name, String description) { super(id, name, description); readyPhaser = new Phaser(0); this.setPhaser(this.readyPhaser); diff --git a/admin-ui/src/main/java/eu/knowledge/engine/admin/api/impl/AdminApiServiceImpl.java b/admin-ui/src/main/java/eu/knowledge/engine/admin/api/impl/AdminApiServiceImpl.java index 55b9697a..0bc866ae 100644 --- a/admin-ui/src/main/java/eu/knowledge/engine/admin/api/impl/AdminApiServiceImpl.java +++ b/admin-ui/src/main/java/eu/knowledge/engine/admin/api/impl/AdminApiServiceImpl.java @@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.admin.AdminUI; -import eu.knowledge.engine.admin.MetaKB; +import eu.knowledge.engine.admin.MetadataKB; import eu.knowledge.engine.admin.Util; import eu.knowledge.engine.admin.model.AnswerKnowledgeInteraction; import eu.knowledge.engine.admin.model.AskKnowledgeInteraction; diff --git a/admin-ui/src/test/java/eu/knowledge/engine/admin/api/TestApiRoutes.java b/admin-ui/src/test/java/eu/knowledge/engine/admin/api/TestApiRoutes.java index 9632c422..4bc9c523 100644 --- a/admin-ui/src/test/java/eu/knowledge/engine/admin/api/TestApiRoutes.java +++ b/admin-ui/src/test/java/eu/knowledge/engine/admin/api/TestApiRoutes.java @@ -31,7 +31,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import eu.knowledge.engine.admin.AdminUI; -import eu.knowledge.engine.admin.MetaKB; +import eu.knowledge.engine.admin.MetadataKB; import eu.knowledge.engine.smartconnector.api.AnswerHandler; import eu.knowledge.engine.smartconnector.api.AnswerKnowledgeInteraction; import eu.knowledge.engine.smartconnector.api.AskKnowledgeInteraction; @@ -40,15 +40,15 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.api.SmartConnector; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestApiRoutes { private Thread thread; private static final Logger LOG = LoggerFactory.getLogger(TestApiRoutes.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; private static AdminUI admin; private HttpClient httpClient; @@ -253,7 +253,7 @@ public void startKbs() throws InterruptedException { int wait = 2; final CountDownLatch kb2ReceivedData = new CountDownLatch(1); - kb1 = new MockedKnowledgeBase("kb1") { + kb1 = new EasyKnowledgeBase("kb1") { @Override public void smartConnectorReady(SmartConnector aSC) { LOG.info("smartConnector of {} ready.", this.name); @@ -280,7 +280,7 @@ public void smartConnectorReady(SmartConnector aSC) { // todo: ask/poll if ready instead of waiting Thread.sleep(5000); kb2 = null; - kb2 = new MockedKnowledgeBase("kb2") { + kb2 = new EasyKnowledgeBase("kb2") { @Override public void smartConnectorReady(SmartConnector aSC) { LOG.info("smartConnector of {} ready.", this.name); @@ -305,7 +305,7 @@ public void stopKbs() { stopKb(kb2); } - public void stopKb(MockedKnowledgeBase aKb) { + public void stopKb(EasyKnowledgeBase aKb) { if (aKb != null) { aKb.stop(); } diff --git a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/MockedKnowledgeBase.java b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/EasyKnowledgeBase.java similarity index 97% rename from smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/MockedKnowledgeBase.java rename to smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/EasyKnowledgeBase.java index 735ca417..bf9dc92f 100644 --- a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/MockedKnowledgeBase.java +++ b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/EasyKnowledgeBase.java @@ -46,9 +46,9 @@ import eu.knowledge.engine.smartconnector.impl.SmartConnectorBuilder; import eu.knowledge.engine.smartconnector.impl.Util; -public class MockedKnowledgeBase implements KnowledgeBase { +public class EasyKnowledgeBase implements KnowledgeBase { - private static final Logger LOG = LoggerFactory.getLogger(MockedKnowledgeBase.class); + private static final Logger LOG = LoggerFactory.getLogger(EasyKnowledgeBase.class); private final Set registeredAskKIs; private final Map registeredAnswerKIs; @@ -86,11 +86,11 @@ public class MockedKnowledgeBase implements KnowledgeBase { */ private boolean isThreadSafe = false; - public MockedKnowledgeBase(String aName) { + public EasyKnowledgeBase(String aName) { this(null, aName, null); } - public MockedKnowledgeBase(String anId, String aName, String aDescription) { + public EasyKnowledgeBase(String anId, String aName, String aDescription) { assert aName != null; @@ -291,7 +291,7 @@ public Map getReactKnowledgeInteraction } public boolean isUpToDate(AskKnowledgeInteraction askKnowledgeInteraction, - Set someKnowledgeBases) { + Set someKnowledgeBases) { boolean isUpToDate = true; @@ -306,7 +306,7 @@ public boolean isUpToDate(AskKnowledgeInteraction askKnowledgeInteraction, // m.write(System.out, "turtle"); // System.out.println("-----------------------"); - for (MockedKnowledgeBase aKnowledgeBase : someKnowledgeBases) { + for (EasyKnowledgeBase aKnowledgeBase : someKnowledgeBases) { if (!this.getKnowledgeBaseId().toString().equals(aKnowledgeBase.getKnowledgeBaseId().toString())) { isUpToDate &= isKnowledgeBaseUpToDate(aKnowledgeBase, m); } @@ -320,7 +320,7 @@ public boolean isUpToDate(AskKnowledgeInteraction askKnowledgeInteraction, } - private boolean isKnowledgeBaseUpToDate(MockedKnowledgeBase aMockedKB, Model aModel) { + private boolean isKnowledgeBaseUpToDate(EasyKnowledgeBase aMockedKB, Model aModel) { boolean isSame = true; Resource kb = ResourceFactory.createResource(aMockedKB.getKnowledgeBaseId().toString()); diff --git a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeNetwork.java b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeNetwork.java index 810dd1bd..d10f6494 100644 --- a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeNetwork.java +++ b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeNetwork.java @@ -30,8 +30,8 @@ public class KnowledgeNetwork { * ready, Phase 2 = everybody is aware of everybody. */ private Phaser readyPhaser; - private Set knowledgeBases; - private Map knowledgeInteractionMetadata; + private Set knowledgeBases; + private Map knowledgeInteractionMetadata; private PrefixMapping prefixMapping; public KnowledgeNetwork() { @@ -43,7 +43,7 @@ public KnowledgeNetwork() { this.prefixMapping.setNsPrefix("kb", Vocab.ONTO_URI); } - public void addKB(MockedKnowledgeBase aKB) { + public void addKB(EasyKnowledgeBase aKB) { aKB.setPhaser(this.readyPhaser); knowledgeBases.add(aKB); } @@ -59,9 +59,9 @@ public void sync() { */ private void startAndWaitForReady() { - Set justStartedKBs = new HashSet<>(); + Set justStartedKBs = new HashSet<>(); - for (MockedKnowledgeBase kb : this.knowledgeBases) { + for (EasyKnowledgeBase kb : this.knowledgeBases) { if (!kb.isStarted()) { kb.start(); justStartedKBs.add(kb); @@ -87,14 +87,14 @@ private void startAndWaitForReady() { // @formatter:on ); - for (MockedKnowledgeBase kb : justStartedKBs) { + for (EasyKnowledgeBase kb : justStartedKBs) { AskKnowledgeInteraction anAskKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp, null, false, true, false, MatchStrategy.ENTRY_LEVEL); this.knowledgeInteractionMetadata.put(kb, anAskKI); kb.register(anAskKI); } - for (MockedKnowledgeBase kb : this.knowledgeBases) { + for (EasyKnowledgeBase kb : this.knowledgeBases) { kb.syncKIs(); } } @@ -110,9 +110,9 @@ private void waitForUpToDate() { count++; LOG.info("Checking up to date knowledge bases."); allUpToDate = true; - Map upToDate = new HashMap<>(); + Map upToDate = new HashMap<>(); boolean kbUpToDate; - for (MockedKnowledgeBase kb : this.knowledgeBases) { + for (EasyKnowledgeBase kb : this.knowledgeBases) { kbUpToDate = kb.isUpToDate(this.knowledgeInteractionMetadata.get(kb), this.knowledgeBases); allUpToDate &= kbUpToDate; upToDate.put(kb, kbUpToDate); @@ -130,11 +130,11 @@ private void waitForUpToDate() { LOG.info("Everyone is up to date after {} rounds!", count); } - private String getUpToDateInfo(Map upToDate) { + private String getUpToDateInfo(Map upToDate) { StringBuilder sb = new StringBuilder(); sb.append("("); - for (Map.Entry entry : upToDate.entrySet()) { + for (Map.Entry entry : upToDate.entrySet()) { sb.append(entry.getKey().getKnowledgeBaseName()).append("=").append(entry.getValue()); sb.append(","); } diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/AdditionForAudienceTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/AdditionForAudienceTest.java index ca0192c2..acdd8fe6 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/AdditionForAudienceTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/AdditionForAudienceTest.java @@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @Tag("Long") public class AdditionForAudienceTest { @@ -72,12 +72,12 @@ public BindingSet react(ReactKnowledgeInteraction anRKI, ReactExchangeInfo aReac } }; - MockedKnowledgeBase kb1; - MockedKnowledgeBase kb10; - MockedKnowledgeBase kb100; - MockedKnowledgeBase kbSum; - MockedKnowledgeBase kbNum; - MockedKnowledgeBase kbRule; + EasyKnowledgeBase kb1; + EasyKnowledgeBase kb10; + EasyKnowledgeBase kb100; + EasyKnowledgeBase kbSum; + EasyKnowledgeBase kbNum; + EasyKnowledgeBase kbRule; private AskKnowledgeInteraction askKI; private static KnowledgeNetwork kn; @@ -86,7 +86,7 @@ public void beforeAll() { kn = new KnowledgeNetwork(); // kb1 - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); @@ -97,7 +97,7 @@ public void beforeAll() { kb1.register(reactKI, new MyReactHandler(1)); // kb10 - kb10 = new MockedKnowledgeBase("kb10"); + kb10 = new EasyKnowledgeBase("kb10"); kb10.setReasonerEnabled(true); kn.addKB(kb10); reactKI = new ReactKnowledgeInteraction(new CommunicativeAct(), new GraphPattern( @@ -106,7 +106,7 @@ public void beforeAll() { "?e ?n3 . ?n3 . ?n3 ?d3 . ?d3 \"2\" . ?d3 ?ad3 . ?d3 ?o .")); kb10.register(reactKI, new MyReactHandler(2)); - kb100 = new MockedKnowledgeBase("kb100"); + kb100 = new EasyKnowledgeBase("kb100"); kb100.setReasonerEnabled(true); kn.addKB(kb100); reactKI = new ReactKnowledgeInteraction(new CommunicativeAct(), new GraphPattern( @@ -115,7 +115,7 @@ public void beforeAll() { "?e ?n3 . ?n3 . ?n3 ?d3 . ?d3 \"3\" . ?d3 ?ad3 . ?d3 ?o .")); kb100.register(reactKI, new MyReactHandler(3)); - kbSum = new MockedKnowledgeBase("kbSum"); + kbSum = new EasyKnowledgeBase("kbSum"); kbSum.setReasonerEnabled(true); kn.addKB(kbSum); @@ -187,7 +187,7 @@ public void beforeAll() { return bs; }); - kbNum = new MockedKnowledgeBase("kbNum"); + kbNum = new EasyKnowledgeBase("kbNum"); kbNum.setReasonerEnabled(true); kn.addKB(kbNum); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/GeneralizeIfNecessaryTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/GeneralizeIfNecessaryTest.java index a899e9e8..89efcb6d 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/GeneralizeIfNecessaryTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/GeneralizeIfNecessaryTest.java @@ -16,7 +16,7 @@ import eu.knowledge.engine.reasoner.Rule; import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; /** * This test tries to illustrate generalize if necessary. We instantiate @@ -36,10 +36,10 @@ public class GeneralizeIfNecessaryTest { private static final Logger LOG = LoggerFactory.getLogger(GeneralizeIfNecessaryTest.class); private static KnowledgeNetwork kn = new KnowledgeNetwork(); - private MockedKnowledgeBase appKb = new MockedKnowledgeBase("AppKB"); - private MockedKnowledgeBase sensor1Kb = new MockedKnowledgeBase("Sensor1KB"); - private MockedKnowledgeBase sensor2Kb = new MockedKnowledgeBase("Sensor2KB"); - private MockedKnowledgeBase floorplanKb = new MockedKnowledgeBase("FloorplanKB"); + private EasyKnowledgeBase appKb = new EasyKnowledgeBase("AppKB"); + private EasyKnowledgeBase sensor1Kb = new EasyKnowledgeBase("Sensor1KB"); + private EasyKnowledgeBase sensor2Kb = new EasyKnowledgeBase("Sensor2KB"); + private EasyKnowledgeBase floorplanKb = new EasyKnowledgeBase("FloorplanKB"); private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "http://example.org/").setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/MultiThreadingPerformanceTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/MultiThreadingPerformanceTest.java index 338a9e76..a59f23f7 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/MultiThreadingPerformanceTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/MultiThreadingPerformanceTest.java @@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; /** * This test tries to balance the number of threads posting to a single KB to @@ -82,8 +82,8 @@ public void run() { private Queue timings = new ConcurrentLinkedQueue(); private KnowledgeNetwork kn = null; - private MockedKnowledgeBase poster = null; - private MockedKnowledgeBase reacter = null; + private EasyKnowledgeBase poster = null; + private EasyKnowledgeBase reacter = null; private PostKnowledgeInteraction postKI = null; private ReactKnowledgeInteraction reactKI = null; @@ -151,10 +151,10 @@ public void run() { public void test() throws InterruptedException { kn = new KnowledgeNetwork(); - poster = new MockedKnowledgeBase("poster"); + poster = new EasyKnowledgeBase("poster"); poster.setIsThreadSafe(true); kn.addKB(poster); - reacter = new MockedKnowledgeBase("reacter"); + reacter = new EasyKnowledgeBase("reacter"); reacter.setIsThreadSafe(true); kn.addKB(reacter); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/NotDesignedToWorkTogetherTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/NotDesignedToWorkTogetherTest.java index c26a2738..7c506a43 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/NotDesignedToWorkTogetherTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/NotDesignedToWorkTogetherTest.java @@ -19,7 +19,7 @@ import eu.knowledge.engine.reasoner.Rule; import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; /** * This test tries to illustrate forward compatibility. We instantiate an @@ -37,9 +37,9 @@ public class NotDesignedToWorkTogetherTest { private static final Logger LOG = LoggerFactory.getLogger(NotDesignedToWorkTogetherTest.class); private static KnowledgeNetwork kn = new KnowledgeNetwork(); - private MockedKnowledgeBase appKb = new MockedKnowledgeBase("AppKB"); - private MockedKnowledgeBase lamp1Kb = new MockedKnowledgeBase("Lamp1KB"); - private MockedKnowledgeBase lamp2Kb = new MockedKnowledgeBase("Lamp2KB"); + private EasyKnowledgeBase appKb = new EasyKnowledgeBase("AppKB"); + private EasyKnowledgeBase lamp1Kb = new EasyKnowledgeBase("Lamp1KB"); + private EasyKnowledgeBase lamp2Kb = new EasyKnowledgeBase("Lamp2KB"); private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "http://example.org/") .setNsPrefix("time", "https://www.w3.org/TR/owl-time/") .setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/SingleLargeVsMultipleSmallGraphPatternTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/SingleLargeVsMultipleSmallGraphPatternTest.java index ee705c47..734e7b46 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/SingleLargeVsMultipleSmallGraphPatternTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/SingleLargeVsMultipleSmallGraphPatternTest.java @@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; /** * What is faster: @@ -37,10 +37,10 @@ public class SingleLargeVsMultipleSmallGraphPatternTest { public void testSingleLargeGP() throws InterruptedException, ExecutionException { // creating SCs - MockedKnowledgeBase kb1 = new MockedKnowledgeBase("KB1"); + EasyKnowledgeBase kb1 = new EasyKnowledgeBase("KB1"); kn1.addKB(kb1); kb1.setReasonerEnabled(true); - MockedKnowledgeBase kb2 = new MockedKnowledgeBase("KB2"); + EasyKnowledgeBase kb2 = new EasyKnowledgeBase("KB2"); kn1.addKB(kb2); kb2.setReasonerEnabled(true); @@ -95,10 +95,10 @@ public void testSingleLargeGP() throws InterruptedException, ExecutionException public void testMultipleSmallGPs() throws InterruptedException, ExecutionException { // creating SCs - MockedKnowledgeBase kb1 = new MockedKnowledgeBase("KB1"); + EasyKnowledgeBase kb1 = new EasyKnowledgeBase("KB1"); kn2.addKB(kb1); kb1.setReasonerEnabled(true); - MockedKnowledgeBase kb2 = new MockedKnowledgeBase("KB2"); + EasyKnowledgeBase kb2 = new EasyKnowledgeBase("KB2"); kn2.addKB(kb2); kb2.setReasonerEnabled(true); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer.java index a04a1ffe..248be3ce 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer.java @@ -24,14 +24,14 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswer { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswer.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -45,9 +45,9 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); LOG.info("Waiting for ready..."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer2.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer2.java index 810ae36f..a0a333b9 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer2.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer2.java @@ -19,14 +19,14 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswer2 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswer2.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -40,9 +40,9 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); LOG.info("Waiting for ready..."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer3.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer3.java index 0e31fc45..5c3657fa 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer3.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer3.java @@ -31,16 +31,16 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswer3 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswer3.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; - private static MockedKnowledgeBase kb4; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; + private static EasyKnowledgeBase kb4; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -54,13 +54,13 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); - kb4 = new MockedKnowledgeBase("kb4"); + kb4 = new EasyKnowledgeBase("kb4"); kn.addKB(kb4); GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer4.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer4.java index 36cdd3ca..b9f37b14 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer4.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer4.java @@ -19,14 +19,14 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswer4 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswer4.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -40,10 +40,10 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kb1.setReasonerEnabled(true); kn.addKB(kb2); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer5.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer5.java index 50fc0d9d..b0fffa7f 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer5.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswer5.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswer5 { @@ -42,16 +42,16 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); this.kn = new KnowledgeNetwork(); - MockedKnowledgeBase kb1 = new MockedKnowledgeBase("kb1"); + EasyKnowledgeBase kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); - MockedKnowledgeBase kb2 = new MockedKnowledgeBase("kb2"); + EasyKnowledgeBase kb2 = new EasyKnowledgeBase("kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); - MockedKnowledgeBase kb3 = new MockedKnowledgeBase("kb3"); + EasyKnowledgeBase kb3 = new EasyKnowledgeBase("kb3"); kb3.setReasonerEnabled(true); kn.addKB(kb3); - MockedKnowledgeBase kb4 = new MockedKnowledgeBase("kb4"); + EasyKnowledgeBase kb4 = new EasyKnowledgeBase("kb4"); kb4.setReasonerEnabled(true); kn.addKB(kb4); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerBindingValidity.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerBindingValidity.java index f50ddc28..302e3f99 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerBindingValidity.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerBindingValidity.java @@ -18,14 +18,14 @@ import eu.knowledge.engine.smartconnector.api.ExchangeInfo.Status; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerBindingValidity { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerBindingValidity.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @Test public void testAskAnswerInvalidOutgoingBindings() throws InterruptedException { @@ -35,9 +35,9 @@ public void testAskAnswerInvalidOutgoingBindings() throws InterruptedException { prefixes.setNsPrefix("ex", "https://example.org/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); final AtomicBoolean wasInAnswerHandler = new AtomicBoolean(false); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerManyKIs.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerManyKIs.java index 669fe004..843b924f 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerManyKIs.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerManyKIs.java @@ -24,17 +24,17 @@ import org.slf4j.helpers.MessageFormatter; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @Tag("Long") public class TestAskAnswerManyKIs { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerManyKIs.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; - private static MockedKnowledgeBase kb4; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; + private static EasyKnowledgeBase kb4; private String pattern = "?{} ?{}."; @@ -50,13 +50,13 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); - kb4 = new MockedKnowledgeBase("kb4"); + kb4 = new EasyKnowledgeBase("kb4"); kn.addKB(kb4); int count = 50; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerRealistic.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerRealistic.java index 735fe386..cfa6d2a5 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerRealistic.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerRealistic.java @@ -23,23 +23,23 @@ import eu.knowledge.engine.reasoner.Rule; import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @Disabled public class TestAskAnswerRealistic { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerRealistic.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; - private static MockedKnowledgeBase kb4; - private static MockedKnowledgeBase kb5; - private static MockedKnowledgeBase kb6; - private static MockedKnowledgeBase kb7; - private static MockedKnowledgeBase kb8; - private static MockedKnowledgeBase kb9; - private static MockedKnowledgeBase kb10; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; + private static EasyKnowledgeBase kb4; + private static EasyKnowledgeBase kb5; + private static EasyKnowledgeBase kb6; + private static EasyKnowledgeBase kb7; + private static EasyKnowledgeBase kb8; + private static EasyKnowledgeBase kb9; + private static EasyKnowledgeBase kb10; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -51,25 +51,25 @@ public void testAskAnswer() throws InterruptedException { var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kb2.setReasonerEnabled(true); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kb3.setReasonerEnabled(true); - kb4 = new MockedKnowledgeBase("kb4"); + kb4 = new EasyKnowledgeBase("kb4"); kb4.setReasonerEnabled(true); - kb5 = new MockedKnowledgeBase("kb5"); + kb5 = new EasyKnowledgeBase("kb5"); kb5.setReasonerEnabled(true); - kb6 = new MockedKnowledgeBase("kb6"); + kb6 = new EasyKnowledgeBase("kb6"); kb6.setReasonerEnabled(true); - kb7 = new MockedKnowledgeBase("kb7"); + kb7 = new EasyKnowledgeBase("kb7"); kb7.setReasonerEnabled(true); - kb8 = new MockedKnowledgeBase("kb8"); + kb8 = new EasyKnowledgeBase("kb8"); kb8.setReasonerEnabled(true); - kb9 = new MockedKnowledgeBase("kb9"); + kb9 = new EasyKnowledgeBase("kb9"); kb9.setReasonerEnabled(true); - kb10 = new MockedKnowledgeBase("kb10"); + kb10 = new EasyKnowledgeBase("kb10"); kb10.setReasonerEnabled(true); var rules = new HashSet(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerSingleKBMultipleMatchingKIs.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerSingleKBMultipleMatchingKIs.java index 5c3ccae4..840b1362 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerSingleKBMultipleMatchingKIs.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerSingleKBMultipleMatchingKIs.java @@ -32,14 +32,14 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerSingleKBMultipleMatchingKIs { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerSingleKBMultipleMatchingKIs.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -53,10 +53,10 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerUnregister.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerUnregister.java index 6203a18b..9b3161fd 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerUnregister.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerUnregister.java @@ -27,14 +27,14 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerUnregister { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerUnregister.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -48,9 +48,9 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled1.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled1.java index 4d850aca..97bdfd39 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled1.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled1.java @@ -21,13 +21,13 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerWithGapsEnabled1 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerWithGapsEnabled1.class); - private static MockedKnowledgeBase kbRelationAsker; + private static EasyKnowledgeBase kbRelationAsker; private static KnowledgeNetwork kn; @@ -89,7 +89,7 @@ private void setupNetwork() { public void instantiateAskRelationsKB() { // start a knowledge base with the behavior "I am interested in related people" - kbRelationAsker = new MockedKnowledgeBase("RelationAsker"); + kbRelationAsker = new EasyKnowledgeBase("RelationAsker"); kbRelationAsker.setReasonerEnabled(true); // Register an Ask pattern for relations with knowledge gaps enabled diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled2.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled2.java index 9321ee1b..9535fe57 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled2.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled2.java @@ -24,14 +24,14 @@ import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerWithGapsEnabled2 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerWithGapsEnabled2.class); - private static MockedKnowledgeBase kbRelationAsker; - private static MockedKnowledgeBase kbRelationProvider; + private static EasyKnowledgeBase kbRelationAsker; + private static EasyKnowledgeBase kbRelationProvider; private static KnowledgeNetwork kn; @@ -106,7 +106,7 @@ private void setupNetwork() { public void instantiateAskRelationsKB() { // start a knowledge base with the behavior "I am interested in related people" - kbRelationAsker = new MockedKnowledgeBase("RelationAsker"); + kbRelationAsker = new EasyKnowledgeBase("RelationAsker"); kbRelationAsker.setReasonerEnabled(true); // Register an Ask pattern for relations with knowledge gaps enabled @@ -119,7 +119,7 @@ public void instantiateAskRelationsKB() { public void instantiateAnswerRelationsKB() { // start a knowledge base with the behavior "I can supply related people" - kbRelationProvider = new MockedKnowledgeBase("RelationProvider"); + kbRelationProvider = new EasyKnowledgeBase("RelationProvider"); kbRelationProvider.setReasonerEnabled(true); // Patterns for the RelationProvider: an Answer pattern for relations diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled3.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled3.java index 17bc5c98..3a0655e6 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled3.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsEnabled3.java @@ -24,15 +24,15 @@ import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerWithGapsEnabled3 { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerWithGapsEnabled3.class); - private static MockedKnowledgeBase kbRelationAsker; - private static MockedKnowledgeBase kbRelationProvider; - private static MockedKnowledgeBase kbRelationReactor; + private static EasyKnowledgeBase kbRelationAsker; + private static EasyKnowledgeBase kbRelationProvider; + private static EasyKnowledgeBase kbRelationReactor; private static KnowledgeNetwork kn; @@ -105,7 +105,7 @@ private void setupNetwork() { public void instantiateAskRelationsKB() { // start a knowledge base with the behavior "I am interested in related people" - kbRelationAsker = new MockedKnowledgeBase("RelationAsker"); + kbRelationAsker = new EasyKnowledgeBase("RelationAsker"); kbRelationAsker.setReasonerEnabled(true); // Register an Ask pattern for relations with knowledge gaps enabled @@ -117,7 +117,7 @@ public void instantiateAskRelationsKB() { public void instantiateAnswerRelationsKB() { // start a knowledge base with the behavior "I can supply related people" - kbRelationProvider = new MockedKnowledgeBase("RelationProvider"); + kbRelationProvider = new EasyKnowledgeBase("RelationProvider"); kbRelationProvider.setReasonerEnabled(true); // Patterns for the RelationProvider: an Answer pattern for relations @@ -144,7 +144,7 @@ public void instantiateReactRelationsKB() { // start a knowledge base with the behavior "I can react to supply related people" // when I get couples of "people that live in the same house". - kbRelationReactor = new MockedKnowledgeBase("relationReactor"); + kbRelationReactor = new EasyKnowledgeBase("relationReactor"); kbRelationReactor.setReasonerEnabled(true); // Patterns for the relationReactor: an React pattern to supply relations diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsNotEnabled.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsNotEnabled.java index 2e2a334f..a2c13cd9 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsNotEnabled.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithGapsNotEnabled.java @@ -19,13 +19,13 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerWithGapsNotEnabled { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerWithGapsNotEnabled.class); - private static MockedKnowledgeBase kbRelationAsker; + private static EasyKnowledgeBase kbRelationAsker; private static KnowledgeNetwork kn; @@ -81,7 +81,7 @@ private void setupNetwork() { public void instantiateAskRelationsKB() { // start a knowledge base with the behavior "I am interested in related people" - kbRelationAsker = new MockedKnowledgeBase("RelationAsker"); + kbRelationAsker = new EasyKnowledgeBase("RelationAsker"); kbRelationAsker.setReasonerEnabled(true); // Register an Ask pattern for relations without knowledge gaps enabled diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithPartialBindings.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithPartialBindings.java index b8b0478e..6791a03f 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithPartialBindings.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerWithPartialBindings.java @@ -24,14 +24,14 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskAnswerWithPartialBindings { private static final Logger LOG = LoggerFactory.getLogger(TestAskAnswerWithPartialBindings.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; @Test public void testAskAnswer() throws InterruptedException { @@ -41,9 +41,9 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskPartialMetadata.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskPartialMetadata.java index e9e10519..073fe813 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskPartialMetadata.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskPartialMetadata.java @@ -29,15 +29,15 @@ import eu.knowledge.engine.smartconnector.api.CommunicativeAct; import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskPartialMetadata { private static final Logger LOG = LoggerFactory.getLogger(TestAskPartialMetadata.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -51,13 +51,13 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kb3.setReasonerEnabled(true); kn.addKB(kb3); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskRecipientSelector.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskRecipientSelector.java index 4961fa9c..53689f45 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskRecipientSelector.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskRecipientSelector.java @@ -33,16 +33,16 @@ import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.api.RecipientSelector; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestAskRecipientSelector { private static final Logger LOG = LoggerFactory.getLogger(TestAskRecipientSelector.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; - private static MockedKnowledgeBase kb4; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; + private static EasyKnowledgeBase kb4; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -56,13 +56,13 @@ public void testAskAnswer() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); - kb4 = new MockedKnowledgeBase("kb4"); + kb4 = new EasyKnowledgeBase("kb4"); kn.addKB(kb4); GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestComplexGraphPatternMatching.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestComplexGraphPatternMatching.java index 0fc0bf69..1b0f3c7e 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestComplexGraphPatternMatching.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestComplexGraphPatternMatching.java @@ -35,15 +35,15 @@ import eu.knowledge.engine.reasoner.api.TripleVarBindingSet; import eu.knowledge.engine.smartconnector.impl.Util; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestComplexGraphPatternMatching { private static final Logger LOG = LoggerFactory.getLogger(TestComplexGraphPatternMatching.class); - private static MockedKnowledgeBase devicesKB; - private static MockedKnowledgeBase dashboardKB; - private static MockedKnowledgeBase observationsKB; + private static EasyKnowledgeBase devicesKB; + private static EasyKnowledgeBase dashboardKB; + private static EasyKnowledgeBase observationsKB; @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { @@ -133,7 +133,7 @@ public void findMissingVars(Set gp, TripleVarBinding tvb) { private AskKnowledgeInteraction createDashboardKB(PrefixMappingMem prefixes, KnowledgeNetwork kn) { - dashboardKB = new MockedKnowledgeBase("dashboardKB"); + dashboardKB = new EasyKnowledgeBase("dashboardKB"); dashboardKB.setReasonerEnabled(true); kn.addKB(dashboardKB); @@ -269,7 +269,7 @@ public float convert(float fahrenheit) { } private void createDevicesKB(PrefixMappingMem prefixes, KnowledgeNetwork kn) { - devicesKB = new MockedKnowledgeBase("devicesKB"); + devicesKB = new EasyKnowledgeBase("devicesKB"); devicesKB.setReasonerEnabled(true); kn.addKB(devicesKB); GraphPattern gp1 = new GraphPattern(prefixes, TestUtils.convertGP(""" @@ -383,7 +383,7 @@ private void createDevicesKB(PrefixMappingMem prefixes, KnowledgeNetwork kn) { } private void createObservationsKB(PrefixMappingMem prefixes, KnowledgeNetwork kn) { - observationsKB = new MockedKnowledgeBase("observationsKB"); + observationsKB = new EasyKnowledgeBase("observationsKB"); observationsKB.setReasonerEnabled(true); kn.addKB(observationsKB); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDuplicateBindings.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDuplicateBindings.java index 07f43169..fe551586 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDuplicateBindings.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDuplicateBindings.java @@ -37,15 +37,15 @@ import eu.knowledge.engine.smartconnector.api.ReactHandler; import eu.knowledge.engine.smartconnector.api.ReactKnowledgeInteraction; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestDuplicateBindings { private static final Logger LOG = LoggerFactory.getLogger(TestDuplicateBindings.class); - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; private static KnowledgeNetwork kn; private static AnswerKnowledgeInteraction answerKI1; @@ -61,11 +61,11 @@ public class TestDuplicateBindings { @BeforeAll public static void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); PrefixMappingMem prefixes = new PrefixMappingMem(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDynamicSemanticComposition.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDynamicSemanticComposition.java index 40384a0b..caa510fd 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDynamicSemanticComposition.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestDynamicSemanticComposition.java @@ -33,17 +33,17 @@ import eu.knowledge.engine.reasoner.Rule; import eu.knowledge.engine.reasoner.api.TriplePattern; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestDynamicSemanticComposition { private static final Logger LOG = LoggerFactory.getLogger(TestDynamicSemanticComposition.class); - private MockedKnowledgeBase kbTargetObserver; - private MockedKnowledgeBase kbHVTSearcher; - private MockedKnowledgeBase kbTargetCountrySupplier; - private MockedKnowledgeBase kbTargetLanguageSupplier; - private MockedKnowledgeBase kbTargetAgeSupplier; + private EasyKnowledgeBase kbTargetObserver; + private EasyKnowledgeBase kbHVTSearcher; + private EasyKnowledgeBase kbTargetCountrySupplier; + private EasyKnowledgeBase kbTargetLanguageSupplier; + private EasyKnowledgeBase kbTargetAgeSupplier; private KnowledgeNetwork kn; @@ -186,13 +186,13 @@ private void updateNetwork(Set gaps) { instantiateTargetLanguageSupplierKB(); instantiateTargetAgeSupplierKB(); - List availableKBs = new ArrayList<>(); + List availableKBs = new ArrayList<>(); availableKBs.add(kbTargetAgeSupplier); availableKBs.add(kbTargetCountrySupplier); availableKBs.add(kbTargetLanguageSupplier); // add the first KB that fulfills the gap - kbs: for (MockedKnowledgeBase kb : availableKBs) { + kbs: for (EasyKnowledgeBase kb : availableKBs) { for (ReactKnowledgeInteraction ki : kb.getReactKnowledgeInteractions().keySet()) { @@ -244,7 +244,7 @@ private Set translateGraphPatternTo(GraphPattern pattern) { public void instantiateHVTSearcherKB() { // start a knowledge base with the behaviour "I am interested in high-value // targets" - kbHVTSearcher = new MockedKnowledgeBase("HVTSearcher"); + kbHVTSearcher = new EasyKnowledgeBase("HVTSearcher"); kbHVTSearcher.setReasonerEnabled(true); // Patterns for the HVTSearcher @@ -272,7 +272,7 @@ public void instantiateHVTSearcherKB() { public void instantiateObserverKB() { // start a knowledge base with the behaviour "I can supply observations of // targets" - kbTargetObserver = new MockedKnowledgeBase("TargetObserver"); + kbTargetObserver = new EasyKnowledgeBase("TargetObserver"); kbTargetObserver.setReasonerEnabled(true); // Patterns for the TargetObserver @@ -306,7 +306,7 @@ public void instantiateObserverKB() { } public void instantiateTargetLanguageSupplierKB() { - kbTargetLanguageSupplier = new MockedKnowledgeBase("TargetLanguageSupplier"); + kbTargetLanguageSupplier = new EasyKnowledgeBase("TargetLanguageSupplier"); kbTargetLanguageSupplier.setReasonerEnabled(true); // Patterns for the TargetLanguageSupplier @@ -348,14 +348,14 @@ public void instantiateTargetLanguageSupplierKB() { } public void instantiateTargetAgeSupplierKB() { - kbTargetAgeSupplier = new MockedKnowledgeBase("TargetAgeSupplier"); + kbTargetAgeSupplier = new EasyKnowledgeBase("TargetAgeSupplier"); kbTargetAgeSupplier.setReasonerEnabled(true); } public void instantiateTargetCountrySupplierKB() { // start a knowledge base with the behaviour "Give me a target and I can supply // its basic attributes" - kbTargetCountrySupplier = new MockedKnowledgeBase("TargetCountrySupplier"); + kbTargetCountrySupplier = new EasyKnowledgeBase("TargetCountrySupplier"); kbTargetCountrySupplier.setReasonerEnabled(true); // Patterns for the TargetCountrySupplier diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataFromNormalKnowledgeInteraction.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataFromNormalKnowledgeInteraction.java index de8ef325..222c4fe0 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataFromNormalKnowledgeInteraction.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataFromNormalKnowledgeInteraction.java @@ -18,12 +18,12 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @Tag("Long") public class TestMetadataFromNormalKnowledgeInteraction { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; private static final Logger LOG = LoggerFactory.getLogger(TestMetadataFromNormalKnowledgeInteraction.class); @@ -33,9 +33,9 @@ public class TestMetadataFromNormalKnowledgeInteraction { public void testPostReact() throws InterruptedException { KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); LOG.info("Before everyone is ready!"); kn.sync(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataKnowledgeInteractionMatching.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataKnowledgeInteractionMatching.java index 05f3bab8..37f19837 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataKnowledgeInteractionMatching.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestMetadataKnowledgeInteractionMatching.java @@ -1,7 +1,7 @@ package eu.knowledge.engine.smartconnector.api; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; import org.apache.jena.shared.PrefixMapping; import org.apache.jena.sparql.graph.PrefixMappingMem; import org.junit.jupiter.api.AfterEach; @@ -27,14 +27,14 @@ public class TestMetadataKnowledgeInteractionMatching { private static final Logger LOG = LoggerFactory.getLogger(TestDynamicSemanticComposition.class); private static KnowledgeNetwork kn; - private static MockedKnowledgeBase kb1, kb2; + private static EasyKnowledgeBase kb1, kb2; private static PrefixMappingMem prefixes; @BeforeEach public void setup() { kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("Kb1"); + kb1 = new EasyKnowledgeBase("Kb1"); kb1.setReasonerEnabled(true); prefixes = new PrefixMappingMem(); @@ -57,7 +57,7 @@ public void testNewKB() { kn.addKB(kb1); kn.sync(); - kb2 = new MockedKnowledgeBase("Kb2"); + kb2 = new EasyKnowledgeBase("Kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); kn.sync(); @@ -78,7 +78,7 @@ public void testChangedKB() { kn.addKB(kb1); kn.sync(); - kb2 = new MockedKnowledgeBase("Kb2"); + kb2 = new EasyKnowledgeBase("Kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); kn.sync(); @@ -101,7 +101,7 @@ public void testRemovedKB() { return new BindingSet(); })); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("Kb2"); + kb2 = new EasyKnowledgeBase("Kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); kn.sync(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact.java index 502a940e..ba30450d 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact.java @@ -16,11 +16,11 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestPostReact { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; public boolean kb2Received = false; @@ -33,9 +33,9 @@ public void testPostReact() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact2.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact2.java index 3d6f881e..525da605 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact2.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact2.java @@ -24,12 +24,12 @@ import eu.knowledge.engine.smartconnector.api.PostResult; import eu.knowledge.engine.smartconnector.api.ReactKnowledgeInteraction; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestPostReact2 { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; private static final Logger LOG = LoggerFactory.getLogger(TestPostReact2.class); @@ -42,11 +42,11 @@ public void testPostReact() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); // start registering diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact3.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact3.java index 17b6345f..5cf467b9 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact3.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact3.java @@ -17,12 +17,12 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestPostReact3 { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; private static final Logger LOG = LoggerFactory.getLogger(TestPostReact3.class); @@ -35,13 +35,13 @@ public void testPostReact() throws InterruptedException { prefixes.setNsPrefix("ex", "https://example.org/"); KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kb1.setReasonerEnabled(true); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kb2.setReasonerEnabled(true); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kb3.setReasonerEnabled(true); kn.addKB(kb3); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactPerformance.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactPerformance.java index decf36c7..efed6a02 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactPerformance.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactPerformance.java @@ -23,11 +23,11 @@ import eu.knowledge.engine.smartconnector.api.ReactHandler; import eu.knowledge.engine.smartconnector.api.ReactKnowledgeInteraction; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestPostReactPerformance { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; private static final Logger LOG = LoggerFactory.getLogger(TestPostReactPerformance.class); @@ -39,9 +39,9 @@ public void testPostReact() throws InterruptedException { // create the network KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); // register capabilities diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostRecipientSelector.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostRecipientSelector.java index f9ce7e0b..a7f091e6 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostRecipientSelector.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostRecipientSelector.java @@ -25,12 +25,12 @@ import eu.knowledge.engine.smartconnector.api.ReactKnowledgeInteraction; import eu.knowledge.engine.smartconnector.api.RecipientSelector; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestPostRecipientSelector { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; - private static MockedKnowledgeBase kb3; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; + private static EasyKnowledgeBase kb3; private static final Logger LOG = LoggerFactory.getLogger(TestPostRecipientSelector.class); @@ -41,11 +41,11 @@ public void testPostReact() throws InterruptedException { prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); - kb3 = new MockedKnowledgeBase("kb3"); + kb3 = new EasyKnowledgeBase("kb3"); kn.addKB(kb3); // start registering diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestReactMetadata.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestReactMetadata.java index b0a19ef3..4359d7c4 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestReactMetadata.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestReactMetadata.java @@ -14,11 +14,11 @@ import eu.knowledge.engine.smartconnector.impl.Util; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestReactMetadata { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; private static final Logger LOG = LoggerFactory.getLogger(TestReactMetadata.class); @@ -31,9 +31,9 @@ public void testRequestMetadata() throws InterruptedException { prefixes.setNsPrefix("saref", "https://saref.etsi.org/core/"); var kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); kn.sync(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRequestMetadata.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRequestMetadata.java index 01fc5a2d..8d2e0cda 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRequestMetadata.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRequestMetadata.java @@ -21,11 +21,11 @@ import eu.knowledge.engine.smartconnector.impl.Util; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestRequestMetadata { - private static MockedKnowledgeBase kb1; - private static MockedKnowledgeBase kb2; + private static EasyKnowledgeBase kb1; + private static EasyKnowledgeBase kb2; private static final Logger LOG = LoggerFactory.getLogger(TestRequestMetadata.class); @@ -39,10 +39,10 @@ public void testRequestMetadata() throws InterruptedException, ExecutionExceptio KnowledgeNetwork kn = new KnowledgeNetwork(); - kb1 = new MockedKnowledgeBase("kb1"); + kb1 = new EasyKnowledgeBase("kb1"); kn.addKB(kb1); - kb2 = new MockedKnowledgeBase("kb2"); + kb2 = new EasyKnowledgeBase("kb2"); kn.addKB(kb2); GraphPattern gp = new GraphPattern(prefixes, "?obs rdf:type saref:Measurement .", "?obs saref:hasTemp ?temp ."); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/Thermostat.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/Thermostat.java index adbeb8d2..d22e2d09 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/Thermostat.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/Thermostat.java @@ -15,15 +15,15 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class Thermostat { private static final Logger LOG = LoggerFactory.getLogger(Thermostat.class); - private MockedKnowledgeBase sensor; - private MockedKnowledgeBase thermostat; - private MockedKnowledgeBase heating; + private EasyKnowledgeBase sensor; + private EasyKnowledgeBase thermostat; + private EasyKnowledgeBase heating; private Room r; ExecutorService es = Executors.newFixedThreadPool(4); @@ -60,11 +60,11 @@ public void run() { // first add the relevant knowledge bases var kn = new KnowledgeNetwork(); - sensor = new MockedKnowledgeBase("temperatureSensor"); + sensor = new EasyKnowledgeBase("temperatureSensor"); kn.addKB(sensor); - thermostat = new MockedKnowledgeBase("thermostat"); + thermostat = new EasyKnowledgeBase("thermostat"); kn.addKB(thermostat); - heating = new MockedKnowledgeBase("heatingSource"); + heating = new EasyKnowledgeBase("heatingSource"); kn.addKB(heating); // then register the relevant knowledge interactions diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TimeOntologyTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TimeOntologyTest.java index 974486c2..e7793e7b 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TimeOntologyTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TimeOntologyTest.java @@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TimeOntologyTest { @@ -29,9 +29,9 @@ public class TimeOntologyTest { private KnowledgeNetwork kn = new KnowledgeNetwork(); - private MockedKnowledgeBase calendar = new MockedKnowledgeBase("Calendar"); - private MockedKnowledgeBase app = new MockedKnowledgeBase("App"); - private MockedKnowledgeBase time = new MockedKnowledgeBase("Time"); + private EasyKnowledgeBase calendar = new EasyKnowledgeBase("Calendar"); + private EasyKnowledgeBase app = new EasyKnowledgeBase("App"); + private EasyKnowledgeBase time = new EasyKnowledgeBase("Time"); @Test public void test() throws InterruptedException, ExecutionException { diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/VariableBindingNameTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/VariableBindingNameTest.java index bce7d769..10ec6962 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/VariableBindingNameTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/VariableBindingNameTest.java @@ -17,14 +17,14 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; class VariableBindingNameTest { private static final Logger LOG = LoggerFactory.getLogger(VariableBindingNameTest.class); - private static MockedKnowledgeBase sensor; - private static MockedKnowledgeBase thermostat; + private static EasyKnowledgeBase sensor; + private static EasyKnowledgeBase thermostat; @Test void test() { @@ -36,9 +36,9 @@ void test() { // first add the relevant knowledge bases var kn = new KnowledgeNetwork(); - sensor = new MockedKnowledgeBase("temperatureSensor"); + sensor = new EasyKnowledgeBase("temperatureSensor"); kn.addKB(sensor); - thermostat = new MockedKnowledgeBase("thermostat"); + thermostat = new EasyKnowledgeBase("thermostat"); kn.addKB(thermostat); // then register the relevant knowledge interactions diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/ConfigurationTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/ConfigurationTest.java index 1d197b44..89ccec48 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/ConfigurationTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/ConfigurationTest.java @@ -23,16 +23,16 @@ import eu.knowledge.engine.smartconnector.api.GraphPattern; import eu.knowledge.engine.smartconnector.impl.SmartConnectorConfig; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class ConfigurationTest { private static final Logger LOG = LoggerFactory.getLogger(ConfigurationTest.class); private KnowledgeNetwork kn; - private MockedKnowledgeBase kb1; + private EasyKnowledgeBase kb1; private AskKnowledgeInteraction askKI; - private MockedKnowledgeBase kb2; + private EasyKnowledgeBase kb2; private AnswerKnowledgeInteraction answerKI; private int waitTimeout = 0; @@ -176,7 +176,7 @@ public void afterTest() { } private void intializeKB1() { - this.kb1 = new MockedKnowledgeBase("kb1"); + this.kb1 = new EasyKnowledgeBase("kb1"); GraphPattern gp1 = new GraphPattern(""" ?s a . ?s ?n . @@ -186,7 +186,7 @@ private void intializeKB1() { } private void intializeKB2() { - this.kb2 = new MockedKnowledgeBase("kb2"); + this.kb2 = new EasyKnowledgeBase("kb2"); GraphPattern gp1 = new GraphPattern(""" ?p a . ?p ?name . diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/SmartConnectorRegistrationStressTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/SmartConnectorRegistrationStressTest.java index d4bcef6d..9550fa83 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/SmartConnectorRegistrationStressTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/misc/SmartConnectorRegistrationStressTest.java @@ -21,7 +21,7 @@ import eu.knowledge.engine.smartconnector.api.SmartConnector; import eu.knowledge.engine.smartconnector.impl.SmartConnectorBuilder; import eu.knowledge.engine.smartconnector.util.KnowledgeNetwork; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; @Tag("Long") @TestInstance(TestInstance.Lifecycle.PER_CLASS) @@ -38,7 +38,7 @@ void seedKnowledgeNetwork() { kn = new KnowledgeNetwork(); for (var i = 0; i < NUM_KBS; i++) { LOG.info("Starting KB{}", i); - kn.addKB(new MockedKnowledgeBase("INITIAL-KB" + i)); + kn.addKB(new EasyKnowledgeBase("INITIAL-KB" + i)); } kn.sync(); } diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/runtime/messaging/TestRegisterSmartConnectorWithSameId.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/runtime/messaging/TestRegisterSmartConnectorWithSameId.java index 3d5f336a..fa6d6492 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/runtime/messaging/TestRegisterSmartConnectorWithSameId.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/runtime/messaging/TestRegisterSmartConnectorWithSameId.java @@ -11,18 +11,18 @@ import org.slf4j.LoggerFactory; import eu.knowledge.engine.knowledgedirectory.KnowledgeDirectory; -import eu.knowledge.engine.smartconnector.util.MockedKnowledgeBase; +import eu.knowledge.engine.smartconnector.util.EasyKnowledgeBase; public class TestRegisterSmartConnectorWithSameId { private static final Logger LOG = LoggerFactory.getLogger(TestRegisterSmartConnectorWithSameId.class); private Phaser readyPhaser = new Phaser(1); @Test public void testRegisterSmartConnectorWithSameIdInSameRuntimeThrows() { - var kb1 = new MockedKnowledgeBase("http://example.org/kb1"); + var kb1 = new EasyKnowledgeBase("http://example.org/kb1"); kb1.setPhaser(this.readyPhaser); kb1.start(); - var kb1AsWell = new MockedKnowledgeBase("http://example.org/kb1"); + var kb1AsWell = new EasyKnowledgeBase("http://example.org/kb1"); assertThrows(IllegalArgumentException.class, () -> { kb1AsWell.start();