Skip to content

Commit

Permalink
[#184] Skeleton to test java function in query
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Aug 14, 2024
1 parent 9546c64 commit a1eec60
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion s-pipes-core/src/test/java/cz/cvut/spin/SpinIntegrationTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cvut.spin;
package cz.cvut.spin;

import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.query.QuerySolutionMap;
Expand Down Expand Up @@ -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();

Expand All @@ -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: <http://onto.fel.cvut.cz/ontologies/lib/function/time/> .
SELECT ?nextDay
WHERE {
BIND(kbss-timef:add-days("2022-01-01"^^xsd:date, 1) as ?nextDay)
}
""";

// execute the query

// check the result
}
}

0 comments on commit a1eec60

Please sign in to comment.