Thanks for the input. I was actually just assuming, that Jena would support it 
in some way.

I've gone through
https://jena.apache.org/documentation/query/writing_propfuncs.html 
<https://jena.apache.org/documentation/query/writing_propfuncs.html>
https://jena.apache.org/documentation/query/extension.html 
<https://jena.apache.org/documentation/query/extension.html>
https://jena.apache.org/documentation/query/writing_functions.html 
<https://jena.apache.org/documentation/query/writing_functions.html>
and some other pages, but my Java knowledge is too little and too long away to 
really make sense of any of it.

It would be great if someone could provide a minimal example on how to include 
my own function definition in Fuseki.
My main problems in understandig are:
- where to put the java code and how to name it
- how to include it with Fuseki
- how to call it in the SPARQL query

Many thanks and best regards
Markus

> Am 24.08.2018 um 13:47 schrieb ajs6f <[email protected]>:
> 
> I'm no expert on Jena's GeoSPARQL support, but our docs:
> 
> https://jena.apache.org/documentation/query/spatial-query.html
> 
> don't mention any such namespaces as http://www.opengis.net/rdf/functions#. 
> Where did you see it documented that Jena supports such functions?
> 
> I only see a small and specific set of functions:
> 
> https://jena.apache.org/documentation/query/spatial-query.html#property-function-library
> 
> but you could certainly use Jena's extension mechanisms to do this kind of 
> calculation:
> 
> https://jena.apache.org/documentation/query/writing_propfuncs.html
> 
> although it's not trivial to do that. Perhaps a committer with more knowledge 
> about jena-spatial can help here.
> 
> ajs6f
> 
>> On Aug 24, 2018, at 5:47 AM, Markus Neumann <[email protected]> wrote:
>> 
>> Hi,
>> 
>> I'm quite new to both Fuseki and mailinglists, so please be patient with me.
>> 
>> I've managed to set up a Fuseki 2 server together with a Lucene spatial 
>> index.
>> E.g the following query works as expected:
>> 
>> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
>> PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
>> PREFIX mm: <http://rdf.meteomatics.com/mm/>
>> PREFIX spatial: <http://jena.apache.org/spatial#>
>> SELECT *
>> WHERE {
>> ?loc spatial:nearby (47.5 8.5 5 'km') .
>> ?loc a mm:Location;
>>      geo:lat ?lat;
>>      geo:long ?long;
>>      geosparql:asWKT ?wkt;
>>      mm:station_name ?name.
>> }
>> 
>> Now I would like to run the following:
>> 
>> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
>> PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
>> PREFIX mm: <http://rdf.meteomatics.com/mm/>
>> PREFIX spatial: <http://jena.apache.org/spatial#>
>> PREFIX ogcf: <http://www.opengis.net/rdf/functions#>
>> SELECT ?distance WHERE {
>> BIND(mm-locations:8515451 as ?wil)
>> ?wil spatial:nearby(?lat ?lon 8 'km') .
>> ?wil geosparql:asWKT ?wil_wkt .
>> ?loc a mm:Location;
>>      geo:lat ?lat;
>>      geo:long ?lon;
>>      geosparql:asWKT ?wkt.
>> BIND( ogcf:distance(?wil_wkt, ?wkt, 'km') as ?distance)
>> } 
>> 
>> The query completes and gets the correct amount of results, but all wihout 
>> value.
>> In the log pops up this message:
>> 
>> [2018-08-24 09:45:33] exec       WARN  URI 
>> <http://www.opengis.net/rdf/functions#distance> has no registered function 
>> factory
>> 
>> Is there a way to get this to work? Or is there another way to compute 
>> spatial distances?
>> 
>> Many thanks for your time.
>> 
>> Best regards
>> Markus
>> 
> 

Reply via email to