gpt4 book ai didi

Java如何使用sparql删除查询

转载 作者:行者123 更新时间:2023-12-02 12:55:04 25 4
gpt4 key购买 nike

我需要一些帮助从我的 fuseki 服务器中删除条目

例如,如何删除此条目?

<http://person/Test1>
<http://purl.org/dc/elements/1.1/name> "Test1" ;

我已经尝试过,但它不起作用......

public void deletePerson(String[] personalData ) {
String personURI = "http://localhost:3030/Date";
String name = personalData[0];
String query = "DELETE WHERE { <http://person/" + formattedName + "> }";
QueryExecution qe = QueryExecutionFactory.sparqlService(
"http://localhost:3030/Date/query",
"PREFIX dc: <http://purl.org/dc/elements/1.1/> " + query);
}

Exception in thread "AWT-EventQueue-0" com.hp.hpl.jena.query.QueryParseException: Encountered " "DELETE WHERE "" at line 1, column 47. Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"describe" ...
"construct" ...
"ask" ...

最佳答案

我认为你应该使用UpdateExecutionFactory类似这样的事情

 UpdateRequest request = UpdateFactory.create(queryString) ;
UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore) ;

关于Java如何使用sparql删除查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44461773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com