use of org.apache.jena.sparql.function.FunctionRegistry in project jena by apache.
the class E_Function method functionFactory.
private FunctionFactory functionFactory(Context cxt) {
FunctionRegistry registry = chooseRegistry(cxt);
FunctionFactory ff = registry.get(functionIRI);
return ff;
}
use of org.apache.jena.sparql.function.FunctionRegistry in project jena by apache.
the class GeoSPARQLConfig method loadFunctions.
public static final void loadFunctions() {
// Only register functions once.
if (!IS_FUNCTIONS_REGISTERED) {
// loading is actually idempotent.
IS_FUNCTIONS_REGISTERED = true;
/*
* If jul-to-slf4j SLF4JBridgeHandler has not been setup,
* then this can generate a warning via java.util.logging.
*
* Dec 28, 2021 10:56:27 AM org.apache.sis.referencing.factory.sql.EPSGFactory <init>
* WARNING: The “SIS_DATA” environment variable is not set.
*/
// Setup Default Coordinate Reference Systems
SRSRegistry.setupDefaultSRS();
// Register GeometryDatatypes with the TypeMapper.
GeometryDatatype.registerDatatypes();
// Register Property and Filter functions.
PropertyFunctionRegistry propertyRegistry = PropertyFunctionRegistry.get();
FunctionRegistry functionRegistry = FunctionRegistry.get();
NonTopological.loadFilterFunctions(functionRegistry);
functionRegistry.put(Geo.RELATE_NAME, RelateFF.class);
SimpleFeatures.loadPropertyFunctions(propertyRegistry);
SimpleFeatures.loadFilterFunctions(functionRegistry);
Egenhofer.loadPropertyFunctions(propertyRegistry);
Egenhofer.loadFilterFunctions(functionRegistry);
RCC8.loadPropertyFunctions(propertyRegistry);
RCC8.loadFilterFunctions(functionRegistry);
Relate.loadRelateFunction(functionRegistry);
GeometryProperty.loadPropertyFunctions(propertyRegistry);
GeometryProperty.loadFilterFunctions(functionRegistry);
Spatial.loadPropertyFunctions(propertyRegistry);
Spatial.loadFilterFunctions(functionRegistry);
}
}
use of org.apache.jena.sparql.function.FunctionRegistry in project jena by apache.
the class ExFuseki_05_CustomFunction method main.
public static void main(String... a) {
FusekiLogging.setLogging();
// ---- Register the function
FunctionRegistry ref = FunctionRegistry.get();
ref.put("http://my/num", MyFunction.class);
// ---- Show it can be used
// -- Start a server
int PORT = WebLib.choosePort();
// Some empty dataset
DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
FusekiServer server = FusekiServer.create().port(PORT).add("/ds", dsg).build();
server.start();
// -- Call the server
String queryString = StrUtils.strjoinNL("SELECT * { ", " VALUES ?Z { 123 'abc'}", " BIND (<http://my/num>(?Z) AS ?X )", "}");
try {
String url = "http://localhost:" + PORT + "/ds";
// Connect to the server and execute the query.
try (RDFConnection conn = RDFConnection.connect(url)) {
conn.queryResultSet(queryString, ResultSetFormatter::out);
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
server.stop();
}
}
Aggregations