![](/img/trans.png)
[英]Insert SPARQL query with Java jena to upload triples in fuseki
[英]Jena Fuseki Sparlql INSERT and DELETE in java
我正在使用uri像uri中一樣使用apache jena sparql api與遠程jena fuseki服務器進行通信: http:// localhost:3030 / Test 。 除了select之外,我還希望對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
}
SPARQL查詢和SPARQL更新是不同的語言
使用UpdateExecutionFactory創建SPARQL更新的執行。
端點將不是“ http:// localhost:3030 / Test ”-更有可能是“ http:// localhost:3030 / Test / update ”。 查詢服務是/ Test / query,盡管直接在數據集上通常可以使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.