我正在使用gStore 的命令行查询模式(gquery)。首先,我使用 创建了一个示例数据库bin/gbuild -db test_db -f test_db.nt
,其中 test_db.nt 仅包含一行文本:<a> <b> <c>
。然后我在 gStore 的根目录中创建了两个文件,用于更新和查询数据库,分别称为 test_insert.rq 和 test_query.rq。这些文件的内容如下:
测试插入.rq:
INSERT DATA {<a1> <b1> <c1> .}
测试查询.rq:
SELECT * WHERE {?x <b1> <c1> .}
通过 启动命令行查询会话后bin/gquery -db test_db
,我执行插入:
> sparql test_insert.rq
然后,在同一个会话中,我执行查询:
> sparql test_query.rq
This returns <a1>
as the result for ?x
, which is correct. However, if I exit the gquery process by Ctrl + C, restart it with the same command, and execute the query again, no results are returned.
Since the results are correct in the same session, I assume this is not an update bug. Are there any additional steps I should perform to ensure that the updates done in the command line mode of gquery are preserved after restarts?
If you exit gquery with Ctrl + C, the updates you have performed during the session are lost (i.e., not flushed to disk). The reason why you can see the update results during the session is that the in-memory version of the database is updated.
If you want to preserve the updates after restarts, you should use the
quit
command to exit gquery.