From 5a4004be0abeb6645c0c72b797293ac6233fe3a9 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 d39baa4c..05b6f016 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; @@ -34,6 +34,7 @@ public void executeSPINExpressionWithCustomSpinFunction() throws UnsupportedEnco //SPINModuleRegistry.get().init(); SPINModuleRegistry.get().registerAll(funcDefModel, null); + // load custom function call Model funcCallModel = ModelFactory.createDefaultModel(); @@ -58,4 +59,22 @@ public void executeSPINExpressionWithCustomSpinFunction() throws UnsupportedEnco assertEquals(node.toString(), repositoryUrl + "?default-graph-uri=" + URLEncoder.encode(reportGraphId, "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 + } }