Configure/Enable 通过 RDF4J 的 GeoSPARQL 插件 API

Configure/Enable GeoSPARQL plugin through RDF4J API

我正在尝试自动创建 GraphDB 存储库,它还必须启用 GeoSPARQL 插件。为此,我发送了 2 条 INSERT 语句,第一个用于配置索引和准确性,第二个语句用于启用插件。 但是 conn.prepareUpdate(QueryLanguage.SPARQL, enablePluginStatement).execute() 操作 "seems" 到 运行 是异步的。它没有等到索引操作完成(就像 运行 从 Workbench 执行相同的 INSERT 查询时发生的那样)它几乎立即继续执行以下语句,即关闭存储库。 当我通过 Netbeans 调试器执行相同的代码时,相同的单个语句需要更多的时间才能完成并且确实正确地完成了索引。 对这个或类似问题有任何见解吗?

    26609 [main] INFO  com.ontotext.config.AbstractParameter  - Configured parameter 'deduplicate.construct' to default value 'true' 
    26610 [main] INFO  com.ontotext.config.AbstractParameter  - Configured parameter 'reuse.vars.in.subselects' to default value 'false' 
    26691 [main] INFO  com.ontotext.trree.monitorRepository.MonitorRepositoryConnection  - Incoming update: 
PREFIX : <http://www.ontotext.com/plugins/geosparql#> 
INSERT DATA {    _:s :enabled "true" .  } 
    26764 [main] INFO  com.ontotext.plugin.GeoSPARQL  - >>>>>>>> GeoSPARQL: Initializing Lucene indexer... 
    26863 [main] INFO  com.ontotext.plugin.GeoSPARQL  -
        >>>>>>>> GeoSPARQL: Lucene indexer initialized! 
    26863 [main] INFO  com.ontotext.plugin.GeoSPARQL  - >>>>>>>> GeoSPARQL: Initializing indexing process... 
    32032 [main] INFO  com.ontotext.plugin.GeoSPARQL 
        - >>>>>>>> GeoSPARQL: Indexing completed! 
    52200 [main] WARN  com.ontotext.trree.free.GraphDBFreeSchemaRepository  - Closing active connection due to shut down; consider setting the org.eclipse.rdf4j.repository.debug system property 
    52596 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Shutting down plugins (DEFAULT)...

您可以将复合交易用作多个 "insert where" 和 "delete where" 表达式,用 ; 分隔可以在同一更新中看到与之前的更改相比的更改。例如:

PREFIX : <http://www.ontotext.com/plugins/geosparql#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>INSERT DATA {    _:s :enabled "true" .  } ;INSERT DATA { _:s :prefixTree "quad"; :precision "25". }

卷曲:

curl 'http://localhost:7200/repositories/geosparql/statements' -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'update=PREFIX : <http://www.ontotext.com/plugins/geosparql#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> INSERT DATA { _:s :enabled "true" . } ; INSERT DATA { _:s :prefixTree "quad"; :precision "25". }'

应该可以先建索引再设置精度:

[INFO ] 2019-02-26 12:08:36,331 [repositories/geosparql | c.o.g.s.StatementsController] POST SPARQL update request to repository
[INFO ] 2019-02-26 12:08:36,349 [repositories/geosparql | c.o.p.GeoSPARQL] >>>>>>>> GeoSPARQL: Initializing Lucene indexer...
[INFO ] 2019-02-26 12:08:36,383 [repositories/geosparql | c.o.p.GeoSPARQL] >>>>>>>> GeoSPARQL: Lucene indexer initialized!
[INFO ] 2019-02-26 12:08:36,383 [repositories/geosparql | c.o.p.GeoSPARQL] >>>>>>>> GeoSPARQL: Initializing indexing process...
[INFO ] 2019-02-26 12:08:36,466 [repositories/geosparql | c.o.p.GeoSPARQL] >>>>>>>> GeoSPARQL: Indexing completed!