1

在 3.0.0 版中,由于推断三元组被添加到实际图中(而不是像以前那样添加到默认图中),是否可以在没有推断三元组的情况下导出/获取实际图?非常感谢。

4

1 回答 1

0

是的,这是可能的。

1. 通过 Java API

http://example.org/graph1您可以通过多种方式从命名图中检索语句。在这里显示两个替代方案:

 IRI graph1 = valueFactory.createIRI("http://example.org/graph1");

 try(RepositoryConnection conn = repository.getConnection()) {

     // option 1: getStatements of everything in a named graph, setting
     // includeInferred to false
     RepositoryResult<Statement> result = conn.getStatement(null, null, null, false, graph1);

    // option 2: using export with an RDFHandler (export never includes inferred triples)
    RDFHandler collector = new StatementCollector(); 
    conn.export(graph1, collector);
 }

2. 通过 RDF4J 工作台

在工作台中执行此操作的最简单方法是使用 SPARQL CONSTRUCT 查询:

construct from <http://example.org/graph1> where { ?s ?p ?o }

确保在点击“执行”之前未选中“包含推断语句”选项。然后在查询结果屏幕上,选择您喜欢的下载格式,然后点击“下载”。

于 2019-09-26T07:02:13.947 回答