From a1eec602711928e8b99c6d934b4e68aa87ecae83 Mon Sep 17 00:00:00 2001 From: Miroslav Blasko Date: Fri, 2 Aug 2024 08:11:23 +0200 Subject: [PATCH] [#184] Skeleton to test java function in query --- .../cz/cvut/spin/SpinIntegrationTest.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/s-pipes-core/src/test/java/cz/cvut/spin/SpinIntegrationTest.java b/s-pipes-core/src/test/java/cz/cvut/spin/SpinIntegrationTest.java index ec43157a..57ed01e7 100644 --- a/s-pipes-core/src/test/java/cz/cvut/spin/SpinIntegrationTest.java +++ b/s-pipes-core/src/test/java/cz/cvut/spin/SpinIntegrationTest.java @@ -1,4 +1,4 @@ -package cz.cvut.spin; + package cz.cvut.spin; import org.apache.jena.ontology.OntModelSpec; import org.apache.jena.query.QuerySolutionMap; @@ -35,6 +35,7 @@ public void executeSPINExpressionWithCustomSpinFunction() throws UnsupportedEnco //SPINModuleRegistry.get().init(); SPINModuleRegistry.get().registerAll(funcDefModel, null); + // load custom function call Model funcCallModel = ModelFactory.createDefaultModel(); @@ -59,4 +60,22 @@ public void executeSPINExpressionWithCustomSpinFunction() throws UnsupportedEnco assertEquals(node.toString(), repositoryUrl + "?default-graph-uri=" + URLEncoder.encode(reportGraphId, StandardCharsets.UTF_8) ); } + + @Test + public void executeQueryWithCustomJavaFunction() { + SPINModuleRegistry.get().init(); //TODO is it needed ? + + // make a query with AddDays function + String query = """ + @prefix kbss-timef: . + SELECT ?nextDay + WHERE { + BIND(kbss-timef:add-days("2022-01-01"^^xsd:date, 1) as ?nextDay) + } + """; + + // execute the query + + // check the result + } }