diff --git a/README.md b/README.md index d33b6cc2e..0249d67a4 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ nohup java -cp "smart-connector-rest-dist-1.4.0.jar:dependency/*" eu.knowledge.e The Knowledge Engine can also start in distributed mode, where it connects with a remote knowledge directory and where different instances of the Knowledge Engine (each instance hosting one or more smart connectors) can communicate with each other. More information about starting the Knowledge Engine in distributed mode can be found in the [documentation](docs/docs/distributed_mode.md). ### Configuration -TNO Knowledge Engine uses the [MicroProfile Config 3.1](https://microprofile.io/specifications/config/) specification to configure its behaviour and we use [SmallRye](https://smallrye.io/smallrye-config/) as the implementation of this specification. The default configuration values can be found in the [microprofile-config.properties](./smart-connector/src/main/resources/META-INF/microprofile-config.properties) configuration file. And, as described in the specification, these configuration values can be overridden by [environment variables and system properties](https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#default_configsources). Note that environment variables can use underscores and capital letters to adhere to their naming conventions and the MicroProfile Config automatically maps those to corresponding configuration properties using [specific rules](https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#default_configsources.env.mapping). +Knowledge Engine uses the [MicroProfile Config 3.1](https://microprofile.io/specifications/config/) specification to configure its behaviour and we use [SmallRye](https://smallrye.io/smallrye-config/) as the implementation of this specification. The default configuration values can be found in the [microprofile-config.properties](./smart-connector/src/main/resources/META-INF/microprofile-config.properties) configuration file. And, as described in the specification, these configuration values can be overridden by [environment variables and system properties](https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#default_configsources). Note that environment variables can use underscores and capital letters to adhere to their naming conventions and the MicroProfile Config automatically maps those to corresponding configuration properties using [specific rules](https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#default_configsources.env.mapping). A description of all configuration properties can be found in the [`SmartConnectorConfig`](./smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/SmartConnectorConfig.java) class. The rest of this section highlights some of these configuration properties. diff --git a/admin-ui/src/main/resources/example_result.json b/admin-ui/src/main/resources/example_result.json deleted file mode 100644 index 680c6e319..000000000 --- a/admin-ui/src/main/resources/example_result.json +++ /dev/null @@ -1,306 +0,0 @@ -example results rest/admin/sc/all/false route 01-02-2022 -[ - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "knowledgeBaseName": "Washing machine", - "knowledgeBaseDescription": "This is a washing machine", - "knowledgeInteractions": [ - { - "knowledgeInteractionType": "ReactKnowledgeInteraction", - "argumentGraphPattern": "?cmd . ?cmd ?enabled . ", - "resultGraphPattern": "", - "knowledgeInteractionId": "http://www.example.org/washing-machine/interaction/4e175b85-1d4f-46fb-a1d8-2b44aee74407", - "communicativeAct": { - "requiredPurposes": [ - "http://www.example.org/washing-machine/interaction/4e175b85-1d4f-46fb-a1d8-2b44aee74407/act/req" - ], - "satisfiedPurposes": [ - "http://www.example.org/washing-machine/interaction/4e175b85-1d4f-46fb-a1d8-2b44aee74407/act/sat" - ] - }, - "isMeta": "false" - } - ], - "connections": [ - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "?cmd" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "?cmd" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "?enabled" - } - ] - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "knowledgeBaseName": "Solar panels", - "knowledgeBaseDescription": "These are solar panels", - "knowledgeInteractions": [ - { - "knowledgeInteractionType": "PostKnowledgeInteraction", - "argumentGraphPattern": "?panel . ?panel ?watt . ", - "resultGraphPattern": "", - "knowledgeInteractionId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9/interaction/d7b3eb92-8111-4fee-9769-39a21b07a52a", - "communicativeAct": { - "requiredPurposes": [ - "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9/interaction/d7b3eb92-8111-4fee-9769-39a21b07a52a/act/req" - ], - "satisfiedPurposes": [ - "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9/interaction/d7b3eb92-8111-4fee-9769-39a21b07a52a/act/sat" - ] - }, - "isMeta": "false" - } - ], - "connections": [ - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?panel" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?panel" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?watt" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?watt" - } - ] - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "knowledgeBaseName": "Solar panels", - "knowledgeBaseDescription": "These are solar panels", - "knowledgeInteractions": [ - { - "knowledgeInteractionType": "PostKnowledgeInteraction", - "argumentGraphPattern": "?panel . ?panel ?watt . ", - "resultGraphPattern": "", - "knowledgeInteractionId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr/interaction/732e298e-0d48-4313-a423-11b467face1d", - "communicativeAct": { - "requiredPurposes": [ - "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr/interaction/732e298e-0d48-4313-a423-11b467face1d/act/req" - ], - "satisfiedPurposes": [ - "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr/interaction/732e298e-0d48-4313-a423-11b467face1d/act/sat" - ] - }, - "isMeta": "false" - } - ], - "connections": [ - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?panel" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?panel" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?watt" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?watt" - } - ] - }, - { - "knowledgeBaseId": "http://www.example.org/flexibility-service", - "knowledgeBaseName": "Flexibility service", - "knowledgeBaseDescription": "This is the flexibility service", - "knowledgeInteractions": [ - { - "knowledgeInteractionType": "PostKnowledgeInteraction", - "argumentGraphPattern": "?cmd . ?cmd ?enabled . ", - "resultGraphPattern": "", - "knowledgeInteractionId": "http://www.example.org/flexibility-service/interaction/a75a9924-1f6a-44e6-98ae-2bd1b3099d7d", - "communicativeAct": { - "requiredPurposes": [ - "http://www.example.org/flexibility-service/interaction/a75a9924-1f6a-44e6-98ae-2bd1b3099d7d/act/req" - ], - "satisfiedPurposes": [ - "http://www.example.org/flexibility-service/interaction/a75a9924-1f6a-44e6-98ae-2bd1b3099d7d/act/sat" - ] - }, - "isMeta": "false" - }, - { - "knowledgeInteractionType": "ReactKnowledgeInteraction", - "argumentGraphPattern": "?producer . ?producer ?watt . ", - "resultGraphPattern": "", - "knowledgeInteractionId": "http://www.example.org/flexibility-service/interaction/c8c69876-5914-4d81-a02f-2c3932d0d120", - "communicativeAct": { - "requiredPurposes": [ - "http://www.example.org/flexibility-service/interaction/c8c69876-5914-4d81-a02f-2c3932d0d120/act/req" - ], - "satisfiedPurposes": [ - "http://www.example.org/flexibility-service/interaction/c8c69876-5914-4d81-a02f-2c3932d0d120/act/sat" - ] - }, - "isMeta": "false" - } - ], - "connections": [ - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?cmd" - }, - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?cmd" - }, - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/washing-machine", - "connectionType": "outgoing", - "interactionType": "PostKnowledgeInteraction", - "matchedKeyword": "?enabled" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-w0yk0ubwb1s9pf73mosafr", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "?watt" - }, - { - "knowledgeBaseId": "http://www.example.org/solar-panels-dlbtuq6cuecgsc83cxcyb9", - "connectionType": "outgoing", - "interactionType": "ReactKnowledgeInteraction", - "matchedKeyword": "?watt" - } - ] - } -] \ No newline at end of file diff --git a/admin-ui/src/test/java/eu/knowledge/engine/admin/TestUtils.java b/admin-ui/src/test/java/eu/knowledge/engine/admin/TestUtils.java deleted file mode 100644 index ff3f83e41..000000000 --- a/admin-ui/src/test/java/eu/knowledge/engine/admin/TestUtils.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.knowledge.engine.admin; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.ModelFactory; -import org.junit.jupiter.api.Test; - -public class TestUtils { - - @Test - public void testGetPatterns() { - Model model = ModelFactory.createDefaultModel(); - var stream = TestUtils.class.getResourceAsStream("/testmodel.ttl"); - model.read(stream, "", "ttl"); - - var reactKiRes = model.getResource("https://example.org/example-knowledge-base/interaction/thing-react"); - var arg = Util.getArgument(model, reactKiRes); - var res = Util.getResult(model, reactKiRes); - assertEquals("?a ?b .", arg); - assertEquals(null, res); - - var answerKiRes = model.getResource("https://example.org/example-knowledge-base/interaction/thing-answer"); - var pattern = Util.getGraphPattern(model, answerKiRes); - assertEquals("?a ?b .", pattern); - } -} 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 8e5ea27b9..a0e236258 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 @@ -159,8 +159,13 @@ public void testConnections() throws InterruptedException { assertNotNull(list); assertEquals(2, list.size()); - assertEquals(0, list.get(0).getKnowledgeInteractions().get(0).getConnections().size()); - assertEquals(1, list.get(1).getKnowledgeInteractions().get(0).getConnections().size()); + + for (eu.knowledge.engine.admin.model.SmartConnector sc : list) + if (sc.getKnowledgeBaseId().equals("https://www.example.org/kb1")) + assertEquals(0, sc.getKnowledgeInteractions().get(0).getConnections().size()); + else if (sc.getKnowledgeBaseId().equals("https://www.example.org/kb2")) + assertEquals(1, sc.getKnowledgeInteractions().get(0).getConnections().size()); + assertEquals(200, response.statusCode()); } catch (IOException | InterruptedException | URISyntaxException e) { @@ -247,7 +252,7 @@ public void cleanup() { public void startKbs() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kb1 = null; int wait = 2; final CountDownLatch kb2ReceivedData = new CountDownLatch(1); @@ -259,7 +264,7 @@ public void smartConnectorReady(SmartConnector aSC) { } }; - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue(anAnswerExchangeInfo.getIncomingBindings().isEmpty(), @@ -267,8 +272,8 @@ public void smartConnectorReady(SmartConnector aSC) { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; @@ -288,7 +293,7 @@ public void smartConnectorReady(SmartConnector aSC) { }; - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); diff --git a/admin-ui/src/test/resources/testmodel.ttl b/admin-ui/src/test/resources/testmodel.ttl deleted file mode 100644 index 8fb453c07..000000000 --- a/admin-ui/src/test/resources/testmodel.ttl +++ /dev/null @@ -1,54 +0,0 @@ -@prefix dc: . -@prefix ke: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . - - - rdf:type ke:InformPurpose . - - - rdf:type ke:KnowledgeBase ; - ke:hasDescription "This database contains example data." ; - ke:hasKnowledgeInteraction , ; - ke:hasName "Example knowledge base" . - - - rdf:type ke:ReactKnowledgeInteraction ; - ke:hasCommunicativeAct ; - ke:hasGraphPattern ; - ke:isMeta false . - - - rdf:type ke:InformPurpose . - - - rdf:type ke:CommunicativeAct ; - ke:hasRequirement ; - ke:hasSatisfaction . - - - rdf:type ke:CommunicativeAct ; - ke:hasRequirement ; - ke:hasSatisfaction . - - - rdf:type ke:InformPurpose . - - - rdf:type ke:ArgumentGraphPattern ; - ke:hasPattern "?a ?b ." . - - - rdf:type ke:GraphPattern ; - ke:hasPattern "?a ?b ." . - - - rdf:type ke:InformPurpose . - - - rdf:type ke:AnswerKnowledgeInteraction ; - ke:hasCommunicativeAct ; - ke:hasGraphPattern ; - ke:isMeta false . diff --git a/docs/docs/conceptual_framework.md b/docs/docs/conceptual_framework.md index 58aec9f48..75dd3a3d0 100644 --- a/docs/docs/conceptual_framework.md +++ b/docs/docs/conceptual_framework.md @@ -129,7 +129,7 @@ In the running example, the necessary concepts for the knowledge model are for e For the knowledge exchange to work, and to take full advantage of the platform, these concepts and relations between them should be formalized in detail in the knowledge model. -An example of such a knowledge model is the [SAREF ontology](https://ontology.tno.nl/saref/). +An example of such a knowledge model is the [SAREF ontology](https://ontology.example.org/saref/). ## Knowledge Interaction diff --git a/docs/docs/getting_started.md b/docs/docs/getting_started.md index c96f351e1..ff2e398cb 100644 --- a/docs/docs/getting_started.md +++ b/docs/docs/getting_started.md @@ -165,16 +165,16 @@ For example, when the graph pattern above is applied to the RDF data above, this ```json [ { - "parent": "", - "someChild": "", + "parent": "", + "someChild": "", }, { - "parent": "", - "someChild": "", + "parent": "", + "someChild": "", }, { - "parent": "", - "someChild": "", + "parent": "", + "someChild": "", } ] ``` diff --git a/reasoner/src/test/java/eu/knowledge/engine/reasoner/DynamicSemanticConfigurationTest.java b/reasoner/src/test/java/eu/knowledge/engine/reasoner/DynamicSemanticConfigurationTest.java index 4ef6880af..c24580c6d 100644 --- a/reasoner/src/test/java/eu/knowledge/engine/reasoner/DynamicSemanticConfigurationTest.java +++ b/reasoner/src/test/java/eu/knowledge/engine/reasoner/DynamicSemanticConfigurationTest.java @@ -49,8 +49,8 @@ public void init() throws URISyntaxException { //@formatter:on }, new String[] { //@formatter:off - ",\"Eek\"", - ",\"Bla\"", + ",\"Eek\"", + ",\"Bla\"", //@formatter:on }); @@ -93,7 +93,7 @@ public CompletableFuture handle(BindingSet bs) { ruleStore.addRule(new Rule( new HashSet<>(Arrays.asList(new TriplePattern("?id "), - new TriplePattern("?id \"Russia\""))), + new TriplePattern("?id \"Prussia\""))), new HashSet<>(Arrays.asList(new TriplePattern("?id "))))); ruleStore.addRule(new Rule( @@ -112,14 +112,14 @@ public CompletableFuture handle(BindingSet bs) { Node id; if (incomingB.containsKey("id") - && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { + && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { id = incomingB.get("id"); resultBinding.put("id", FmtUtils.stringForNode(id, new PrefixMappingZero())); - resultBinding.put("c", "\"Russia\""); - resultBinding.put("lang", "\"Russian\""); + resultBinding.put("c", "\"Prussia\""); + resultBinding.put("lang", "\"Prussian\""); } else if (incomingB.containsKey("id") - && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { + && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { id = incomingB.get("id"); resultBinding.put("id", FmtUtils.stringForNode(id, new PrefixMappingZero())); resultBinding.put("c", "\"Holland\""); diff --git a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/RuleStoreTest.java b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/RuleStoreTest.java index 50787e3a4..7b90e7d59 100644 --- a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/RuleStoreTest.java +++ b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/RuleStoreTest.java @@ -57,8 +57,8 @@ void test() { //@formatter:on }, new String[] { //@formatter:off - ",\"Eek\"", - ",\"Bla\"", + ",\"Eek\"", + ",\"Bla\"", //@formatter:on }); @@ -93,7 +93,7 @@ public CompletableFuture handle(BindingSet bs) { produceHvtRule = new Rule( new HashSet<>(Arrays.asList(new TriplePattern("?id rdf:type "), - new TriplePattern("?id \"Russia\""))), + new TriplePattern("?id \"Prussia\""))), new HashSet<>(Arrays.asList(new TriplePattern("?id rdf:type ")))); store.addRule(produceHvtRule); @@ -112,13 +112,13 @@ public CompletableFuture handle(BindingSet bs) { Node id; if (incomingB.containsKey("id") - && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { + && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { id = incomingB.get("id"); resultBinding.put("id", FmtUtils.stringForNode(id, new PrefixMappingZero())); - resultBinding.put("c", "\"Russia\""); + resultBinding.put("c", "\"Prussia\""); } else if (incomingB.containsKey("id") - && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { + && incomingB.get("id").sameValueAs(SSE.parseNode(""))) { id = incomingB.get("id"); resultBinding.put("id", FmtUtils.stringForNode(id, new PrefixMappingZero())); resultBinding.put("c", "\"Holland\""); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerIncludeMetaKIs.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerIncludeMetaKIs.java index 9a7f4232f..63bf60363 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerIncludeMetaKIs.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerIncludeMetaKIs.java @@ -52,7 +52,7 @@ public void run() { try { // register the AnswerKB HttpTester registerOtherKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/otherKB\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/otherKB\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerOtherKb.expectStatus(200); KBReady.countDown(); @@ -67,28 +67,28 @@ public void run() { // register the AnswerKB HttpTester registerAskKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/metadataAsker\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/metadataAsker\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerAskKb.expectStatus(200); // register the AskKI with IncludeMetaKIs enabled HttpTester registerAskKiWithIncludeMetaKIsEnabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askMetadataWithIncludeMetaKIs\", \"includeMetaKIs\": \"true\", \"graphPattern\": \"?kb .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Content-Type", "application/json", "Accept", "*/*")); registerAskKiWithIncludeMetaKIsEnabled.expectStatus(200); // register the AskKI without IncludeMetaKIs (= disabled) HttpTester registerAskKiWithoutIncludeMetaKIs = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askMetadataWithoutIncludeMetaKIs\", \"graphPattern\": \"?kb .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Content-Type", "application/json", "Accept", "*/*")); registerAskKiWithoutIncludeMetaKIs.expectStatus(200); // register the AskKI with IncludeMetaKIs disabled HttpTester registerAskKiWithIncludeMetaKIsDisabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askMetadataWithIncludeMetaKIsDisabled\", \"includeMetaKIs\": \"false\", \"graphPattern\": \"?kb .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Content-Type", "application/json", "Accept", "*/*")); registerAskKiWithIncludeMetaKIsDisabled.expectStatus(200); @@ -96,8 +96,8 @@ public void run() { HttpTester askAskKiWithIncludeMetaKIs = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/metadataAsker/interaction/askMetadataWithIncludeMetaKIs", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/metadataAsker/interaction/askMetadataWithIncludeMetaKIs", "Content-Type", "application/json", "Accept", "*/*")); System.out.println("Result is:" + askAskKiWithIncludeMetaKIs.getBody()); @@ -108,8 +108,8 @@ public void run() { HttpTester askAskKiWithoutIncludeMetaKIs = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/metadataAsker/interaction/askMetadataWithoutIncludeMetaKIs", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/metadataAsker/interaction/askMetadataWithoutIncludeMetaKIs", "Content-Type", "application/json", "Accept", "*/*")); System.out.println("Result is:" + askAskKiWithoutIncludeMetaKIs.getBody()); jsonReader = Json.createReader(new StringReader(askAskKiWithoutIncludeMetaKIs.getBody())); @@ -119,8 +119,8 @@ public void run() { HttpTester askAskKiWithIncludeMetaKIsDisabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/metadataAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/metadataAsker/interaction/askMetadataWithIncludeMetaKIsDisabled", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/metadataAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/metadataAsker/interaction/askMetadataWithIncludeMetaKIsDisabled", "Content-Type", "application/json", "Accept", "*/*")); System.out.println("Result is:" + askAskKiWithIncludeMetaKIsDisabled.getBody()); jsonReader = Json.createReader(new StringReader(askAskKiWithIncludeMetaKIsDisabled.getBody())); 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 2fb372328..9e8bcccc2 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 @@ -59,12 +59,12 @@ public void testAskAnswerReactWithGaps() throws IOException, InterruptedExceptio var answeringSc = new AsyncTester(new Runnable() { @Override public void run() { - String answerKBId = "https://www.tno.nl/example/relationProvider"; + String answerKBId = "https://www.example.org/example/relationProvider"; String answerKIId = answerKBId + "/interaction/answerRelations"; try { // register the AnswerKB HttpTester registerAnswerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerAnswerKb.expectStatus(200); @@ -75,7 +75,7 @@ public void run() { "knowledgeInteractionName": "answerRelations", "graphPattern": "?a ?b ." } - """, Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationProvider", + """, Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationProvider", "Content-Type", "application/json", "Accept", "*/*")); registerAnswerKi.expectStatus(200); @@ -94,7 +94,7 @@ public void run() { int handleRequestId = jo.getInt("handleRequestId"); builder.add("handleRequestId", handleRequestId); JsonReader jr = Json.createReader(new StringReader( - "[{\"a\": \"\",\"b\": \"\"}]")); + "[{\"a\": \"\",\"b\": \"\"}]")); JsonArray bs = jr.readArray(); builder.add("bindingSet", bs); JsonObject jo2 = builder.build(); @@ -118,12 +118,12 @@ public void run() { var reactingSc = new AsyncTester(new Runnable() { @Override public void run() { - String reactKBId = "https://www.tno.nl/example/relationReactor"; + String reactKBId = "https://www.example.org/example/relationReactor"; String reactKIId = reactKBId + "/interaction/reactRelations"; try { // register the ReactKB HttpTester registerReactKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationReactor\", \"knowledgeBaseName\": \"RelationReactor\", \"knowledgeBaseDescription\": \"A KB that reacts to supply related people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationReactor\", \"knowledgeBaseName\": \"RelationReactor\", \"knowledgeBaseDescription\": \"A KB that reacts to supply related people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerReactKb.expectStatus(200); @@ -135,7 +135,7 @@ public void run() { "argumentGraphPattern": "?a ?b .", "resultGraphPattern": "?a ?b ." } - """, Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationReactor", + """, Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationReactor", "Content-Type", "application/json", "Accept", "*/*")); registerReactKi.expectStatus(200); @@ -178,7 +178,7 @@ public void run() { // 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); @@ -190,15 +190,15 @@ public void run() { "graphPattern": "?a ?b . ?a ?c .", "knowledgeGapsEnabled": true } - """, Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + """, Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithoutGapsEnabled.expectStatus(200); // fire the ask KI HttpTester askKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/relationAsker/interaction/askRelations", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/relationAsker/interaction/askRelations", "Content-Type", "application/json", "Accept", "*/*")); var result = askKiWithoutGapsEnabled.getBody(); System.out.println("Result is:" + result); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabled.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabled.java index ad3947a58..d9c625ce4 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabled.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabled.java @@ -50,19 +50,19 @@ public void testAskAnswerWithGaps() throws IOException, InterruptedException { var answeringSc = new AsyncTester(new Runnable() { @Override public void run() { - String answerKBId = "https://www.tno.nl/example/relationProvider"; + String answerKBId = "https://www.example.org/example/relationProvider"; String answerKIId = answerKBId + "/interaction/answerRelations"; try { // register the AnswerKB HttpTester registerAnswerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerAnswerKb.expectStatus(200); // register the AnswerKI HttpTester registerAnswerKi = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AnswerKnowledgeInteraction\", \"knowledgeInteractionName\": \"answerRelations\", \"graphPattern\": \"?a ?b .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationProvider", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationProvider", "Content-Type", "application/json", "Accept", "*/*")); registerAnswerKi.expectStatus(200); @@ -80,7 +80,7 @@ public void run() { int handleRequestId = jo.getInt("handleRequestId"); builder.add("handleRequestId", handleRequestId); JsonReader jr = Json.createReader(new StringReader( - "[{\"a\": \"\",\"b\": \"\"}]")); + "[{\"a\": \"\",\"b\": \"\"}]")); JsonArray bs = jr.readArray(); builder.add("bindingSet", bs); JsonObject jo2 = builder.build(); @@ -103,7 +103,7 @@ public void run() { 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); @@ -111,15 +111,15 @@ public void run() { // register the AskKI HttpTester registerKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askRelations\", \"graphPattern\": \"?a ?b . ?a ?c .\", \"knowledgeGapsEnabled\": true}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithoutGapsEnabled.expectStatus(200); // fire the ask KI HttpTester askKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/relationAsker/interaction/askRelations", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/relationAsker/interaction/askRelations", "Content-Type", "application/json", "Accept", "*/*")); var result = askKiWithoutGapsEnabled.getBody(); System.out.println("Result is:" + result); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabledNoGaps.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabledNoGaps.java index 069f3a606..2c4e0490d 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabledNoGaps.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskAnswerWithGapsEnabledNoGaps.java @@ -50,19 +50,19 @@ public void testAskAnswerWithGaps() throws IOException, InterruptedException { var answeringSc = new AsyncTester(new Runnable() { @Override public void run() { - String answerKBId = "https://www.tno.nl/example/relationProvider"; + String answerKBId = "https://www.example.org/example/relationProvider"; String answerKIId = answerKBId + "/interaction/answerRelations"; try { // register the AnswerKB HttpTester registerAnswerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationProvider\", \"knowledgeBaseName\": \"RelationProvider\", \"knowledgeBaseDescription\": \"A KB that provides relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerAnswerKb.expectStatus(200); // register the AnswerKI HttpTester registerAnswerKi = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AnswerKnowledgeInteraction\", \"knowledgeInteractionName\": \"answerRelations\", \"graphPattern\": \"?a ?b .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationProvider", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationProvider", "Content-Type", "application/json", "Accept", "*/*")); registerAnswerKi.expectStatus(200); @@ -80,7 +80,7 @@ public void run() { int handleRequestId = jo.getInt("handleRequestId"); builder.add("handleRequestId", handleRequestId); JsonReader jr = Json.createReader(new StringReader( - "[{\"a\": \"\",\"b\": \"\"}]")); + "[{\"a\": \"\",\"b\": \"\"}]")); JsonArray bs = jr.readArray(); builder.add("bindingSet", bs); JsonObject jo2 = builder.build(); @@ -103,7 +103,7 @@ public void run() { 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); @@ -111,15 +111,15 @@ public void run() { // register the AskKI HttpTester registerKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askRelations\", \"graphPattern\": \"?a ?b . \", \"knowledgeGapsEnabled\": true}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithoutGapsEnabled.expectStatus(200); // fire the ask KI HttpTester askKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/relationAsker/interaction/askRelations", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/relationAsker/interaction/askRelations", "Content-Type", "application/json", "Accept", "*/*")); var result = askKiWithoutGapsEnabled.getBody(); System.out.println("Result is:" + result); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsEnabled.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsEnabled.java index 3e15f7658..424ed2582 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsEnabled.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsEnabled.java @@ -34,26 +34,26 @@ public void testAskWithGaps() throws IOException { URL url = new URL("http://localhost:" + PORT + "/rest"); 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); HttpTester registerKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askRelations\", \"graphPattern\": \"?a ?b .\", \"knowledgeGapsEnabled\": true}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithoutGapsEnabled.expectStatus(200); HttpTester getKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "GET", null, - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); var body = getKiWithoutGapsEnabled.getBody(); - assertTrue(body.contains("\"https://www.tno.nl/example/relationAsker/interaction/askRelations\"")); + assertTrue(body.contains("\"https://www.example.org/example/relationAsker/interaction/askRelations\"")); HttpTester askKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/relationAsker/interaction/askRelations", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/relationAsker/interaction/askRelations", "Content-Type", "application/json", "Accept", "*/*")); var result = askKiWithoutGapsEnabled.getBody(); System.out.println("Result is:" + result); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsNotEnabled.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsNotEnabled.java index 59247aae3..7468ce63c 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsNotEnabled.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestAskWithGapsNotEnabled.java @@ -35,26 +35,26 @@ public void testAskWithoutGaps() throws IOException { URL url = new URL("http://localhost:" + PORT + "/rest"); 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); HttpTester registerKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"askRelations\", \"graphPattern\": \"?a ?b .\"}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithoutGapsEnabled.expectStatus(200); HttpTester getKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ki"), "GET", null, - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Content-Type", "application/json", "Accept", "*/*")); var body = getKiWithoutGapsEnabled.getBody(); - assertTrue(body.contains("\"https://www.tno.nl/example/relationAsker/interaction/askRelations\"")); + assertTrue(body.contains("\"https://www.example.org/example/relationAsker/interaction/askRelations\"")); HttpTester askKiWithoutGapsEnabled = new HttpTester(new URL(url + "/sc/ask"), "POST", "{\"recipientSelector\": {\"knowledgeBases\": []}, \"bindingSet\": []}", - Map.of("Knowledge-Base-Id", "https://www.tno.nl/example/relationAsker", "Knowledge-Interaction-Id", - "https://www.tno.nl/example/relationAsker/interaction/askRelations", "Content-Type", + Map.of("Knowledge-Base-Id", "https://www.example.org/example/relationAsker", "Knowledge-Interaction-Id", + "https://www.example.org/example/relationAsker/interaction/askRelations", "Content-Type", "application/json", "Accept", "*/*")); var result = askKiWithoutGapsEnabled.getBody(); System.out.println("Result is:" + result); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestDomainKnowledge.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestDomainKnowledge.java index f0c2d5c24..379ede76b 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestDomainKnowledge.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestDomainKnowledge.java @@ -27,7 +27,7 @@ public void testDomainKnowledge() throws IOException { URL url = new URL("http://localhost:" + PORT + "/rest"); HttpTester registerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"http://example.com/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", + "{\"knowledgeBaseId\": \"http://example.org/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); @@ -42,24 +42,24 @@ public void testDomainKnowledge() throws IOException { // non-existing KB id. HttpTester addDomainKnowledge = new HttpTester(new URL(url + "/sc/knowledge"), "POST", domainKnowledgePrefix + domainKnowledgeRules, - Map.of("Knowledge-Base-Id", "http://example.com/kb123", "Content-Type", "text/plain", "Accept", "*/*")); + Map.of("Knowledge-Base-Id", "http://example.org/kb123", "Content-Type", "text/plain", "Accept", "*/*")); addDomainKnowledge.expectStatus(404); // happy flow addDomainKnowledge = new HttpTester(new URL(url + "/sc/knowledge"), "POST", domainKnowledgePrefix + domainKnowledgeRules, - Map.of("Knowledge-Base-Id", "http://example.com/kb", "Content-Type", "text/plain", "Accept", "*/*")); + Map.of("Knowledge-Base-Id", "http://example.org/kb", "Content-Type", "text/plain", "Accept", "*/*")); addDomainKnowledge.expectStatus(200); // domain knowledge with syntax error (missing prefix) addDomainKnowledge = new HttpTester(new URL(url + "/sc/knowledge"), "POST", domainKnowledgeRules, - Map.of("Knowledge-Base-Id", "http://example.com/kb", "Content-Type", "text/plain", "Accept", "*/*")); + Map.of("Knowledge-Base-Id", "http://example.org/kb", "Content-Type", "text/plain", "Accept", "*/*")); addDomainKnowledge.expectStatus(400); System.out.println("Body: " + addDomainKnowledge.getBody()); // remove all domain knowledge addDomainKnowledge = new HttpTester(new URL(url + "/sc/knowledge"), "POST", null, - Map.of("Knowledge-Base-Id", "http://example.com/kb", "Content-Type", "text/plain", "Accept", "*/*")); + Map.of("Knowledge-Base-Id", "http://example.org/kb", "Content-Type", "text/plain", "Accept", "*/*")); addDomainKnowledge.expectStatus(200); System.out.println("Body: " + addDomainKnowledge.getBody()); diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestPostMemoryLeak.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestPostMemoryLeak.java index 65e25d2aa..bf1d5afe8 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestPostMemoryLeak.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestPostMemoryLeak.java @@ -148,10 +148,10 @@ public void run() { var test = new HttpTester(new URL(TestPostMemoryLeak.this.url.toString() + "/post"), "POST", """ [ { - "a": "" + "a": "" }, { - "a": "" + "a": "" } ] """, Map.of("Content-Type", "application/json", "Accept", "*/*", "Knowledge-Base-Id", diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestReasonerLevel.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestReasonerLevel.java index 261e31402..2d4cce7ed 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestReasonerLevel.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestReasonerLevel.java @@ -30,25 +30,25 @@ public void testReasonerLevel() throws IOException, InterruptedException { // register the AskKB with out of range reasoner level var 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\", \"reasonerLevel\" : 0}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 0}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(400); // register the AskKB with out of range reasoner level 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\", \"reasonerLevel\" : 6}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 6}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(400); // register the AskKB with correct reasoner level 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\", \"reasonerLevel\" : 2}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\", \"reasonerLevel\" : 2}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); // register the AskKB without reasoner level var registerKb2 = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"https://www.tno.nl/example/relationAsker2\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\"}", + "{\"knowledgeBaseId\": \"https://www.example.org/example/relationAsker2\", \"knowledgeBaseName\": \"RelationAsker\", \"knowledgeBaseDescription\": \"A KB that asks for relations between people\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); } diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestRegisterKnowledgeInteraction.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestRegisterKnowledgeInteraction.java index ba0b2c553..115f05d01 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestRegisterKnowledgeInteraction.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestRegisterKnowledgeInteraction.java @@ -31,20 +31,20 @@ public void testRegisterKi() throws IOException { URL url = new URL("http://localhost:" + PORT + "/rest"); HttpTester registerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"http://example.com/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", + "{\"knowledgeBaseId\": \"http://example.org/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); HttpTester registerKiWithName = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", \"knowledgeInteractionName\": \"some-name\", \"graphPattern\": \"?a ?b ?c.\"}", - Map.of("Knowledge-Base-Id", "http://example.com/kb", "Content-Type", "application/json", "Accept", + Map.of("Knowledge-Base-Id", "http://example.org/kb", "Content-Type", "application/json", "Accept", "*/*")); registerKiWithName.expectStatus(200); HttpTester getKiWithName = new HttpTester(new URL(url + "/sc/ki"), "GET", null, Map.of("Knowledge-Base-Id", - "http://example.com/kb", "Content-Type", "application/json", "Accept", "*/*")); + "http://example.org/kb", "Content-Type", "application/json", "Accept", "*/*")); var body = getKiWithName.getBody(); - assertTrue(body.contains("\"http://example.com/kb/interaction/some-name\"")); + assertTrue(body.contains("\"http://example.org/kb/interaction/some-name\"")); } @AfterAll diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestScLifeCycle.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestScLifeCycle.java index 50043d866..c75686aba 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestScLifeCycle.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestScLifeCycle.java @@ -57,7 +57,7 @@ public void testValidJson() throws IOException, URISyntaxException { URL url = new URI("http://localhost:" + PORT + "/rest/sc").toURL(); HttpTester httpTest = new HttpTester(url, "POST", - "{\"knowledgeBaseId\": \"http://example.com/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", + "{\"knowledgeBaseId\": \"http://example.org/kb\", \"knowledgeBaseName\": \"KB\", \"knowledgeBaseDescription\": \"KB\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); httpTest.expectStatus(200); } diff --git a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestSuspendedKnowledgeBase.java b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestSuspendedKnowledgeBase.java index d739de31d..cd1da6551 100644 --- a/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestSuspendedKnowledgeBase.java +++ b/smart-connector-rest-dist/src/test/java/eu/knowledge/engine/rest/api/TestSuspendedKnowledgeBase.java @@ -27,12 +27,12 @@ public void setUpServer() { public void testSuspendingKnowledgeBase() throws MalformedURLException { URL url = new URL("http://localhost:" + PORT + "/rest"); HttpTester registerKb = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"http://example.com/kb1\", " + "\"knowledgeBaseName\": \"KB1\", " + "{\"knowledgeBaseId\": \"http://example.org/kb1\", " + "\"knowledgeBaseName\": \"KB1\", " + "\"knowledgeBaseDescription\": \"KB1\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb.expectStatus(200); HttpTester registerKb2 = new HttpTester(new URL(url + "/sc"), "POST", - "{\"knowledgeBaseId\": \"http://example.com/kb2\", " + "\"knowledgeBaseName\": \"KB2\", " + "{\"knowledgeBaseId\": \"http://example.org/kb2\", " + "\"knowledgeBaseName\": \"KB2\", " + "\"knowledgeBaseDescription\": \"KB2\"}", Map.of("Content-Type", "application/json", "Accept", "*/*")); registerKb2.expectStatus(200); @@ -42,13 +42,13 @@ public void testSuspendingKnowledgeBase() throws MalformedURLException { HttpTester registerAsk = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AskKnowledgeInteraction\", " + "\"knowledgeInteractionName\": \"ask\"," + "\"graphPattern\": \"?a ?b ?c.\"}", - Map.of("Knowledge-Base-Id", "http://example.com/kb1", "Content-Type", "application/json", + Map.of("Knowledge-Base-Id", "http://example.org/kb1", "Content-Type", "application/json", "Accept", "*/*")); registerAsk.expectStatus(200); System.out.println("Registered Ask"); HttpTester executeAsk = new HttpTester(new URL(url + "/sc/ask"), "POST", "[{}]", - Map.of("Knowledge-Base-Id", "http://example.com/kb1", "Knowledge-Interaction-Id", - "http://example.com/kb1/interaction/ask", "Content-Type", "application/json", "Accept", + Map.of("Knowledge-Base-Id", "http://example.org/kb1", "Knowledge-Interaction-Id", + "http://example.org/kb1/interaction/ask", "Content-Type", "application/json", "Accept", "*/*")); System.out.println("Executing Ask"); var body = executeAsk.getBody(); @@ -60,8 +60,8 @@ public void testSuspendingKnowledgeBase() throws MalformedURLException { HttpTester executeAsk1; try { executeAsk1 = new HttpTester(new URL(url + "/sc/ask"), "POST", "[{}]", - Map.of("Knowledge-Base-Id", "http://example.com/kb1", "Knowledge-Interaction-Id", - "http://example.com/kb1/interaction/ask", "Content-Type", + Map.of("Knowledge-Base-Id", "http://example.org/kb1", "Knowledge-Interaction-Id", + "http://example.org/kb1/interaction/ask", "Content-Type", "application/json", "Accept", "*/*")); } catch (MalformedURLException e) { throw new RuntimeException(e); @@ -82,13 +82,13 @@ public void testSuspendingKnowledgeBase() throws MalformedURLException { HttpTester registerAnswer = new HttpTester(new URL(url + "/sc/ki"), "POST", "{\"knowledgeInteractionType\": \"AnswerKnowledgeInteraction\", " + "\"knowledgeInteractionName\": \"answer\"," + "\"graphPattern\": \"?a ?b ?c.\"}", - Map.of("Knowledge-Base-Id", "http://example.com/kb2", "Content-Type", "application/json", + Map.of("Knowledge-Base-Id", "http://example.org/kb2", "Content-Type", "application/json", "Accept", "*/*")); registerAnswer.expectStatus(200); System.out.println("Registered Answer"); HttpTester waitForRequest = new HttpTester(new URL(url + "/sc/handle"), "GET", null, - Map.of("Knowledge-Base-Id", "http://example.com/kb2", "Content-Type", "application/json", + Map.of("Knowledge-Base-Id", "http://example.org/kb2", "Content-Type", "application/json", "Accept", "*/*")); var body = waitForRequest.getBody(); System.out.println(body); @@ -98,22 +98,22 @@ public void testSuspendingKnowledgeBase() throws MalformedURLException { { "handleRequestId": 1, "bindingSet": [{ - "a": "", - "b": "", - "c": "" + "a": "", + "b": "", + "c": "" }] } """, Map.of("Content-Type", "application/json", "Accept", "*/*", "Knowledge-Base-Id", - "http://example.com/kb2", "Knowledge-Interaction-Id", - "http://example.com/kb2/interaction/answer")); + "http://example.org/kb2", "Knowledge-Interaction-Id", + "http://example.org/kb2/interaction/answer")); postAnswer.getBody(); System.out.println("Posted answer"); latch.await(); HttpTester deleteSC = new HttpTester(new URL(url + "/sc/"), "DELETE", "", Map.of("Knowledge-Base-Id", - "http://example.com/kb2", "Content-Type", "application/json", "Accept", "*/*")); + "http://example.org/kb2", "Content-Type", "application/json", "Accept", "*/*")); deleteSC.expectStatus(200); } catch (MalformedURLException e) { System.err.println(e.getMessage()); diff --git a/smart-connector-rest-server/src/main/resources/openapi-sc.yaml b/smart-connector-rest-server/src/main/resources/openapi-sc.yaml index e4e1c1fc8..de5cf9811 100644 --- a/smart-connector-rest-server/src/main/resources/openapi-sc.yaml +++ b/smart-connector-rest-server/src/main/resources/openapi-sc.yaml @@ -320,19 +320,19 @@ paths: examples: bindingset only: value: - - p: - q: - r: + - p: + q: + r: recipient and bindingset: value: recipientSelector: knowledgeBases: - - http://www.tno.nl/kb2 - - http://www.tno.nl/kb3 + - http://www.example.org/kb2 + - http://www.example.org/kb3 bindingSet: - - p: - q: - r: + - p: + q: + r: responses: '200': description: If the ask was successful it returns all found variable @@ -403,18 +403,18 @@ paths: examples: bindingset only: value: - - p: - q: - r: + - p: + q: + r: recipient and bindingset: value: recipientSelector: knowledgeBases: - - http://www.tno.nl/kb2 + - http://www.example.org/kb2 bindingSet: - - p: - q: - r: + - p: + q: + r: responses: '200': description: If the post was successful it optionally returns all diff --git a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeBaseImpl.java b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeBaseImpl.java index 24f368a0c..e45823226 100644 --- a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeBaseImpl.java +++ b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/util/KnowledgeBaseImpl.java @@ -111,7 +111,7 @@ public KnowledgeBaseImpl(String anId, String aName, String aDescription) { // id var someId = anId; if (someId == null) - someId = "https://www.tno.nl/" + this.name; + someId = "https://www.example.org/" + this.name; URI uri = null; try { 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 6d20b923d..c1673dabe 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 @@ -30,7 +30,7 @@ public class SingleLargeVsMultipleSmallGraphPatternTest { private KnowledgeNetwork kn1 = new KnowledgeNetwork(); private KnowledgeNetwork kn2 = new KnowledgeNetwork(); - private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "https://www.tno.nl/example/"); + private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "https://www.example.org/example/"); private static int NR_OF_BINDINGS = 20; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAddingDeletingManySmartConnectors.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAddingDeletingManySmartConnectors.java index 66a7c8047..222b843bd 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAddingDeletingManySmartConnectors.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAddingDeletingManySmartConnectors.java @@ -59,7 +59,7 @@ public MyKnowledgeBase(String name) { @Override public URI getKnowledgeBaseId() { try { - return new URI("http://www.tno.nl/" + name); + return new URI("http://www.example.org/" + name); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); 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 638a94b4a..0d7287b68 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 @@ -43,7 +43,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -54,7 +54,7 @@ public void testAskAnswer() throws InterruptedException { LOG.info("Waiting for ready..."); GraphPattern gp1 = new GraphPattern(prefixes, - "?a ."); + "?a ."); CommunicativeAct act1 = new CommunicativeAct(new HashSet<>(Arrays.asList(Vocab.INFORM_PURPOSE)), new HashSet<>(Arrays.asList(Vocab.RETRIEVE_KNOWLEDGE_PURPOSE))); @@ -67,14 +67,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); + binding.put("a", ""); bindingSet.add(binding); return bindingSet; }); LOG.info("Registered first AKI"); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); CommunicativeAct act2 = new CommunicativeAct(new HashSet<>(Arrays.asList(Vocab.INFORM_PURPOSE)), new HashSet<>(Arrays.asList(Vocab.RETRIEVE_KNOWLEDGE_PURPOSE))); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(act2, gp2); @@ -105,8 +105,8 @@ public void testAskAnswer() throws InterruptedException { assertTrue(!b.containsKey("a") && !b.containsKey("c"), "The variable names should follow the graph pattern of the requesting KB."); - assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); - assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); + assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); + assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); } 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 e8dda3237..a99328563 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 @@ -38,7 +38,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -48,7 +48,7 @@ public void testAskAnswer() throws InterruptedException { LOG.info("Waiting for ready..."); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -58,14 +58,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); @@ -90,8 +90,8 @@ public void testAskAnswer() throws InterruptedException { assertTrue(!b.containsKey("a") && !b.containsKey("c"), "The variable names should follow the graph pattern of the current KB."); - assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); - assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); + assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); + assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding"); } 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 00cf1358d..22a4ef2b2 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 @@ -44,7 +44,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -56,7 +56,7 @@ public void testAskAnswer() throws InterruptedException { kb4 = new KnowledgeBaseImpl("kb4"); kn.addKB(kb4); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -66,14 +66,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); AnswerKnowledgeInteraction aKI3 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp3); kb3.register(aKI3, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -83,14 +83,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("d", ""); - binding.put("e", ""); + binding.put("d", ""); + binding.put("e", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp4 = new GraphPattern(prefixes, "?f ?g."); + GraphPattern gp4 = new GraphPattern(prefixes, "?f ?g."); AnswerKnowledgeInteraction aKI4 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp4); kb4.register(aKI4, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -100,14 +100,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("f", ""); - binding.put("g", ""); + binding.put("f", ""); + binding.put("g", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); LOG.info("Waiting until everyone is up-to-date!"); 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 d6b89e854..c9631d9f0 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 @@ -38,7 +38,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -46,7 +46,7 @@ public void testAskAnswer() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c ."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c ."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -56,14 +56,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); + binding.put("a", ""); binding.put("c", "\"true\"^^"); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); @@ -93,7 +93,7 @@ public void testAskAnswer() throws InterruptedException { assertTrue(!b.containsKey("a") && !b.containsKey("c"), "The variable names should follow the graph pattern of the current KB."); - assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); + assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding"); } 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 c1f166822..0d8f36181 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 @@ -39,7 +39,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); this.kn = new KnowledgeNetwork(); KnowledgeBaseImpl kb1 = new KnowledgeBaseImpl("kb1"); @@ -63,13 +63,13 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("p", ""); - binding.put("q", ""); + binding.put("p", ""); + binding.put("q", ""); bindingSet.add(binding); binding = new Binding(); - binding.put("p", ""); - binding.put("q", ""); + binding.put("p", ""); + binding.put("q", ""); bindingSet.add(binding); return bindingSet; @@ -87,8 +87,8 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("x", ""); - binding.put("y", ""); + binding.put("x", ""); + binding.put("y", ""); bindingSet.add(binding); return bindingSet; @@ -106,12 +106,12 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("f", ""); - binding.put("g", ""); + binding.put("f", ""); + binding.put("g", ""); bindingSet.add(binding); binding = new Binding(); - binding.put("f", ""); - binding.put("g", ""); + binding.put("f", ""); + binding.put("g", ""); bindingSet.add(binding); return bindingSet; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerDatatype.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerDatatype.java index 91e650a46..6060b650c 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerDatatype.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerDatatype.java @@ -28,7 +28,7 @@ void test() throws InterruptedException, ExecutionException { kn.addKB(kb2); PrefixMapping pm = new PrefixMappingMem(); - pm.setNsPrefix("ex", "https://www.example.com/"); + pm.setNsPrefix("ex", "https://www.example.org/"); GraphPattern gp = new GraphPattern(pm, "?input ex:hasValue ?value . ?input ex:hasTestValue ?testValue . ?input ex:hasReverseResult ?reverseResult ."); @@ -47,7 +47,7 @@ void test() throws InterruptedException, ExecutionException { Binding b1 = new Binding(); b1.put("value", "\"My string value\"^^"); b1.put("testValue", "\"7\"^^"); - b1.put("input", ""); + b1.put("input", ""); b1.put("reverseResult", "\"eulav gnirts yM\"^^"); bs.add(b1); return bs; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerLargeBindingSets.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerLargeBindingSets.java index e6621f139..491aa330d 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerLargeBindingSets.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestAskAnswerLargeBindingSets.java @@ -50,7 +50,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, for (int i = 0; i < NR_OF_BINDINGS; i++) { b = new Binding(); for (char c : chars) - b.put(Character.toString(c), ""); + b.put(Character.toString(c), ""); kb1BS.add(b); } @@ -59,7 +59,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, for (int i = NR_OF_BINDINGS; i < (2 * NR_OF_BINDINGS); i++) { b = new Binding(); for (char c : chars) - b.put(Character.toString(c), ""); + b.put(Character.toString(c), ""); kb2BS.add(b); } @@ -70,7 +70,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -81,12 +81,12 @@ public void testAskAnswer() throws InterruptedException { kn.addKB(kb3); GraphPattern gp1 = new GraphPattern(prefixes, """ - ?a ?b . - ?a ?c . - ?a ?d . - ?a ?e . - ?e ?f . - ?e ?g . + ?a ?b . + ?a ?c . + ?a ?d . + ?a ?e . + ?e ?f . + ?e ?g . """); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); 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 77d100d57..c6bae8d41 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 @@ -36,7 +36,7 @@ public class TestAskAnswerManyKIs { private static KnowledgeBaseImpl kb3; private static KnowledgeBaseImpl kb4; - private String pattern = "?{} ?{}."; + private String pattern = "?{} ?{}."; private static KnowledgeNetwork kn; @@ -49,7 +49,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -80,8 +80,8 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a" + idx, ""); - binding.put("c" + idx, ""); + binding.put("a" + idx, ""); + binding.put("c" + idx, ""); bindingSet.add(binding); return bindingSet; @@ -97,8 +97,8 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("d" + idx, ""); - binding.put("e" + idx, ""); + binding.put("d" + idx, ""); + binding.put("e" + idx, ""); bindingSet.add(binding); return bindingSet; @@ -114,8 +114,8 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("f" + idx, ""); - binding.put("g" + idx, ""); + binding.put("f" + idx, ""); + binding.put("g" + idx, ""); bindingSet.add(binding); return bindingSet; 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 86f879a61..37b48f82d 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 @@ -66,8 +66,8 @@ public void testAskAnswer() throws InterruptedException { var antecedent = new HashSet(); var consequent = new HashSet(); - antecedent.add(new TriplePattern("?a ?b")); - consequent.add(new TriplePattern("?a ?b")); + antecedent.add(new TriplePattern("?a ?b")); + consequent.add(new TriplePattern("?a ?b")); rules.add(new Rule(antecedent, consequent)); antecedent = new HashSet(); @@ -80,8 +80,8 @@ public void testAskAnswer() throws InterruptedException { antecedent = new HashSet(); consequent = new HashSet(); - antecedent.add(new TriplePattern("?a ?d")); - consequent.add(new TriplePattern("?a ?d")); + antecedent.add(new TriplePattern("?a ?d")); + consequent.add(new TriplePattern("?a ?d")); rules.add(new Rule(antecedent, consequent)); antecedent = new HashSet(); @@ -104,8 +104,8 @@ public void testAskAnswer() throws InterruptedException { antecedent = new HashSet(); consequent = new HashSet(); - antecedent.add(new TriplePattern("?a ?m")); - consequent.add(new TriplePattern("?a ?m")); + antecedent.add(new TriplePattern("?a ?m")); + consequent.add(new TriplePattern("?a ?m")); rules.add(new Rule(antecedent, consequent)); kn.addKB(kb1); @@ -136,13 +136,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp1 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -158,16 +158,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -175,13 +175,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp2 = new GraphPattern( "?construcao ." - + "?construcao ?coisaEspacial ." + + "?construcao ?coisaEspacial ." + "?coisaEspacial ." + "?coisaEspacial ?codigoPostal . " - + "?construcao ?classeDeEnergia ." - + "?construcao ?fornecedorDeEnergia ." - + "?construcao ?gerenteDeFlexibilidade ." - + "?construcao ?IDdaComunidade ." + + "?construcao ?classeDeEnergia ." + + "?construcao ?fornecedorDeEnergia ." + + "?construcao ?gerenteDeFlexibilidade ." + + "?construcao ?IDdaComunidade ." + "?construcao ?edificioEspaco ." + "?edificioEspaco ." + "?edificioEspaco ?dispositivoDeConstrucao ." @@ -197,16 +197,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("construcao", ""); - binding.put("coisaEspacial", ""); - binding.put("codigoPostal", ""); - binding.put("classeDeEnergia", ""); - binding.put("fornecedorDeEnergia", ""); - binding.put("gerenteDeFlexibilidade", ""); - binding.put("IDdaComunidade", ""); - binding.put("edificioEspaco", ""); - binding.put("dispositivoDeConstrucao", ""); - binding.put("poderSubscrito", ""); + binding.put("construcao", ""); + binding.put("coisaEspacial", ""); + binding.put("codigoPostal", ""); + binding.put("classeDeEnergia", ""); + binding.put("fornecedorDeEnergia", ""); + binding.put("gerenteDeFlexibilidade", ""); + binding.put("IDdaComunidade", ""); + binding.put("edificioEspaco", ""); + binding.put("dispositivoDeConstrucao", ""); + binding.put("poderSubscrito", ""); bindingSet.add(binding); return bindingSet; @@ -214,13 +214,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp4 = new GraphPattern( "?zgrada ." - + "?zgrada ?prostornaStvar ." + + "?zgrada ?prostornaStvar ." + "?prostornaStvar ." + "?prostornaStvar ?postanskiBroj . " - + "?zgrada ?energetskaKlasa ." - + "?zgrada ?dobavljacEnergije ." - + "?zgrada ?menadzerFleksibilnosti ." - + "?zgrada ?zajednica ." + + "?zgrada ?energetskaKlasa ." + + "?zgrada ?dobavljacEnergije ." + + "?zgrada ?menadzerFleksibilnosti ." + + "?zgrada ?zajednica ." + "?zgrada ?zgradniProstor ." + "?zgradniProstor ." + "?zgradniProstor ?zgradniUredjaj ." @@ -235,15 +235,15 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("zgrada", ""); - binding.put("prostornaStvar", ""); - binding.put("postanskiBroj", ""); - binding.put("energetskaKlasa", ""); - binding.put("dobavljacEnergije", ""); - binding.put("menadzerFleksibilnosti", ""); - binding.put("zajednica", ""); - binding.put("zgradniProstor", ""); - binding.put("zgradniUredjaj", ""); + binding.put("zgrada", ""); + binding.put("prostornaStvar", ""); + binding.put("postanskiBroj", ""); + binding.put("energetskaKlasa", ""); + binding.put("dobavljacEnergije", ""); + binding.put("menadzerFleksibilnosti", ""); + binding.put("zajednica", ""); + binding.put("zgradniProstor", ""); + binding.put("zgradniUredjaj", ""); bindingSet.add(binding); return bindingSet; @@ -251,13 +251,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp5 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -273,16 +273,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -290,13 +290,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp6 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -312,16 +312,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -329,13 +329,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp7 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -351,16 +351,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -368,13 +368,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp8 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -390,16 +390,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -407,13 +407,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp9 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -429,16 +429,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -446,13 +446,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp10 = new GraphPattern( "?building ." - + "?building ?spatialThing ." + + "?building ?spatialThing ." + "?spatialThing ." + "?spatialThing ?zipCode . " - + "?building ?energyClass ." - + "?building ?energyProvider ." - + "?building ?flexibilityManager ." - + "?building ?communityID ." + + "?building ?energyClass ." + + "?building ?energyProvider ." + + "?building ?flexibilityManager ." + + "?building ?communityID ." + "?building ?buildingSpace ." + "?buildingSpace ." + "?buildingSpace ?buildingDevice ." @@ -468,16 +468,16 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("building", ""); - binding.put("spatialThing", ""); - binding.put("zipCode", ""); - binding.put("energyClass", ""); - binding.put("energyProvider", ""); - binding.put("flexibilityManager", ""); - binding.put("communityID", ""); - binding.put("buildingSpace", ""); - binding.put("buildingDevice", ""); - binding.put("powerSubscribed", ""); + binding.put("building", ""); + binding.put("spatialThing", ""); + binding.put("zipCode", ""); + binding.put("energyClass", ""); + binding.put("energyProvider", ""); + binding.put("flexibilityManager", ""); + binding.put("communityID", ""); + binding.put("buildingSpace", ""); + binding.put("buildingDevice", ""); + binding.put("powerSubscribed", ""); bindingSet.add(binding); return bindingSet; @@ -485,13 +485,13 @@ public void testAskAnswer() throws InterruptedException { GraphPattern gp3 = new GraphPattern( "?gebouw ." - + "?gebouw ?ruimtelijkDing ." + + "?gebouw ?ruimtelijkDing ." + "?ruimtelijkDing ." + "?ruimtelijkDing ?postcode . " - + "?gebouw ?energieklasse ." - + "?gebouw ?energieaanbieder ." - + "?gebouw ?flexibiliteitManager ." - + "?gebouw ?gemeenschapsID ." + + "?gebouw ?energieklasse ." + + "?gebouw ?energieaanbieder ." + + "?gebouw ?flexibiliteitManager ." + + "?gebouw ?gemeenschapsID ." + "?gebouw ?gebouwRuimte ." + "?gebouwRuimte ." + "?gebouwRuimte ?gebouwApparaat ." 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 663c854f3..010ab126b 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 @@ -40,7 +40,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -48,7 +48,7 @@ public void testAskAnswer() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI1 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp); kb1.register(aKI1, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -58,14 +58,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - gp = new GraphPattern(prefixes, "?x ?y."); + gp = new GraphPattern(prefixes, "?x ?y."); AnswerKnowledgeInteraction aKI2 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp); kb1.register(aKI2, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -75,14 +75,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("x", ""); - binding.put("y", ""); + binding.put("x", ""); + binding.put("y", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?p ?q."); + GraphPattern gp2 = new GraphPattern(prefixes, "?p ?q."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); 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 b9a412125..613179493 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 @@ -39,7 +39,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -47,7 +47,7 @@ public void testAskAnswer() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -57,14 +57,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); @@ -89,8 +89,8 @@ public void testAskAnswer() throws InterruptedException { assertTrue(!b.containsKey("a") && !b.containsKey("c"), "The variable names should follow the graph pattern of the current KB."); - assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); - assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); + assertEquals("", b.get("x"), "Binding of 'x' is incorrect."); + assertEquals("", b.get("y"), "Binding of 'y' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding"); @@ -98,7 +98,7 @@ public void testAskAnswer() throws InterruptedException { kb1.unregister(aKI); kb2.unregister(askKI); - GraphPattern gp3 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp3 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI3 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp3); kb1.register(aKI3, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -107,13 +107,13 @@ public void testAskAnswer() throws InterruptedException { "Should not have bindings in this binding set."); BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp4 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp4 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI4 = new AskKnowledgeInteraction(new CommunicativeAct(), gp4); kb2.register(askKI4); @@ -149,8 +149,8 @@ public void testAskAnswer() throws InterruptedException { assertTrue(!b3.containsKey("a") && !b3.containsKey("c"), "The variable names should follow the graph pattern of the current KB."); - assertEquals("", b3.get("x"), "Binding of 'x' is incorrect."); - assertEquals("", b3.get("y"), "Binding of 'y' is incorrect."); + assertEquals("", b3.get("x"), "Binding of 'x' is incorrect."); + assertEquals("", b3.get("y"), "Binding of 'y' is incorrect."); assertFalse(iter3.hasNext(), "This BindingSet should only have a single binding"); 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 e6c3186e3..297d5812e 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 @@ -40,7 +40,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); } 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 5a2087510..3c58160f4 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 @@ -44,7 +44,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); } @@ -77,8 +77,8 @@ public void testAskAnswerWithGapsEnabled() throws InterruptedException, URISynta TriplePattern triple = gapiter.next(); String tpString = FmtUtils.stringForTriple(triple.asTriple(), new PrefixMappingZero()); LOG.info("Gap is " + tpString); - assertEquals("?a ?c", tpString, - "Gap should be ?a ?c"); + assertEquals("?a ?c", tpString, + "Gap should be ?a ?c"); } } BindingSet bindings = result.getBindings(); @@ -134,8 +134,8 @@ public void instantiateAnswerRelationsKB() { // add 1 dummy binding to the answer BindingSet bindingSet = new BindingSet(); Binding binding1 = new Binding(); - binding1.put("a", ""); - binding1.put("b", ""); + binding1.put("a", ""); + binding1.put("b", ""); bindingSet.add(binding1); return bindingSet; 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 c0426e460..45df8ac98 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 @@ -45,7 +45,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); } @@ -134,8 +134,8 @@ public void instantiateAnswerRelationsKB() { // add 1 dummy binding to the answer BindingSet bindingSet = new BindingSet(); Binding binding1 = new Binding(); - binding1.put("a", ""); - binding1.put("b", ""); + binding1.put("a", ""); + binding1.put("b", ""); bindingSet.add(binding1); return bindingSet; 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 3bb055368..b15ec7cde 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 @@ -38,7 +38,7 @@ public static void setup() throws InterruptedException, BrokenBarrierException, prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); } 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 42c18dc52..7caa9ab87 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 @@ -31,7 +31,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -39,7 +39,7 @@ public void testAskAnswer() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { var aBindingSet = anAnswerExchangeInfo.getIncomingBindings(); @@ -58,12 +58,12 @@ public void testAskAnswer() throws InterruptedException { assertTrue(b.containsKey("a")); assertFalse(b.containsKey("c")); - if (b.containsKey("a") && b.get("a").equals("")) { - newBinding.put("a", ""); - newBinding.put("c", ""); - } else if (b.containsKey("a") && b.get("a").equals("")) { - newBinding.put("a", ""); - newBinding.put("c", ""); + if (b.containsKey("a") && b.get("a").equals("")) { + newBinding.put("a", ""); + newBinding.put("c", ""); + } else if (b.containsKey("a") && b.get("a").equals("")) { + newBinding.put("a", ""); + newBinding.put("c", ""); } newBindingSet.add(newBinding); } @@ -71,7 +71,7 @@ public void testAskAnswer() throws InterruptedException { return newBindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); @@ -84,10 +84,10 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindings2 = new BindingSet(); Binding b1 = new Binding(); - b1.put("x", ""); + b1.put("x", ""); bindings2.add(b1); Binding b2 = new Binding(); - b2.put("x", ""); + b2.put("x", ""); bindings2.add(b2); AskResult result = kb2.ask(askKI, bindings2).get(); @@ -111,12 +111,12 @@ public void testAskAnswer() throws InterruptedException { assertTrue(b.containsKey("x") && b.containsKey("y")); - if (b.get("x").equals("")) { - assertTrue(b.get("y").equals("")); + if (b.get("x").equals("")) { + assertTrue(b.get("y").equals("")); } - if (b.get("x").equals("")) { - assertTrue(b.get("y").equals("")); + if (b.get("x").equals("")) { + assertTrue(b.get("y").equals("")); } } 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 e5d8da9ce..d807a7f06 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 @@ -37,7 +37,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -72,7 +72,7 @@ public void testAskAnswer() throws InterruptedException { Binding b = iter.next(); assertTrue(b.containsKey("x"), "The variable should be bound."); - assertTrue(b.get("x").equals("")); + assertTrue(b.get("x").equals("")); } @AfterAll 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 07481ba64..66ab2d006 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 @@ -45,7 +45,7 @@ public void testAskAnswer() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -57,7 +57,7 @@ public void testAskAnswer() throws InterruptedException { kb4 = new KnowledgeBaseImpl("kb4"); kn.addKB(kb4); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -67,14 +67,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); AnswerKnowledgeInteraction aKI3 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp3); kb3.register(aKI3, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -84,14 +84,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("d", ""); - binding.put("e", ""); + binding.put("d", ""); + binding.put("e", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp4 = new GraphPattern(prefixes, "?f ?g."); + GraphPattern gp4 = new GraphPattern(prefixes, "?f ?g."); AnswerKnowledgeInteraction aKI4 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp4); kb4.register(aKI4, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -101,14 +101,14 @@ public void testAskAnswer() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("f", ""); - binding.put("g", ""); + binding.put("f", ""); + binding.put("g", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2 = new GraphPattern(prefixes, "?x ?y."); AskKnowledgeInteraction askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2); kb2.register(askKI); @@ -140,8 +140,8 @@ public void testAskAnswer() throws InterruptedException { assertTrue(bind.containsKey("x")); assertTrue(bind.containsKey("y")); - assertEquals(bind.get("x"), ""); - assertEquals(bind.get("y"), ""); + assertEquals(bind.get("x"), ""); + assertEquals(bind.get("y"), ""); LOG.info("Binding: {}", bind); // Recipient Selector is multiple KBs (kb1 & kb3). @@ -158,14 +158,14 @@ public void testAskAnswer() throws InterruptedException { assertEquals(2, bindings.size()); assertTrue(bindings.stream() - .allMatch(b -> (b.get("x").equals("") - || b.get("x").equals("")) - && (b.get("y").equals("") - || b.get("y").equals("")))); - assertTrue(bindings.stream().anyMatch(b -> b.get("x").equals("") - && b.get("y").equals(""))); - assertTrue(bindings.stream().anyMatch(b -> b.get("x").equals("") - && b.get("y").equals(""))); + .allMatch(b -> (b.get("x").equals("") + || b.get("x").equals("")) + && (b.get("y").equals("") + || b.get("y").equals("")))); + assertTrue(bindings.stream().anyMatch(b -> b.get("x").equals("") + && b.get("y").equals(""))); + assertTrue(bindings.stream().anyMatch(b -> b.get("x").equals("") + && b.get("y").equals(""))); // Recipient Selector asks all Knowledge Bases (kb1, kb3, kb4). 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 2dc7c98c3..4938722e5 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 @@ -54,7 +54,7 @@ public void testComplexGraphPattern() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); prefixes.setNsPrefix("saref", "https://saref.etsi.org/core/"); kn = new KnowledgeNetwork(); @@ -320,7 +320,7 @@ private void createDevicesKB(PrefixMappingMem prefixes, KnowledgeNetwork kn) { bindingSet.add(binding); binding = new Binding(); - binding.put("type", ""); + binding.put("type", ""); binding.put("d", ""); binding.put("l", "\"Open Close Sensor 1\""); binding.put("c", "\"The open close sensor of the front door.\""); 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 ebef2d5fc..2de681c1b 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 @@ -56,10 +56,10 @@ public static void setup() throws InterruptedException, BrokenBarrierException, PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); - GraphPattern gp1_1 = new GraphPattern(prefixes, "?a ?c."); - GraphPattern gp1_2 = new GraphPattern(prefixes, "?b ?d."); + GraphPattern gp1_1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1_2 = new GraphPattern(prefixes, "?b ?d."); answerKI1 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1_1); kb1.register(answerKI1, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -69,8 +69,8 @@ public static void setup() throws InterruptedException, BrokenBarrierException, BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); return bindingSet; @@ -82,14 +82,14 @@ public static void setup() throws InterruptedException, BrokenBarrierException, BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("b", ""); - binding.put("d", ""); + binding.put("b", ""); + binding.put("d", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp3_1 = new GraphPattern(prefixes, "?d ?e."); - GraphPattern gp3_2 = new GraphPattern(prefixes, "?f ?g."); + GraphPattern gp3_1 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp3_2 = new GraphPattern(prefixes, "?f ?g."); answerKI3 = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp3_1); kb3.register(answerKI3, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { @@ -100,8 +100,8 @@ public static void setup() throws InterruptedException, BrokenBarrierException, BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("d", ""); - binding.put("e", ""); + binding.put("d", ""); + binding.put("e", ""); bindingSet.add(binding); return bindingSet; @@ -113,14 +113,14 @@ public static void setup() throws InterruptedException, BrokenBarrierException, BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("f", ""); - binding.put("g", ""); + binding.put("f", ""); + binding.put("g", ""); bindingSet.add(binding); return bindingSet; }); - GraphPattern gp2_1 = new GraphPattern(prefixes, "?x ?y."); - GraphPattern gp2_2 = new GraphPattern(prefixes, "?w ?z."); + GraphPattern gp2_1 = new GraphPattern(prefixes, "?x ?y."); + GraphPattern gp2_2 = new GraphPattern(prefixes, "?w ?z."); askKI2 = new AskKnowledgeInteraction(new CommunicativeAct(), gp2_1); kb2.register(askKI2); postKI2 = new PostKnowledgeInteraction(new CommunicativeAct(), gp2_1, gp2_2); @@ -153,8 +153,8 @@ public void testAskAnswer() throws InterruptedException { for (Binding b : bindings) { assertTrue(b.containsKey("x")); assertTrue(b.containsKey("y")); - assertEquals(b.get("x"), ""); - assertEquals(b.get("y"), ""); + assertEquals(b.get("x"), ""); + assertEquals(b.get("y"), ""); } } catch (InterruptedException | ExecutionException e) { fail(); @@ -172,8 +172,8 @@ public void testPostReact() throws InterruptedException { var bindingset = new BindingSet(); var binding = new Binding(); - binding.put("x", ""); - binding.put("y", ""); + binding.put("x", ""); + binding.put("y", ""); bindingset.add(binding); result = kb2.post(postKI2, bindingset).get(); @@ -193,8 +193,8 @@ public void testPostReact() throws InterruptedException { for (Binding b : bindings) { assertTrue(b.containsKey("w")); assertTrue(b.containsKey("z")); - assertEquals(b.get("w"), ""); - assertEquals(b.get("z"), ""); + assertEquals(b.get("w"), ""); + assertEquals(b.get("z"), ""); } } catch (InterruptedException | ExecutionException e) { fail(); 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 9d98907e3..988039c05 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 @@ -59,35 +59,35 @@ public void setup() throws InterruptedException, BrokenBarrierException, Timeout prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); -// prefixes.setNsPrefix("tno", "https://www.tno.nl/"); - prefixes.setNsPrefix("v1905", "https://www.tno.nl/defense/ontology/v1905/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); +// prefixes.setNsPrefix("tno", "https://www.example.org/"); + prefixes.setNsPrefix("v1905", "https://www.example.org/defense/ontology/v1905/"); // add extra domain knowledge in the form of a rule to kbHVTSearcher. HashSet consequent1 = new HashSet(); consequent1.add(new TriplePattern( - "?id ")); + "?id ")); HashSet antecedent1 = new HashSet(); antecedent1.add(new TriplePattern( - "?id ")); - antecedent1.add(new TriplePattern("?id \"Russia\"")); + "?id ")); + antecedent1.add(new TriplePattern("?id \"Prussia\"")); HashSet consequent2 = new HashSet(); consequent2.add(new TriplePattern( - "?id ")); + "?id ")); HashSet antecedent2 = new HashSet(); antecedent2.add(new TriplePattern( - "?id ")); - antecedent2.add(new TriplePattern("?id \"Russian\"")); + "?id ")); + antecedent2.add(new TriplePattern("?id \"Prussian\"")); HashSet consequent3 = new HashSet(); consequent3.add(new TriplePattern( - "?id ")); + "?id ")); HashSet antecedent3 = new HashSet(); antecedent3.add(new TriplePattern( - "?id ")); - antecedent3.add(new TriplePattern("?id \"Russian\"")); - antecedent3.add(new TriplePattern("?id \"Russia\"")); + "?id ")); + antecedent3.add(new TriplePattern("?id \"Prussian\"")); + antecedent3.add(new TriplePattern("?id \"Prussia\"")); ruleSet = new HashSet<>(); ruleSet.add(new Rule(antecedent1, consequent1)); @@ -133,7 +133,7 @@ public void testAskAnswer() throws InterruptedException, URISyntaxException { assertTrue(iter.hasNext(), "there should be at least 1 binding"); Binding b = iter.next(); - assertEquals("", b.get("id"), "Binding of 'id' is incorrect."); + assertEquals("", b.get("id"), "Binding of 'id' is incorrect."); assertEquals("\"Bla\"", b.get("name"), "Binding of 'name' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding"); @@ -141,7 +141,7 @@ public void testAskAnswer() throws InterruptedException, URISyntaxException { // start testing post of targets! BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("id", ""); + binding.put("id", ""); binding.put("name", "\"Bla\""); bindingSet.add(binding); @@ -287,11 +287,11 @@ public void instantiateObserverKB() { // add 2 dummy bindings to the answer BindingSet bindingSet = new BindingSet(); Binding binding1 = new Binding(); - binding1.put("id", ""); + binding1.put("id", ""); binding1.put("name", "\"Eek\"^^"); bindingSet.add(binding1); Binding binding2 = new Binding(); - binding2.put("id", ""); + binding2.put("id", ""); binding2.put("name", "\"Bla\"^^"); bindingSet.add(binding2); @@ -328,9 +328,9 @@ public void instantiateTargetLanguageSupplierKB() { String language = ""; Binding rb = new Binding(); rb.put("id", id); - if (b.get("id").equals("")) { - language = "\"Russian\""; - } else if (b.get("id").equals("")) { + if (b.get("id").equals("")) { + language = "\"Prussian\""; + } else if (b.get("id").equals("")) { language = "\"Dutch\""; } else { language = "\"Flemish\""; @@ -375,9 +375,9 @@ public void instantiateTargetCountrySupplierKB() { String country = ""; Binding rb = new Binding(); rb.put("id", id); - if (b.get("id").equals("")) { - country = "\"Russia\""; - } else if (b.get("id").equals("")) { + if (b.get("id").equals("")) { + country = "\"Prussia\""; + } else if (b.get("id").equals("")) { country = "\"Holland\""; } else { country = "\"Belgium\""; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestGraphPatternMatch.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestGraphPatternMatch.java index 7701d776b..a5d04150b 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestGraphPatternMatch.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestGraphPatternMatch.java @@ -65,19 +65,19 @@ public void testMultipleIsomorphisms() throws ParseException { new String[] { "?a ?b . ?b ?c . ?c ?a .", "?z ?x . ?y ?z . ?x ?y ." }, new String[] { - "?id .\n" - + "?id ?name .\n" + "?id .\n" + + "?id ?name .\n" + "?obs .\n" + "?obs ?id .\n" - + "?obs .\n" + + "?obs .\n" + "?obs ?position .", "?a ?b .\n" - + "?a .\n" + + "?a .\n" + "?a ?c .\n" + "?a .\n" - + "?c ?d .\n" - + "?c ." + + "?c ?d .\n" + + "?c ." }, @@ -103,35 +103,35 @@ public void testMultipleIsomorphisms() throws ParseException { // @formatter: off - new String[] { "?a ?b", "?a ?b" }, - new String[] { "?a ?b . ?b ?a .", - "?a ?b . ?a ?b ." }, - new String[] { "?a ?b . ?b ?a .", - "?b ?a . ?b ?a ." }, - new String[] { "?a ?b . ?b ?a .", - "?b ?a . ?b ?a ." }, + new String[] { "?a ?b", "?a ?b" }, + new String[] { "?a ?b . ?b ?a .", + "?a ?b . ?a ?b ." }, + new String[] { "?a ?b . ?b ?a .", + "?b ?a . ?b ?a ." }, + new String[] { "?a ?b . ?b ?a .", + "?b ?a . ?b ?a ." }, - new String[] { " ?b1 ?d . ?a1 ?aap1 ?b1 . ?a ?aap1 ?b .", - "?a2 ?aap2 ?b . ?b ?d . ?a ?aap2 ?b" }, + new String[] { " ?b1 ?d . ?a1 ?aap1 ?b1 . ?a ?aap1 ?b .", + "?a2 ?aap2 ?b . ?b ?d . ?a ?aap2 ?b" }, new String[] { - "?id .\n" - + "?id ?name .\n" + "?id .\n" + + "?id ?name .\n" + "?obs .\n" + "?obs ?id .\n" - + "?obs .\n" + + "?obs .\n" + "?obs ?position .", "?a ?b .\n" - + "?a .\n" + + "?a .\n" + "?a ?c .\n" + "?a .\n" - + "?c ?d .\n" - + "?c ." + + "?c ?d .\n" + + "?c ." }, new String[] { - "?obs . ?obs . ?obs . ?obs ?temp . ", - "?obs . ?obs . ?obs . ?obs ?temp . " } + "?obs . ?obs . ?obs . ?obs ?temp . ", + "?obs . ?obs . ?obs . ?obs ?temp . " } // @formatter: on }; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestKnowledgeGapDetection.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestKnowledgeGapDetection.java index ed40e703d..51a19e01e 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestKnowledgeGapDetection.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestKnowledgeGapDetection.java @@ -38,7 +38,7 @@ public class TestKnowledgeGapDetection { public void setup() throws InterruptedException, BrokenBarrierException, TimeoutException { prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); addDomainKnowledge(); instantiateImperialEggSearcherKB(); @@ -54,13 +54,13 @@ private void addDomainKnowledge() { this.ruleSet = new HashSet<>(); HashSet consequent1 = new HashSet<>(); consequent1.add(new TriplePattern( - "?id ")); + "?id ")); HashSet antecedent1 = new HashSet<>(); antecedent1.add(new TriplePattern( - "?id ")); - antecedent1.add(new TriplePattern("?id \"Alexander III\"")); - antecedent1.add(new TriplePattern("?id \"Russia\"")); - antecedent1.add(new TriplePattern("?id \"House of Fabergé\"")); + "?id ")); + antecedent1.add(new TriplePattern("?id \"Alexander III\"")); + antecedent1.add(new TriplePattern("?id \"Russia\"")); + antecedent1.add(new TriplePattern("?id \"House of Fabergé\"")); this.ruleSet.add(new Rule("Domain knowledge", antecedent1, consequent1, new Rule.AntecedentToConsequentBindingSetHandler(antecedent1))); } @@ -88,7 +88,7 @@ public void testKnowledgeGap() throws InterruptedException, ExecutionException { @Test public void testKnowledgeGapNoMatchingVars() throws InterruptedException, ExecutionException { GraphPattern gp = new GraphPattern(prefixes, - "?iq rdf:type . ?iq ?company . ?iq ?country . ?iq ?image ."); + "?iq rdf:type . ?iq ?company . ?iq ?country . ?iq ?image ."); this.askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp, "askImperialEggsNonMatching", false, false, true, MatchStrategy.SUPREME_LEVEL); kbImperialEggSearcher.register(this.askKI); @@ -116,7 +116,7 @@ public void testKnowledgeGapNoMatchingVars() throws InterruptedException, Execut @Test public void testNoKnowledgeGap() throws InterruptedException, ExecutionException { GraphPattern gp = new GraphPattern(prefixes, - "?iq rdf:type . ?iq ?image ."); + "?iq rdf:type . ?iq ?image ."); this.askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp, "askImperialEggNoGap", false, false, true, MatchStrategy.SUPREME_LEVEL); kbImperialEggSearcher.register(this.askKI); @@ -137,7 +137,7 @@ public void testNoKnowledgeGap() throws InterruptedException, ExecutionException @Test public void testKnowledgeGapWithoutPrefixes() throws InterruptedException, ExecutionException { GraphPattern gp = new GraphPattern( - "?id . ?id ?image ."); + "?id . ?id ?image ."); this.askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp, "askImperialEggNoGap", false, false, true, MatchStrategy.SUPREME_LEVEL); kbImperialEggSearcher.register(this.askKI); @@ -164,7 +164,7 @@ public void instantiateImperialEggSearcherKB() { kbImperialEggSearcher.setReasonerLevel(4); GraphPattern gp2 = new GraphPattern(prefixes, - "?id rdf:type . ?id ?company . ?id ?country . ?id ?image ."); + "?id rdf:type . ?id ?company . ?id ?country . ?id ?image ."); this.askKI = new AskKnowledgeInteraction(new CommunicativeAct(), gp2, "askImperialEggs", false, false, true, MatchStrategy.SUPREME_LEVEL); kbImperialEggSearcher.register(this.askKI); @@ -176,7 +176,7 @@ public void instantiateObserverKB() { kbEggObserver.setReasonerLevel(4); GraphPattern gp1 = new GraphPattern(prefixes, - "?id . ?id ?image ."); + "?id . ?id ?image ."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1, "answerEggs"); kbEggObserver.register(aKI, (AnswerHandler) (anAKI, anAnswerExchangeInfo) -> { assertTrue( @@ -185,11 +185,11 @@ public void instantiateObserverKB() { "Should not have bindings in this binding set."); BindingSet bindingSet = new BindingSet(); Binding binding1 = new Binding(); - binding1.put("id", ""); + binding1.put("id", ""); binding1.put("image", "\"Picture Of Hen Fabergé Egg\"^^"); bindingSet.add(binding1); Binding binding2 = new Binding(); - binding2.put("id", ""); + binding2.put("id", ""); binding2.put("image", "\"Picture of Third Imperial Fabergé Egg\""); bindingSet.add(binding2); 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 0202779d5..c8c7a2ec4 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 @@ -82,7 +82,7 @@ public void testChangedKB() { kn.addKB(kb2); kn.sync(); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); AnswerKnowledgeInteraction aKI = new AnswerKnowledgeInteraction(new CommunicativeAct(), gp1); kb1.register(aKI, (anAKI, anAnswerExchangeInfo) -> new BindingSet()); } 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 7d630127c..2ae1dc7c8 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 @@ -31,7 +31,7 @@ public class TestPostReact { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -39,11 +39,11 @@ public void testPostReact() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction pKI = new PostKnowledgeInteraction(new CommunicativeAct(), gp1, null); kb1.register(pKI); - GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction rKI = new ReactKnowledgeInteraction(new CommunicativeAct(), gp2, null); kb2.register(rKI, ((anRKI, aReactExchangeInfo) -> { LOG.trace("KB2 reacting..."); @@ -53,8 +53,8 @@ public void testPostReact() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); - assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); + assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); @@ -67,8 +67,8 @@ public void testPostReact() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); try { 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 0c51ec08c..7f8ba70b0 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 @@ -32,7 +32,7 @@ public class TestPostReact2 { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -43,11 +43,11 @@ public void testPostReact() throws InterruptedException { kn.addKB(kb3); // start registering - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction ki1 = new PostKnowledgeInteraction(new CommunicativeAct(), gp1, null); kb1.register(ki1); - GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction ki2 = new ReactKnowledgeInteraction(new CommunicativeAct(), gp2, null); kb2.register(ki2, (anRKI, aReactExchangeInfo) -> { @@ -60,15 +60,15 @@ public void testPostReact() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' should be correct."); - assertEquals("", b.get("e"), "Binding of 'e' should be correct."); + assertEquals("", b.get("d"), "Binding of 'd' should be correct."); + assertEquals("", b.get("e"), "Binding of 'e' should be correct."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); return new BindingSet(); }); - GraphPattern gp3 = new GraphPattern(prefixes, "?f ?g"); + GraphPattern gp3 = new GraphPattern(prefixes, "?f ?g"); ReactKnowledgeInteraction ki3 = new ReactKnowledgeInteraction(new CommunicativeAct(), gp3, null); kb3.register(ki3, (anRKI, aReactExchangeInfo) -> { @@ -78,8 +78,8 @@ public void testPostReact() throws InterruptedException { Iterator iter = argument.iterator(); Binding b = iter.next(); - assertEquals("", b.get("f"), "Binding of 'f' should be correct."); - assertEquals("", b.get("g"), "Binding of 'g' should be correct."); + assertEquals("", b.get("f"), "Binding of 'f' should be correct."); + assertEquals("", b.get("g"), "Binding of 'g' should be correct."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); @@ -92,8 +92,8 @@ public void testPostReact() throws InterruptedException { // start exchanging BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); try { diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact4.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact4.java index 758288292..a42f49a4e 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact4.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact4.java @@ -32,7 +32,7 @@ public void testPostReactTimeout() throws InterruptedException { System.setProperty(SmartConnectorConfig.CONF_KEY_KE_KB_WAIT_TIMEOUT, "1"); PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -40,11 +40,11 @@ public void testPostReactTimeout() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction pKI = new PostKnowledgeInteraction(new CommunicativeAct(), gp1, null); kb1.register(pKI); - GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction rKI = new ReactKnowledgeInteraction(new CommunicativeAct(), gp2, null); kb2.register(rKI, ((anRKI, aReactExchangeInfo) -> { LOG.trace("KB2 reacting..."); @@ -54,8 +54,8 @@ public void testPostReactTimeout() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); - assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); + assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); @@ -73,8 +73,8 @@ public void testPostReactTimeout() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); try { diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact5.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact5.java index ae0d3434c..ac24f020f 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact5.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReact5.java @@ -32,7 +32,7 @@ public void testPostReactTimeout() throws InterruptedException { System.setProperty(SmartConnectorConfig.CONF_KEY_KE_KB_WAIT_TIMEOUT, "1"); PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -40,13 +40,13 @@ public void testPostReactTimeout() throws InterruptedException { kb2 = new KnowledgeBaseImpl("kb2"); kn.addKB(kb2); - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); - GraphPattern gp2 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp2 = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction pKI = new PostKnowledgeInteraction(new CommunicativeAct(), gp1, gp2); kb1.register(pKI); - GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); - GraphPattern gp4 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp3 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp4 = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction rKI = new ReactKnowledgeInteraction(new CommunicativeAct(), gp3, gp4); kb2.register(rKI, ((anRKI, aReactExchangeInfo) -> { LOG.trace("KB2 reacting..."); @@ -56,8 +56,8 @@ public void testPostReactTimeout() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); - assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); + assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("e"), "Binding of 'e' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); @@ -81,8 +81,8 @@ public void testPostReactTimeout() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); try { diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactDatatype.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactDatatype.java index d2ee8d30a..65f12abc4 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactDatatype.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactDatatype.java @@ -32,7 +32,7 @@ public class TestPostReactDatatype { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -54,7 +54,7 @@ public void testPostReact() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); assertEquals("\"eek\"^^", b.get("e"), "Binding of 'e' is incorrect."); @@ -68,7 +68,7 @@ public void testPostReact() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); + binding.put("a", ""); binding.put("c", "\"eek\"^^"); bindingSet.add(binding); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactLanguageTag.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactLanguageTag.java index f7382494e..1fb25d8ef 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactLanguageTag.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestPostReactLanguageTag.java @@ -32,7 +32,7 @@ public class TestPostReactLanguageTag { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -54,7 +54,7 @@ public void testPostReact() throws InterruptedException { assertTrue(iter.hasNext(), "There should be at least a single binding."); Binding b = iter.next(); - assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("d"), "Binding of 'd' is incorrect."); assertEquals("\"eek\"@en", b.get("e"), "Binding of 'e' is incorrect."); @@ -68,7 +68,7 @@ public void testPostReact() throws InterruptedException { BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); + binding.put("a", ""); binding.put("c", "\"eek\"@en"); bindingSet.add(binding); 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 eebb795fd..af328bb8c 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 @@ -29,7 +29,7 @@ public class TestPostReactPerformance { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -38,11 +38,11 @@ public void testPostReact() throws InterruptedException { kn.addKB(kb2); // register capabilities - GraphPattern kb1GP = new GraphPattern(prefixes, "?a ?c."); + GraphPattern kb1GP = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction postKI = new PostKnowledgeInteraction(new CommunicativeAct(), kb1GP, null); kb1.register(postKI); - GraphPattern kb2GP = new GraphPattern(prefixes, "?d ?e."); + GraphPattern kb2GP = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction reactKI = new ReactKnowledgeInteraction(new CommunicativeAct(), kb2GP, null); long bindingCount = 100; long count = 1000; @@ -69,8 +69,8 @@ public void testPostReact() throws InterruptedException { Binding b; for (int i = 0; i < bindingCount; i++) { b = new Binding(); - b.put("a", ""); - b.put("c", ""); + b.put("a", ""); + b.put("c", ""); bs.add(b); } 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 f7a02aecd..f03ff9d2e 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 @@ -31,7 +31,7 @@ public class TestPostRecipientSelector { public void testPostReact() throws InterruptedException { PrefixMappingMem prefixes = new PrefixMappingMem(); prefixes.setNsPrefixes(PrefixMapping.Standard); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); kb1 = new KnowledgeBaseImpl("kb1"); @@ -42,11 +42,11 @@ public void testPostReact() throws InterruptedException { kn.addKB(kb3); // start registering - GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); + GraphPattern gp1 = new GraphPattern(prefixes, "?a ?c."); PostKnowledgeInteraction ki1 = new PostKnowledgeInteraction(new CommunicativeAct(), gp1, null); kb1.register(ki1); - GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); + GraphPattern gp2 = new GraphPattern(prefixes, "?d ?e."); ReactKnowledgeInteraction ki2 = new ReactKnowledgeInteraction(new CommunicativeAct(), gp2, null); kb2.register(ki2, (anRKI, argument) -> { @@ -57,7 +57,7 @@ public void testPostReact() throws InterruptedException { return new BindingSet(); }); - GraphPattern gp3 = new GraphPattern(prefixes, "?f ?g"); + GraphPattern gp3 = new GraphPattern(prefixes, "?f ?g"); ReactKnowledgeInteraction ki3 = new ReactKnowledgeInteraction(new CommunicativeAct(), gp3, null); kb3.register(ki3, (anRKI, aReactExchangeInfo) -> { @@ -66,8 +66,8 @@ public void testPostReact() throws InterruptedException { Iterator iter = argument.iterator(); Binding b = iter.next(); - assertEquals("", b.get("f"), "Binding of 'd' is incorrect."); - assertEquals("", b.get("g"), "Binding of 'e' is incorrect."); + assertEquals("", b.get("f"), "Binding of 'd' is incorrect."); + assertEquals("", b.get("g"), "Binding of 'e' is incorrect."); assertFalse(iter.hasNext(), "This BindingSet should only have a single binding."); @@ -79,8 +79,8 @@ public void testPostReact() throws InterruptedException { // start exchanging BindingSet bindingSet = new BindingSet(); Binding binding = new Binding(); - binding.put("a", ""); - binding.put("c", ""); + binding.put("a", ""); + binding.put("c", ""); bindingSet.add(binding); try { diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRegisterKnowledgeInteraction.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRegisterKnowledgeInteraction.java index ec5b08dc6..6e4b29f3a 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRegisterKnowledgeInteraction.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/TestRegisterKnowledgeInteraction.java @@ -15,7 +15,7 @@ public void testRegisterKnowledgeInteractionWithSameName() { @Override public URI getKnowledgeBaseId() { - return URI.create("http://www.tno.nl/kb1"); + return URI.create("http://www.example.org/kb1"); } @Override 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 980517335..f24c5eb4d 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 @@ -41,7 +41,7 @@ public void start() throws InterruptedException { prefixes.setNsPrefixes(PrefixMapping.Standard); prefixes.setNsPrefix("sosa", "http://www.w3.org/ns/sosa/"); prefixes.setNsPrefix("ic", "https://w3id.org/knowledge-engine/"); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); r = new Room(); es.execute(new Runnable() { @@ -101,9 +101,9 @@ public BindingSet react(ReactKnowledgeInteraction anRKI, ReactExchangeInfo aReac BindingSet args = new BindingSet(); Binding i = new Binding(); - i.put("room", ""); + i.put("room", ""); i.put("roomName", "\"room1\""); - i.put("act", ""); + i.put("act", ""); if (tempDouble < threshold) { i.put("state", "\"on\""); LOG.info("Thermostat: posting state: {}", "on"); @@ -150,9 +150,9 @@ public void run() { try { while (true) { - b.put("id", ""); + b.put("id", ""); b.put("room", "\"room1\""); - b.put("obs", ""); + b.put("obs", ""); String temp = Integer.toString(Thermostat.this.r.temperature.get()); b.put("temp", temp); args.add(b); 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 587567f49..9cc4c8a61 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 @@ -23,7 +23,7 @@ public class TimeOntologyTest { private static final Logger LOG = LoggerFactory.getLogger(TimeOntologyTest.class); - private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "https://www.tno.nl/example/") + private PrefixMapping prefixes = new PrefixMappingMem().setNsPrefix("ex", "https://www.example.org/example/") .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/VariableBindingNameTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/api/VariableBindingNameTest.java index b52e869c9..6bde742c1 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 @@ -34,7 +34,7 @@ void test() { prefixes.setNsPrefixes(PrefixMapping.Standard); prefixes.setNsPrefix("sosa", "http://www.w3.org/ns/sosa/"); prefixes.setNsPrefix("ic", "https://w3id.org/knowledge-engine/"); - prefixes.setNsPrefix("ex", "https://www.tno.nl/example/"); + prefixes.setNsPrefix("ex", "https://www.example.org/example/"); kn = new KnowledgeNetwork(); sensor = new KnowledgeBaseImpl("temperatureSensor"); @@ -81,9 +81,9 @@ public BindingSet react(ReactKnowledgeInteraction anRKI, ReactExchangeInfo aReac assertEquals("\"21.5\"^^", temp); Binding binding = new Binding(); - binding.put("s2", ""); - binding.put("p2", ""); - binding.put("o2", ""); + binding.put("s2", ""); + binding.put("p2", ""); + binding.put("o2", ""); bs.add(binding); } @@ -97,9 +97,9 @@ public BindingSet react(ReactKnowledgeInteraction anRKI, ReactExchangeInfo aReac BindingSet bs = new BindingSet(); Binding b = new Binding(); - b.put("id1", ""); + b.put("id1", ""); b.put("room1", "\"room1\""); - b.put("obs1", ""); + b.put("obs1", ""); String temp = Double.toString(21.5); b.put("temp1", temp); bs.add(b); @@ -146,9 +146,9 @@ public BindingSet react(ReactKnowledgeInteraction anRKI, ReactExchangeInfo aReac assertFalse(b2.containsKey("p1")); assertFalse(b2.containsKey("o1")); - assertEquals("", b2.get("s2")); - assertEquals("", b2.get("p2")); - assertEquals("", b2.get("o2")); + assertEquals("", b2.get("s2")); + assertEquals("", b2.get("p2")); + assertEquals("", b2.get("o2")); } catch (InterruptedException | ExecutionException e) { LOG.error("{}", e); fail(); diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/InteractionProcessorImplTest.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/InteractionProcessorImplTest.java index de70bd11d..68117554d 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/InteractionProcessorImplTest.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/InteractionProcessorImplTest.java @@ -63,18 +63,18 @@ void setUp() throws Exception { this.messageRouter = new TestMessageRouter(); this.interactionProcessor.setMessageRouter(this.messageRouter); - this.knowledgeBaseId1 = new URI("https://www.tno.nl/interconnect/kb1"); - this.graphPattern1 = "?s1 ?o1 ."; + this.knowledgeBaseId1 = new URI("https://www.example.org/interconnect/kb1"); + this.graphPattern1 = "?s1 ?o1 ."; - this.knowledgeBaseId2 = new URI("https://www.tno.nl/interconnect/kb2"); - this.graphPattern2 = "?s2 ?o2 ."; - this.subject2 = ""; - this.object2 = ""; + this.knowledgeBaseId2 = new URI("https://www.example.org/interconnect/kb2"); + this.graphPattern2 = "?s2 ?o2 ."; + this.subject2 = ""; + this.object2 = ""; - this.knowledgeBaseId3 = new URI("https://www.tno.nl/interconnect/kb3"); - this.graphPattern3 = "?s3 ?o3 ."; - this.subject3 = ""; - this.object3 = ""; + this.knowledgeBaseId3 = new URI("https://www.example.org/interconnect/kb3"); + this.graphPattern3 = "?s3 ?o3 ."; + this.subject3 = ""; + this.object3 = ""; } @@ -85,8 +85,8 @@ void test() throws InterruptedException, ExecutionException, URISyntaxException new GraphPattern(this.graphPattern1)); CompletableFuture future = this.interactionProcessor - .planAskFromKnowledgeBase(new MyKnowledgeInteractionInfo(new URI("http://www.tno.nl/"), - new URI("http://www.tno.nl/"), askInteraction, null, null), new RecipientSelector()) + .planAskFromKnowledgeBase(new MyKnowledgeInteractionInfo(new URI("http://www.example.org/"), + new URI("http://www.example.org/"), askInteraction, null, null), new RecipientSelector()) .execute(new BindingSet()); BindingSet bindings = future.get().getBindings(); @@ -125,7 +125,7 @@ public Set getOtherKnowledgeBases() { new CommunicativeAct(), new GraphPattern(InteractionProcessorImplTest.this.graphPattern2)); KnowledgeInteractionInfo knowledgeInteractionInfo; - knowledgeInteractionInfo = new KnowledgeInteractionInfo(new URI("https://www.tno.nl/2"), + knowledgeInteractionInfo = new KnowledgeInteractionInfo(new URI("https://www.example.org/2"), InteractionProcessorImplTest.this.knowledgeBaseId2, answerKnowledgeInteraction); someKIs2.add(knowledgeInteractionInfo); @@ -138,7 +138,7 @@ public Set getOtherKnowledgeBases() { answerKnowledgeInteraction = new AnswerKnowledgeInteraction(new CommunicativeAct(), new GraphPattern(InteractionProcessorImplTest.this.graphPattern3)); - knowledgeInteractionInfo = new KnowledgeInteractionInfo(new URI("https://www.tno.nl/3"), + knowledgeInteractionInfo = new KnowledgeInteractionInfo(new URI("https://www.example.org/3"), InteractionProcessorImplTest.this.knowledgeBaseId3, answerKnowledgeInteraction); someKIs3.add(knowledgeInteractionInfo); @@ -232,7 +232,7 @@ public CompletableFuture sendAskMessage(AskMessage askMessage) th AnswerMessage msg; try { msg = new AnswerMessage(askMessage.getToKnowledgeBase(), askMessage.getToKnowledgeInteraction(), - InteractionProcessorImplTest.this.knowledgeBaseId1, new URI("https://www.tno.nl/ki1"), + InteractionProcessorImplTest.this.knowledgeBaseId1, new URI("https://www.example.org/ki1"), askMessage.getMessageId(), Util.translateFromApiBindingSet(bindings)); future.complete(msg); } catch (URISyntaxException e) { 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 2e360cf8e..d56cbbee6 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 @@ -50,7 +50,7 @@ public void testRegisterWhenManySmartConnectorsExist() var future = new CompletableFuture(); - var testKBUri = new URI("https://www.tno.nl/TEST-KB"); + var testKBUri = new URI("https://www.example.org/TEST-KB"); var kb = new KnowledgeBase() { @Override diff --git a/smart-connector/src/test/resources/metadata.ttl b/smart-connector/src/test/resources/metadata.ttl index e287fc4e8..06d4be0c4 100644 --- a/smart-connector/src/test/resources/metadata.ttl +++ b/smart-connector/src/test/resources/metadata.ttl @@ -1,265 +1,265 @@ - + a . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a ; - ; + ; - . + . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a . - + a ; - ; + ; - . + . - + a . - + a . - + a . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a ; - ; + ; - . + . - + a . - + a . - + a ; "description of kb1" ; - , , , , , , , , ; + , , , , , , , , ; "kb1" . - + a . - + a . - + a ; - ; + ; - ; + ; - ; + ; true . - + a ; - ; + ; - ; + ; - ; + ; true . - + a . - + a . - + a ; - ; + ; - . + . - + a ; - ; + ; - ; + ; - ; + ; true . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a . - + a ; - ; + ; - ; + ; true . - + a . - + a ; "?obs . ?obs ?temp . " . - + a ; - ; + ; - . + . - + a . - + a ; - ; + ; - . + . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a ; - ; + ; - ; + ; true . - + a . - + a ; - ; + ; - ; + ; - ; + ; false . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a . - + a ; - ; + ; - ; + ; - ; + ; true . - + a . - + a ; - ; + ; - ; + ; - ; + ; true . - + a ; - ; + ; - . + . - + a ; - ; + ; - ; + ; - ; + ; true . - + a ; "?kb . ?kb ?name . ?kb ?description . ?kb ?ki . ?ki ?kiType . ?ki ?isMeta . ?ki ?act . ?act . ?act ?req . ?act ?sat . ?req ?reqType . ?sat ?satType . ?ki ?gp . ?gp ?patternType . ?gp ?pattern . " . - + a ; - ; + ; - . + . - + a . - + a ; - ; + ; - . \ No newline at end of file + . \ No newline at end of file