Hi, I tried that and it does not change anything in the behaviour. Server starts fine but spatial queries don't work.
Best Markus > Am 17.09.2018 um 11:26 schrieb Øyvind Gjesdal <oyvin...@gmail.com>: > > Looking at our very similar config (based on the fuseki examples) only > difference I see (except from the additional library) is that our config > uses TDB, and your config uses TDB2. I believe tdbloader2 generates tdb1 > data ( I could be wrong), since I remember using it pre tdb2 release, so > there might be a mismatch in your config and built database. > > :tdb_dataset_readwrite > a tdb2:DatasetTDB2 ; > tdb2:location > "/srv/linked_data_store/fuseki-server/run/databases/mm" > > Does using > :tdb_dataset_readwrite > a tdb:DatasetTDB ; > tdb:location > "/srv/linked_data_store/fuseki-server/run/databases/mm" > > in your config help? > > Best regards, > Øyvind > > > Den man. 17. sep. 2018 kl. 11:14 skrev Marco Neumann < > marco.neum...@gmail.com>: > >> Ok let's take a look at this. >> >> 1. please include in the indexer in the classpath. It's part of the current >> jena distribution. >> >> 2. do you need jts? it's a package that allows you to index multi point >> geometries. here a sample query would be helpful. If single point >> geometries are indexed and used in conjunction with MBR range queries. >> there is no need for jts. >> >> >> On Mon, Sep 17, 2018 at 9:14 AM Markus Neumann <mneum...@meteomatics.com> >> wrote: >> >>> Hi, >>> (sorry for the long post) >>> >>> I've been struggling with the spatial index for a while now. >>> I've read https://jena.apache.org/documentation/query/spatial-query.html >> < >>> https://jena.apache.org/documentation/query/spatial-query.html> and >>> skipped through about every spatial related thread here on the list. >>> I managed to get an in-memory version up and running at some point >>> following this >>> >>> >> https://stackoverflow.com/questions/45814956/building-geospatial-index-when-working-with-jena-fuseki/52099066#52099066 >>> < >>> >> https://stackoverflow.com/questions/45814956/building-geospatial-index-when-working-with-jena-fuseki/52099066#52099066 >>>> >>> and this >>> https://ceyxstudios.com/2017/11/25/rdf-datenbank-mit-geo-funktionen/ < >>> https://ceyxstudios.com/2017/11/25/rdf-datenbank-mit-geo-funktionen/> >>> >>> But that was on a small dataset that I uploaded via the web-interface of >>> Fuseki. >>> >>> Now the story is a bit different. I'm building the database using >>> tdbloader2 and would like to create the spatial index upfront. >>> >>> java -cp jena-spatial.jar jena.spatialindexer --desc=assembler_file >>> I could not figure out, how to get this line to work. I have the >> following >>> possible scenarios: >>> >>> 1. I download the jena-spatial-3.8.0.jar and specify that in the >> classpath: >>> $ java -cp jena-spatial-3.8.0.jar jena.spatialindexer >>> --desc=../fuseki-server/run/configuration/mm.ttl >>> Error: Could not find or load main class jena.spatialindexer >>> >>> 2. I use the fuseki-server jar: >>> $ java -cp fuseki-server.jar jena.spatialindexer >>> --desc=./run/configuration/mm.ttl >>> WARN Custom SpatialContextFactory lib is not ready in >>> classpath:com/vividsolutions/jts/geom/CoordinateSequenceFactory >>> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a >>> transaction >>> >>> I managed to eliminate the warning about jts by including that in the >>> classpath, but the error remains the same (with full trace): >>> java -cp fuseki-server.jar:jts-1.13.jar jena.spatialindexer >>> --desc=./run/configuration/mm.ttl >>> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a >>> transaction >>> at >>> >> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417) >>> at >>> >> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159) >>> at >>> >> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348) >>> at >>> >> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251) >>> at >>> >> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148) >>> at >>> >> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161) >>> at >>> >> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150) >>> at >>> >> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141) >>> at >> org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64) >>> at >>> >> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:104) >>> at >>> >> org.apache.jena.sparql.core.DatasetGraphBaseFind.findAny(DatasetGraphBaseFind.java:72) >>> at >>> >> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:50) >>> at >>> >> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152) >>> at >>> >> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152) >>> at jena.spatialindexer.exec(spatialindexer.java:110) >>> at jena.cmd.CmdMain.mainMethod(CmdMain.java:93) >>> at jena.cmd.CmdMain.mainRun(CmdMain.java:58) >>> at jena.cmd.CmdMain.mainRun(CmdMain.java:45) >>> at jena.spatialindexer.main(spatialindexer.java:53) >>> >>> My configuration is the following: >>> @prefix : <http://base/#> . >>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >>> @prefix tdb2: <http://jena.apache.org/2016/tdb#> . >>> @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 geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . >>> @prefix geosparql: <http://www.opengis.net/ont/geosparql#> . >>> # Spatial >>> [] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . >>> spatial:SpatialtDataset rdfs:subClassOf ja:RDFDataset . >>> spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . >>> >>> :service_tdb_all a fuseki:Service ; >>> rdfs:label "TDB2 mm" ; >>> fuseki:dataset :spatial_dataset ; >>> fuseki:name "mm" ; >>> fuseki:serviceQuery "query" , "sparql" ; >>> fuseki:serviceReadGraphStore "get" ; >>> fuseki:serviceReadWriteGraphStore >>> "data" ; >>> fuseki:serviceUpdate "update" ; >>> fuseki:serviceUpload "upload" . >>> >>> :spatial_dataset a spatial:SpatialDataset ; >>> spatial:dataset :tdb_dataset_readwrite ; >>> spatial:index <#indexLucene> ; >>> . >>> >>> <#indexLucene> a spatial:SpatialIndexLucene ; >>> spatial:directory <file:Lucene> ; >>> #spatial:directory "mem" ; >>> spatial:definition <#definition> ; >>> . >>> >>> <#definition> a spatial:EntityDefinition ; >>> spatial:entityField "uri" ; >>> spatial:geoField "geo" ; >>> # custom geo predicates for 1) Latitude/Longitude Format >>> spatial:hasSpatialPredicatePairs ( >>> [ spatial:latitude geo:lat ; spatial:longitude geo:long ] >>> ) ; >>> # custom geo predicates for 2) Well Known Text (WKT) Literal >>> spatial:hasWKTPredicates (geosparql:asWKT) ; >>> # custom SpatialContextFactory for 2) Well Known Text (WKT) Literal >>> spatial:spatialContextFactory >>> # "com.spatial4j.core.context.jts.JtsSpatialContextFactory" >>> "org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory" >>> . >>> >>> :tdb_dataset_readwrite >>> a tdb2:DatasetTDB2 ; >>> tdb2:location >>> "/srv/linked_data_store/fuseki-server/run/databases/mm" . >>> >>> And I've changed the fuseki script to include the jts jar: >>> FUSEKI_CLASSES=$FUSEKI_HOME/jts-1.13.jar >>> >>> I see no errors or warnings in the server log, when starting with that >>> configuration, the Lucene folder is created and populated with something: >>> $ ll run/configuration/Lucene/ >>> total 4 >>> -rw-rw-r-- 1 process process 71 Sep 14 09:28 segments_1 >>> -rw-rw-r-- 1 process process 0 Sep 14 09:28 write.lock >>> >>> But any spatial query does not return any results. >>> Any help on how to tackle this would be highly appreciated. >>> >>> Best >>> Markus Neumann >>> >>> >> >> -- >> >> >> --- >> Marco Neumann >> KONA >>