我有一个基于 RDF4j 磁盘的 Native Store,大约有 9M 三元组。我正在尝试提高删除大约 4K 三元组的性能,现在大约需要 20 秒。我试过了:
1
Repository rep = new SailRepository(new NativeStore(new File(DATA_DIR + "/db"), "spoc, posc, opsc"));
diskRep.initialize();
RepositoryConnection conn = rep.getConnection();
conn.remove(statements); // first find statements, then pass them into remove method
2
// Execute with conn.prepareUpdate(QueryLanguage.SPARQL, query)
DELETE DATA
{
<#book2> <http://purl.org/dc/elements/1.1/title> "David Copperfield" ;
<http://purl.org/dc/elements/1.1/creator> "Edmund Wells" .
// all triples explicitly here
}
3
// Execute with conn.prepareUpdate(QueryLanguage.SPARQL, query)
DELETE { ?person ?property ?value }
WHERE
{ ?person ?property ?value ; <http://xmlns.com/foaf/0.1/givenName> "Fred" }
// query pattern
所有三种方法都显示相似的时间。我相信有一种更快的方法可以删除 4K 三元组。如果您对我做错了什么有任何想法,请告诉我。我很乐意提供更多详细信息。