Hi Johan,

With your setup and that data I got this to work:

PREFIX spatial: <http://jena.apache.org/spatial#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?placeName
{
    ?place spatial:nearby (51.382 -2.71909 10 'km') .
    ?place rdfs:label ?placeName
}


Your query has:

PREFIX geoarq: <http://jena.apache.org/GeoARQ/property#>

which should be <http://jena.apache.org/spatial#>

Specifying all 4 arguments seems to be necessary as well.

You may be interested in:

https://github.com/galbiston/geosparql-jena

which is a GeoSPARQL implementation for Jena.

The Jena project is discussing dropping the adhoc jena-spatial in favour of this OGC GeoSPATQL compliant system.

    Andy

On 12/12/2018 14:25, Johan Kumps wrote:
As it seems that attachements are not preserved here I copied my config
below. The data file can be found here :
https://github.com/apache/jena/blob/master/jena-spatial/src/test/resources/geoarq-data-1.ttl

@prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix spatial: <http://jena.apache.org/spatial#> .
@prefix geosparql: <http://www.opengis.net/ont/geosparql#> .

:service_tdb_all  a                   fuseki:Service ;
         rdfs:label                    "TDB mySpatialDataset" ;
         fuseki:dataset                :spatial_dataset ;
         fuseki:name                   "mySpatialDataset" ;
         fuseki:serviceQuery           "query" , "sparql" ;
         fuseki:serviceReadGraphStore  "get" ;
         fuseki:serviceReadWriteGraphStore
                 "data" ;
         fuseki:serviceUpdate          "update" ;
         fuseki:serviceUpload          "upload" .

:tdb_dataset_readwrite
         a             tdb:DatasetTDB ;
         tdb:location
"D:\\software\\copyable\\apache-jena-fuseki-3.9.0\\run/databases/mySpatialDataset"
.

:spatial_dataset rdf:type     spatial:SpatialDataset ;
     spatial:dataset   :tdb_dataset_readwrite ;
     spatial:index     <#indexSpatialLucene> ;
     .

<#indexSpatialLucene> a spatial:SpatialIndexLucene ;
     spatial:directory <file:Data/mySpatialDataset_spatial_index> ;
     spatial:definition <#definition> ;
     .

<#definition> a spatial:EntityDefinition ;
     spatial:entityField      "uri" ;
     spatial:geoField     "geo" ;
     # custom geo predicates for 1) latitude/longitude
     spatial:hasSpatialPredicatePairs (
          [ spatial:latitude :latitude_1 ; spatial:longitude :longitude_1 ]
          [ spatial:latitude :latitude_2 ; spatial:longitude :longitude_2 ]
          ) ;
     # custom geo predicates for 2) Well Known Text Literal
     spatial:hasWKTPredicates (:wkt_1 :wkt_2) ;
     # custom SpatialContextFactory for 2) Well Known Text Literal
     spatial:spatialContextFactory
          "org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
     .

Op wo 12 dec. 2018 om 14:34 schreef Johan Kumps <[email protected]>:

Hi all,

I'm struggling with my setup of a Java application using Jena to connect
to a spatial dataset managed by Fuseki. Please find the configuration I use
within Fuseki in the attached mySpatialDataset.ttl file.

The command I use to run Fuseki is :

java -Xmx1200M -cp "fuseki-server.jar;jts-1.13.jar"
org.apache.jena.fuseki.cmd.FusekiCmd -debug %*

I uploaded the geoarq-data-1.ttl file with some data. Unfortunately my
query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX geoarq: <http://jena.apache.org/GeoARQ/property#>

SELECT ?airport {
     ?s geoarq:nearby (51.3000 -2.71000) .
     ?s rdfs:label ?airport .
}

does not return anything altough when running the dataset embedded in my
JVM without using Fuseki it is working fine. I can see the index is being
created in my
%FUSEKI_HOME%\run\configuration\Data\mySpatialDataset_spatial_index folder.

Could you have a look at it and help me out please?

The output of the startup process is the following which seems to be fine :

[2018-12-12 14:30:21] Server     INFO  Apache Jena Fuseki 3.9.0
[2018-12-12 14:30:22] Config     INFO
FUSEKI_HOME=D:\software\copyable\apache-jena-fuseki-3.9.0\.
[2018-12-12 14:30:22] Config     INFO
FUSEKI_BASE=D:\software\copyable\apache-jena-fuseki-3.9.0\run
[2018-12-12 14:30:22] Config     INFO  Shiro file:
file://D:\software\copyable\apache-jena-fuseki-3.9.0\run\shiro.ini
[2018-12-12 14:30:23] Config     INFO  Configuration file:
D:\software\copyable\apache-jena-fuseki-3.9.0\run\config.ttl
[2018-12-12 14:30:23] riot       WARN  [line: 5, col: 9 ] Bad IRI:
<D:\software\copyable\apache-jena-fuseki-3.9.0\run\config.ttl#> Code:
4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of
URIs/IRIs. These characters are permitted in RDF URI References, XML system
identifiers, and XML Schema anyURIs.
[2018-12-12 14:30:23] Config     INFO  Load configuration:
file:///D:/software/copyable/apache-jena-fuseki-3.9.0/run/configuration/mySpatialDataset.ttl
[2018-12-12 14:30:23] Config     INFO  Register: /mySpatialDataset
[2018-12-12 14:30:23] Server     INFO  Apache Jena Fuseki
[2018-12-12 14:30:23] Server     INFO  Configuration file
D:\software\copyable\apache-jena-fuseki-3.9.0\run\config.ttl
[2018-12-12 14:30:23] Server     INFO  Path = /mySpatialDataset; Services
= [data, quads, upload, query, sparql, update, get]
[2018-12-12 14:30:23] Server     INFO    Fuseki: 3.9.0
[2018-12-12 14:30:23] Server     INFO    Java:   1.8.0_131
[2018-12-12 14:30:23] Server     INFO    Memory: max=1,0 GiB
[2018-12-12 14:30:23] Server     INFO    OS:     Windows 10 10.0 amd64
[2018-12-12 14:30:24] Server     INFO  Started 2018/12/12 14:30:24 CET on
port 3030



Reply via email to