Apache Marmotta 使用 SPARQL 更新删除所有图

Apache Marmotta Delete All Graphs using SPARQL Update

我正在尝试将所有加载的图表清除到我的 Apache Marmotta 实例中。我已经尝试了几个 SPARQL 查询来这样做,但我无法删除我导入的 RDF/XML 图。这样做的适当语法是什么?

试试这个查询:

DELETE WHERE { ?x ?y ?z }

小心,因为它会删除数据库中的每个三元组,包括 Marmotta 的内置三元组。

我为实验做了一些事情:

  1. 我下载了 source code of Marmotta and used the Silver Searcher 工具,用于使用以下命令搜索 DELETE 查询:

    ag '"DELETE '
    

    这并没有多大帮助。

  2. 我导航到 Marmotta 安装目录并查看了调试日志:

    tail -f marmotta-home/log/marmotta-main.log
    

    这表明解析器无法处理查询 DELETE DATA { ?s ?p ?o }。 "error while executing update" 后面的例外是:

    org.openrdf.sail.SailException: org.openrdf.rio.RDFParseException: Expected an RDF value here, found '?' [line 8]
    [followed by a long stacktrace]
    

    这表明解析器不允许在DELETE DATA之后的查询中使用变量。

  3. 基于 related Whosebug answer,我尝试了 CLEAR / CLEAR GRAPH / DROP / DROP GRAPH,但它们没有用.

  4. 我尝试了 DELETE*?s ?p ?p 的多种组合,并意外地设法让它与 DELETE WHERE 结构一起工作。根据 W3C 文档:

    The DELETE WHERE operation is a shortcut form for the DELETE/INSERT operation where bindings matched by the WHERE clause are used to define the triples in a graph that will be deleted.