8181import org .aksw .jenax .dataaccess .sparql .link .transform .RDFLinkTransforms ;
8282import org .aksw .jenax .dataaccess .sparql .linksource .RDFLinkSource ;
8383import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RdfDataSourcePolyfill ;
84- import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RdfDataSourceWithBnodeRewrite ;
85- import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RdfDataSourceWithLocalCache ;
84+ import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RDFDataSourceWithBnodeRewrite ;
85+ import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RDFDataSourceWithLocalCache ;
8686import org .aksw .jenax .dataaccess .sparql .polyfill .datasource .RdfDataSourceWithLocalLateral ;
8787import org .aksw .jenax .graphql .rdf .api .RdfGraphQlExecFactory ;
8888import org .aksw .jenax .graphql .sparql .GraphQlExecFactoryOverSparql ;
108108import org .apache .commons .compress .compressors .CompressorStreamFactory ;
109109import org .apache .commons .io .IOUtils ;
110110import org .apache .jena .geosparql .configuration .GeoSPARQLConfig ;
111+ import org .apache .jena .geosparql .spatial .index .v2 .SpatialIndexIoKryo ;
111112import org .apache .jena .geosparql .spatial .index .v2 .SpatialIndexLib ;
112113import org .apache .jena .graph .Node ;
113114import org .apache .jena .irix .IRIx ;
@@ -195,7 +196,7 @@ public static RDFEngineBuilder<?> setupRdfDataEngineBuilder(CmdSparqlIntegrateMa
195196 throw new RuntimeException ("No RdfDataSourceFactory registered under name " + sourceType );
196197 }
197198
198- RDFEngineBuilder <?> engineBuilder = factory .newEngineBuilder ();
199+ RDFEngineBuilder <?> engineBuilder = factory .newBuilder ();
199200
200201 RdfDataSourceSpecBasicFromMap spec = RdfDataSourceSpecBasicFromMap .create ();
201202 spec .setTempDir (cmd .tempPath );
@@ -602,6 +603,13 @@ public static int sparqlIntegrate(CmdSparqlIntegrateMain cmd) throws Exception {
602603 throw new RuntimeException (
603604 "GeoIndex requested but the configured engine does not appear to be Jena-based as the dataset was null!" );
604605 }
606+
607+ // If there is an existing index then try to load it.
608+ Path geoIndexFile = cmd .arqConfig .geoindexFile ;
609+ if (geoIndexFile != null ) {
610+ GeoSPARQLConfig .setupSpatialIndex (finalDataset , cmd .arqConfig .geoindexSrs , geoIndexFile );
611+ finalDataset .getContext ().setTrue (SPATIAL_INDEX_IS_CLEAN );
612+ }
605613 }
606614
607615 Long resultSetPageSize = cmd .paginationConfig .queryPageSize ;
@@ -673,7 +681,7 @@ public static int sparqlIntegrate(CmdSparqlIntegrateMain cmd) throws Exception {
673681
674682 if (cmd .cacheRewriteGroupBy ) {
675683 rdfEngineDecorator = rdfEngineDecorator .decorate (
676- RdfDataSourceWithLocalCache .TransformInjectCacheSyntax ::rewriteQuery );
684+ RDFDataSourceWithLocalCache .TransformInjectCacheSyntax ::rewriteQuery );
677685 // dataSourceTmp = RdfDataEngines.of(new
678686 // RdfDataSourceWithLocalCache(dataSourceTmp), dataSourceTmp);
679687 }
@@ -1086,7 +1094,7 @@ public static RDFDataSource applyMacroExpansion(CmdSparqlIntegrateMain cmd, RDFD
10861094 BnodeRewriteMode bnodeRewriteMode = BnodeRewriteMode .LOOKUP_ONLY ;
10871095
10881096 if (!Strings .isNullOrEmpty (bnodeProfile )) {
1089- dataSourceTmp = new RdfDataSourceWithBnodeRewrite (dataSourceTmp , bnodeProfile , BnodeRewriteMode .FULL );
1097+ dataSourceTmp = new RDFDataSourceWithBnodeRewrite (dataSourceTmp , bnodeProfile , BnodeRewriteMode .FULL );
10901098
10911099// dataSourceTmp = RdfDataEngines.of(new RdfDataSourceWithBnodeRewrite(dataSourceTmp, bnodeProfile),
10921100// dataSourceTmp::close);
@@ -1095,7 +1103,7 @@ public static RDFDataSource applyMacroExpansion(CmdSparqlIntegrateMain cmd, RDFD
10951103 // dataSourceTmp = RdfDataEngines.decorate(dataSourceTmp, decorator);
10961104 } else {
10971105 if (dbmsProfile != null ) {
1098- dataSourceTmp = new RdfDataSourceWithBnodeRewrite (dataSourceTmp , bnodeProfile , BnodeRewriteMode .LOOKUP_ONLY );
1106+ dataSourceTmp = new RDFDataSourceWithBnodeRewrite (dataSourceTmp , bnodeProfile , BnodeRewriteMode .LOOKUP_ONLY );
10991107 }
11001108
11011109 // Replace <http://ns.aksw.org/function/forceBnodeIri> with a default definition
@@ -1147,7 +1155,7 @@ public static void updateSpatialIndex(Dataset dataset, String srs, Path file) {
11471155 Context cxt = dataset .getContext ();
11481156 // logger.info("(Re-)computing geo index");
11491157 try {
1150- GeoSPARQLConfig . setupSpatialIndex (dataset , srs , file );
1158+ SpatialIndexIoKryo . buildSpatialIndex (dataset , srs , file );
11511159 cxt .setTrue (SPATIAL_INDEX_IS_CLEAN );
11521160 } catch (Exception e ) {
11531161 if (e .getMessage ().toLowerCase ().contains ("no srs found" )) {
0 commit comments