From 37ad896125d4d3dc2e104e101bb7dc8862c9365d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:05:32 +0100 Subject: [PATCH] Bump org.apache.jena:apache-jena-libs from 4.10.0 to 5.2.0 (#547) * Bump org.apache.jena:apache-jena-libs from 4.10.0 to 5.2.0 Bumps org.apache.jena:apache-jena-libs from 4.10.0 to 5.2.0. --- updated-dependencies: - dependency-name: org.apache.jena:apache-jena-libs dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump org.apache.jena:apache-jena-libs from 4.10.0 to 5.2.0 Bumps org.apache.jena:apache-jena-libs from 4.10.0 to 5.2.0. --- updated-dependencies: - dependency-name: org.apache.jena:apache-jena-libs dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Replace usages of removed methods * Revert Node_Literal changes * Add isConcrete() check for statements that used Node_Concrete but now use Node * Added a AdminUI unit test and a few isConcrete() checks. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lathouwerssam Co-authored-by: Barry Nouwt --- .../eu/knowledge/engine/admin/AdminUI.java | 13 +++-- .../engine/admin/api/TestApiRoutes.java | 49 +++++++++++++++++-- pom.xml | 2 +- .../engine/reasoner/api/Binding.java | 21 ++++---- .../engine/reasoner/api/TripleVarBinding.java | 33 +++++++------ .../reasoner/api/TripleVarBindingSet.java | 15 +++--- .../reasoner/rulenode/BindingSetStore.java | 7 ++- .../engine/reasoner/JenaRDFSRulesTest.java | 2 +- .../engine/reasoner/api/BindingTest.java | 9 +--- .../knowledge/engine/reasoner/api/Util.java | 2 +- .../api/KnowledgeInteraction.java | 1 - .../impl/ReasonerProcessor.java | 6 +-- .../engine/smartconnector/impl/Util.java | 2 +- .../impl/TestBindingSetConversions.java | 4 +- 14 files changed, 100 insertions(+), 66 deletions(-) diff --git a/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java b/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java index cde7f4d4..ab8a3e55 100644 --- a/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java +++ b/admin-ui/src/main/java/eu/knowledge/engine/admin/AdminUI.java @@ -9,7 +9,6 @@ import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; -import org.apache.jena.rdf.model.SimpleSelector; import org.apache.jena.shared.PrefixMapping; import org.apache.jena.sparql.graph.PrefixMappingMem; import org.apache.jena.sparql.lang.arq.ParseException; @@ -184,9 +183,9 @@ public BindingSet handleChangedKnowledgeBaseKnowledge(ReactExchangeInfo ei) { // - delete all old data about that knowledge base // - insert the *new* data about that knowledge base - Resource kb = model.query(new SimpleSelector(null, RDF.type, Vocab.KNOWLEDGE_BASE)).listSubjects().next(); - String query = String.format("DELETE { %s } WHERE { %s FILTER (?kb = <%s>) } ", - this.metaGraphPattern.getPattern(), this.metaGraphPattern.getPattern(), kb.toString()); + Resource kb = model.listSubjectsWithProperty(RDF.type, Vocab.KNOWLEDGE_BASE).next(); + String query = String.format("DELETE { %s } WHERE { %s FILTER (?kb = <%s>) } ", this.metaGraphPattern.getPattern(), this.metaGraphPattern.getPattern(), kb.toString()); + UpdateRequest updateRequest = UpdateFactory.create(query); UpdateAction.execute(updateRequest, this.model); @@ -215,9 +214,9 @@ public BindingSet handleRemovedKnowledgeBaseKnowledge(ReactExchangeInfo ei) { // - extract the knowledge base that this message is about // - delete all old data about that knowledge base - Resource kb = model.query(new SimpleSelector(null, RDF.type, Vocab.KNOWLEDGE_BASE)).listSubjects().next(); - String query = String.format("DELETE { %s } WHERE { %s FILTER (?kb = <%s>) } ", - this.metaGraphPattern.getPattern(), this.metaGraphPattern.getPattern(), kb.toString()); + Resource kb = model.listSubjectsWithProperty(RDF.type, Vocab.KNOWLEDGE_BASE).next(); + String query = String.format("DELETE { %s } WHERE { %s FILTER (?kb = <%s>) } ", this.metaGraphPattern.getPattern(), this.metaGraphPattern.getPattern(), kb.toString()); + UpdateRequest updateRequest = UpdateFactory.create(query); UpdateAction.execute(updateRequest, this.model); 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 6cc8b960..290029cd 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 @@ -186,6 +186,44 @@ public void testSmartConnectorAllRouteWithoutMetaData() throws InterruptedExcept stopKbs(); } + @Test + public void testSmartConnectorUpdate() throws InterruptedException { + startKbs(); + + try { + URI uri = new URI("http://localhost:8283/admin/sc/all/false"); + HttpRequest request = HttpRequest.newBuilder(uri).GET().build(); + + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + eu.knowledge.engine.admin.model.SmartConnector[] result = objectMapper.readValue(response.body(), + eu.knowledge.engine.admin.model.SmartConnector[].class); + ArrayList list = new ArrayList<>(); + Collections.addAll(list, result); + assertNotNull(list); + assertEquals(2, list.size()); + assertEquals(1, list.get(0).getKnowledgeInteractions().size()); + assertEquals(200, response.statusCode()); + + // now stop one KB and check if the admin UI correctly updates. + stopKb(kb1); + Thread.sleep(1000); + + response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + result = objectMapper.readValue(response.body(), eu.knowledge.engine.admin.model.SmartConnector[].class); + list = new ArrayList<>(); + Collections.addAll(list, result); + assertEquals(1, list.size()); + assertEquals(200, response.statusCode()); + + } catch (IOException | InterruptedException | URISyntaxException e) { + LOG.warn("Was not able to retrieve smart connectors", e); + fail(); + } + stopKb(kb2); + } + @AfterAll public void cleanup() { LOG.info("Clean up: {}", TestApiRoutes.class.getSimpleName()); @@ -252,12 +290,13 @@ public void smartConnectorReady(SmartConnector aSC) { } public void stopKbs() { - if (kb1 != null) { - kb1.stop(); - } + stopKb(kb1); + stopKb(kb2); + } - if (kb2 != null) { - kb2.stop(); + public void stopKb(MockedKnowledgeBase aKb) { + if (aKb != null) { + aKb.stop(); } } } diff --git a/pom.xml b/pom.xml index 3b2c32e3..ce67563a 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ org.apache.jena apache-jena-libs - 4.10.0 + 5.2.0 pom diff --git a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/Binding.java b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/Binding.java index 73d3535c..4001f9a1 100644 --- a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/Binding.java +++ b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/Binding.java @@ -4,16 +4,12 @@ import java.util.Map; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_Concrete; - import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.graph.PrefixMappingZero; import org.apache.jena.sparql.sse.SSE; import org.apache.jena.sparql.util.FmtUtils; -import eu.knowledge.engine.reasoner.api.Binding; - -public class Binding extends HashMap { +public class Binding extends HashMap { private static final long serialVersionUID = 2381462612239850018L; @@ -21,13 +17,16 @@ public Binding() { super(); } - public Binding(Var variable, Node_Concrete lit) { + public Binding(Var variable, Node lit) { super(); + if (!lit.isConcrete()) + throw new IllegalArgumentException( + "Binding values should be concrete nodes (either RDF literals or RDF URIs)."); this.put(variable, lit); } public Binding(String variable, String val) { - this(Var.alloc(variable), (Node_Concrete) SSE.parseNode(val)); + this(Var.alloc(variable), (Node) SSE.parseNode(val)); } public Binding(Binding b) { @@ -48,13 +47,17 @@ public Node get(String variable) { } public Node put(String variable, String val) { - return this.put(Var.alloc(variable), (Node_Concrete) SSE.parseNode(val)); + Node n = SSE.parseNode(val); + if (!n.isConcrete()) + throw new IllegalArgumentException( + "Binding values should be concrete nodes (either RDF literals or RDF URIs)."); + return this.put(Var.alloc(variable), n); } public Map toMap() { Map result = new HashMap(); - for (Map.Entry entry : this.entrySet()) { + for (Map.Entry entry : this.entrySet()) { // TODO: Util function that does the stringForNode without prefixes result.put(entry.getKey().getName(), FmtUtils.stringForNode(entry.getValue(), new PrefixMappingZero())); } diff --git a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBinding.java b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBinding.java index 8f7a9920..0abd8e9a 100644 --- a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBinding.java +++ b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBinding.java @@ -6,7 +6,6 @@ import java.util.Set; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_Concrete; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.graph.PrefixMappingZero; import org.apache.jena.sparql.sse.SSE; @@ -20,7 +19,7 @@ */ public class TripleVarBinding { - private Map tripleVarMapping; + private Map tripleVarMapping; /** * Optimize the getVarValue method. @@ -57,7 +56,7 @@ public TripleVarBinding(Set aGraphPattern, Binding aBinding) { public TripleVarBinding(TripleVarBinding b) { this(); - for (Map.Entry entry : b.tripleVarMapping.entrySet()) { + for (Map.Entry entry : b.tripleVarMapping.entrySet()) { this.put(entry.getKey(), entry.getValue()); } @@ -66,7 +65,7 @@ public TripleVarBinding(TripleVarBinding b) { } } - public Set> entrySet() { + public Set> entrySet() { return tripleVarMapping.entrySet(); } @@ -74,16 +73,20 @@ public Set getTripleVars() { return tripleVarMapping.keySet(); } - public void put(TripleNode aTripleVar, Node_Concrete aLiteral) { + public void put(TripleNode aTripleVar, Node aLiteral) { assert aTripleVar.node.isVariable(); + + if (!aLiteral.isConcrete()) + throw new IllegalArgumentException( + "Binding values should be concrete nodes (either RDF literals or URIs) and not '" + + aLiteral.toString() + "'"); + tripleVarMapping.put(aTripleVar, aLiteral); variableTripleVarMapping.put((Var) aTripleVar.node, aTripleVar); } public void put(TripleNode aTripleVar, String aLiteral) { - assert aTripleVar.node.isVariable(); - tripleVarMapping.put(aTripleVar, (Node_Concrete) SSE.parseNode(aLiteral)); - variableTripleVarMapping.put((Var) aTripleVar.node, aTripleVar); + this.put(aTripleVar, (Node) SSE.parseNode(aLiteral)); } /** @@ -97,7 +100,7 @@ public void put(TripleNode aTripleVar, String aLiteral) { public Binding toBinding() { Binding b = new Binding(); - for (Map.Entry entry : this.tripleVarMapping.entrySet()) { + for (Map.Entry entry : this.tripleVarMapping.entrySet()) { assert entry.getKey().node.isVariable(); b.put((Var) entry.getKey().node, entry.getValue()); } @@ -111,7 +114,7 @@ public Binding toBinding() { public boolean isConflicting(TripleVarBinding tvb) { Node l; - for (Map.Entry e : this.tripleVarMapping.entrySet()) { + for (Map.Entry e : this.tripleVarMapping.entrySet()) { assert e.getKey().node.isVariable(); l = tvb.getVarValue((Var) e.getKey().node); @@ -126,15 +129,15 @@ public boolean isConflicting(TripleVarBinding tvb) { * We assume all occurrences of a var have the same literal, we just return the * first one found. * - * @param var + * @param variable * @return */ - public Node_Concrete getVarValue(Var variable) { + public Node getVarValue(Var variable) { TripleNode tripleVar = this.variableTripleVarMapping.get(variable); return this.get(tripleVar); } - public Node_Concrete get(TripleNode key) { + public Node get(TripleNode key) { return this.tripleVarMapping.get(key); } @@ -196,7 +199,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); String prefix = ""; sb.append("{"); - for (Map.Entry entry : this.tripleVarMapping.entrySet()) { + for (Map.Entry entry : this.tripleVarMapping.entrySet()) { sb.append(prefix).append(entry.getKey().node).append("=") .append(FmtUtils.stringForNode(entry.getValue(), new PrefixMappingZero())); prefix = ","; @@ -228,7 +231,7 @@ public TripleVarBinding merge(TripleVarBinding otherB) { return b; } - private void putAll(Map aTripleVarMapping) { + private void putAll(Map aTripleVarMapping) { for (TripleNode tv : aTripleVarMapping.keySet()) { assert tv.node.isVariable(); diff --git a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBindingSet.java b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBindingSet.java index 55aa6d1f..e88c134d 100644 --- a/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBindingSet.java +++ b/reasoner/src/main/java/eu/knowledge/engine/reasoner/api/TripleVarBindingSet.java @@ -8,7 +8,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_Concrete; import org.apache.jena.sparql.core.Var; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -153,7 +152,7 @@ public String toString() { /** * Simply the union between the two bindingsets. Does nothing complex for now. * - * @param gbs + * @param aGraphBindingSet * @return */ public TripleVarBindingSet merge(TripleVarBindingSet aGraphBindingSet) { @@ -232,18 +231,18 @@ public TripleVarBindingSet translate(Set graphPattern, Set && !fromB.get(fromTVar).equals(toBVarValue)) { skip = true; // conflict, so skip } - } else if (fromTNode.node instanceof Var && toTNode.node instanceof Node_Concrete) { + } else if (fromTNode.node instanceof Var && toTNode.node.isConcrete()) { var fromTVar = new TripleNode(fromTriple, (Var) fromTNode.node, fromTNode.nodeIdx); if (fromB.containsKey(fromTVar) && !fromB.get(fromTVar).equals(toTNode.node)) { skip = true; // conflict, so skip } - } else if (fromTNode.node instanceof Node_Concrete && toTNode.node instanceof Var) { + } else if (fromTNode.node.isConcrete() && toTNode.node instanceof Var) { var toTVar = new TripleNode(toTriple, (Var) toTNode.node, toTNode.nodeIdx); if (toB.containsVar((Var) toTVar.node) && !toB.getVarValue((Var) toTVar.node).equals(fromTNode.node)) { skip = true; } else if (!toB.containsVar((Var) toTVar.node)) { - toB.put(toTVar, (Node_Concrete) fromTNode.node); + toB.put(toTVar, fromTNode.node); } } } @@ -332,9 +331,9 @@ public void printDebuggingTable() { Set nodes = tvb.getTripleNodes(tp); if (!nodes.isEmpty()) { - Node_Concrete subject = null; - Node_Concrete predicate = null; - Node_Concrete object = null; + Node subject = null; + Node predicate = null; + Node object = null; for (TripleNode tn : nodes) { if (tn.nodeIdx == 0) { diff --git a/reasoner/src/main/java/eu/knowledge/engine/reasoner/rulenode/BindingSetStore.java b/reasoner/src/main/java/eu/knowledge/engine/reasoner/rulenode/BindingSetStore.java index 4f01f151..9a0cabbd 100644 --- a/reasoner/src/main/java/eu/knowledge/engine/reasoner/rulenode/BindingSetStore.java +++ b/reasoner/src/main/java/eu/knowledge/engine/reasoner/rulenode/BindingSetStore.java @@ -8,7 +8,6 @@ import java.util.Set; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_Concrete; import eu.knowledge.engine.reasoner.BaseRule; import eu.knowledge.engine.reasoner.api.TripleNode; @@ -160,9 +159,9 @@ public void printDebuggingTable() { Set nodes = tvb.getTripleNodes(tp); if (!nodes.isEmpty()) { - Node_Concrete subject = null; - Node_Concrete predicate = null; - Node_Concrete object = null; + Node subject = null; + Node predicate = null; + Node object = null; for (TripleNode tn : nodes) { if (tn.nodeIdx == 0) { diff --git a/reasoner/src/test/java/eu/knowledge/engine/reasoner/JenaRDFSRulesTest.java b/reasoner/src/test/java/eu/knowledge/engine/reasoner/JenaRDFSRulesTest.java index 63cd19cd..0b8ccf0b 100644 --- a/reasoner/src/test/java/eu/knowledge/engine/reasoner/JenaRDFSRulesTest.java +++ b/reasoner/src/test/java/eu/knowledge/engine/reasoner/JenaRDFSRulesTest.java @@ -91,7 +91,7 @@ public void test() throws InterruptedException, ExecutionException, ParseExcepti Model m = ModelFactory.createDefaultModel(); for (Binding binding : results2) { - m.add(m.asStatement(new Triple(binding.get("s"), binding.get("p"), binding.get("o")))); + m.add(m.asStatement(Triple.create(binding.get("s"), binding.get("p"), binding.get("o")))); } // Model m = Util.generateModel(new TriplePattern(genericTriple), results2); diff --git a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/BindingTest.java b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/BindingTest.java index a2484f46..6c2fb93c 100644 --- a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/BindingTest.java +++ b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/BindingTest.java @@ -8,18 +8,11 @@ import java.util.Set; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_Concrete; import org.apache.jena.sparql.graph.PrefixMappingZero; import org.apache.jena.sparql.sse.SSE; import org.apache.jena.sparql.util.FmtUtils; import org.junit.jupiter.api.Test; -import eu.knowledge.engine.reasoner.api.Binding; -import eu.knowledge.engine.reasoner.api.BindingSet; -import eu.knowledge.engine.reasoner.api.TriplePattern; -import eu.knowledge.engine.reasoner.api.TripleNode; -import eu.knowledge.engine.reasoner.api.TripleVarBinding; -import eu.knowledge.engine.reasoner.api.TripleVarBindingSet; public class BindingTest { @@ -28,7 +21,7 @@ public void testGraphPatternBindingSets() { TriplePattern t1 = new TriplePattern("?a "); TriplePattern t2 = new TriplePattern("?a ?b"); TripleVarBinding tb1 = new TripleVarBinding(); - tb1.put(new TripleNode(t1, "?a", 0), (Node_Concrete) SSE.parseNode("")); + tb1.put(new TripleNode(t1, "?a", 0), (Node) SSE.parseNode("")); TripleVarBinding tb2 = new TripleVarBinding(); tb2.put(new TripleNode(t2, "?b", 2), "22"); diff --git a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/Util.java b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/Util.java index e6ed7e33..8a43dfe2 100644 --- a/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/Util.java +++ b/reasoner/src/test/java/eu/knowledge/engine/reasoner/api/Util.java @@ -102,7 +102,7 @@ public static Model generateModel(TriplePattern tp, BindingSet variableBindings) newNodes[i] = newN; } - m.add(m.asStatement(new Triple(newNodes[0], newNodes[1], newNodes[2]))); + m.add(m.asStatement(Triple.create(newNodes[0], newNodes[1], newNodes[2]))); } return m; } diff --git a/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/KnowledgeInteraction.java b/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/KnowledgeInteraction.java index fb8b3ae0..8ddcf4c2 100644 --- a/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/KnowledgeInteraction.java +++ b/smart-connector-api/src/main/java/eu/knowledge/engine/smartconnector/api/KnowledgeInteraction.java @@ -1,6 +1,5 @@ package eu.knowledge.engine.smartconnector.api; -import com.fasterxml.jackson.core.format.MatchStrength; /** * A {@link KnowledgeInteraction} represents an agreement about the exchange of diff --git a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/ReasonerProcessor.java b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/ReasonerProcessor.java index 0cf45408..4f94d629 100644 --- a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/ReasonerProcessor.java +++ b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/ReasonerProcessor.java @@ -10,7 +10,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; -import org.apache.jena.graph.Node_Concrete; +import org.apache.jena.graph.Node; import org.apache.jena.sparql.core.TriplePath; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.graph.PrefixMappingZero; @@ -294,7 +294,7 @@ protected BindingSet translateBindingSetFrom(eu.knowledge.engine.reasoner.api.Bi for (eu.knowledge.engine.reasoner.api.Binding b : bs) { newB = new Binding(); - for (Map.Entry entry : b.entrySet()) { + for (Map.Entry entry : b.entrySet()) { newB.put(entry.getKey().getName(), FmtUtils.stringForNode(entry.getValue(), context)); } newBS.add(newB); @@ -305,7 +305,7 @@ protected BindingSet translateBindingSetFrom(eu.knowledge.engine.reasoner.api.Bi /** * Translate bindingset from the ke bindingset to the reasoner bindingset. * - * @param bs a ke bindingset + * @param someBindings a ke bindingset * @return a reasoner bindingset */ protected eu.knowledge.engine.reasoner.api.BindingSet translateBindingSetTo(BindingSet someBindings) { diff --git a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/Util.java b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/Util.java index e37b356b..16d90eec 100644 --- a/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/Util.java +++ b/smart-connector/src/main/java/eu/knowledge/engine/smartconnector/impl/Util.java @@ -100,7 +100,7 @@ public static Model generateModel(GraphPattern graphPattern, BindingSet variable newNodes[i] = newN; } - m.add(m.asStatement(new Triple(newNodes[0], newNodes[1], newNodes[2]))); + m.add(m.asStatement(Triple.create(newNodes[0], newNodes[1], newNodes[2]))); } } return m; diff --git a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/TestBindingSetConversions.java b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/TestBindingSetConversions.java index fff0ba72..a9237ae0 100644 --- a/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/TestBindingSetConversions.java +++ b/smart-connector/src/test/java/eu/knowledge/engine/smartconnector/impl/TestBindingSetConversions.java @@ -8,7 +8,7 @@ import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_Concrete; +import org.apache.jena.graph.Node; import org.apache.jena.sparql.core.Var; import org.junit.jupiter.api.Test; @@ -41,7 +41,7 @@ void testTypedLiteral() { eu.knowledge.engine.reasoner.api.BindingSet bsR = new eu.knowledge.engine.reasoner.api.BindingSet(); eu.knowledge.engine.reasoner.api.Binding bR = new eu.knowledge.engine.reasoner.api.Binding(); - bR.put(varNodeVersion, (Node_Concrete) literalNodeVersion); + bR.put(varNodeVersion, (Node) literalNodeVersion); bsR.add(bR); BindingSet otherBS = rp.testerFrom(bsR); assertEquals(literalStringVersion, otherBS.iterator().next().get(varStringVersion));