我的 rdf4j 有问题:我想从我的 GraphDB 存储库中删除“Feed”所有带有feed:hashCode谓词的三元组。
第一个查询验证是否存在一个三元组,其中url参数作为主语,feed:hashCode作为谓语,并且hash参数具有宾语,并且它有效。如果我的存储库中不存在此语句,则第二个查询开始,它应该删除所有带有feed:hashCode谓词和url主语的三元组,但它不起作用,问题是什么?
这是代码:
public static boolean updateFeedQuery(String url, String hash) throws RDFParseException, RepositoryException, IOException{
Boolean result=false;
Repository repository = new SPARQLRepository("http://localhost:7200/repositories/Feed");
repository.initialize();
try {
try (RepositoryConnection conn = repository.getConnection()) {
BooleanQuery feedUrlQuery = conn.prepareBooleanQuery(
// @formatter:off
"PREFIX : <http://purl.org/rss/1.0/>\n" +
"PREFIX feed: <http://feed.org/>\n" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
"PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" +
"ASK{\n" +
"<"+url+"> feed:hashCode \""+hash+"\";\n"+
"rdf:type :channel.\n" +
"}"
// @formatter:on
); …Run Code Online (Sandbox Code Playgroud)