I've a problem with rdf4j: i want to delete from my GraphDB repository "Feed" all the triples with feed:hashCode
as predicate.
The first query verifies if there is a triple with the url
parameter as subject, feed:hashCode
as predicate, and hash
parameter has object, and it works. If this statement doesn't exist in my repository, the second query begins, it should delete all the triples with feed:hashCode
as predicate and url
as subject, but it doesn't work, what is the problem?
Here is the code:
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
);
result = feedUrlQuery.evaluate();
//the feed is new or updated
if(result == false) {
Update removeOldHash = conn.prepareUpdate(
// @formatter:off
"PREFIX feed: <http://feed.org/>\n" +
"DELETE WHERE{\n"+
"<"+url+"> feed:hashCode ?s.\n" +
"}"
// @formatter:on
);
removeOldHash.execute();
}
}
}
finally {
repository.shutDown();
return result;
}
}
The error code is: "Missing parameter: query", and the server response is : "400 Bad Request"