1

我正在使用 apache jena sparql api 使用 uri 与远程 jena fuseki 服务器通信,如 uri: http://localhost:3030/Test。除了选择之外,我还想执行 sparql 插入和删除查询。这是我的选择查询代码:

private String serviceURI =  "http://localhost:3030/Test";
    /**
     * This method prints the result of a sparql query as table
     * @param Query to get the result of
     */
    public void printSparqlResult(String query){
        QueryExecution q = QueryExecutionFactory.sparqlService(this.serviceURI,query);
        ResultSet results = q.execSelect(); // get result-set
         ResultSetFormatter.out(System.out, results); // print results
    }
4

1 回答 1

0

SPARQL 查询和 SPARQL 更新是不同的语言

使用 UpdateExecutionFactory 创建 SPARQL 更新的执行。

端点不会是“ http://localhost:3030/Test ”——更可能是“ http://localhost:3030/Test/update ”。查询服务是 /Test/query 虽然通常直接在数据集上工作。

于 2016-02-27T16:42:06.210 回答