本文整理汇总了Java中org.openrdf.sail.SailConnection.removeStatements方法的典型用法代码示例。如果您正苦于以下问题:Java SailConnection.removeStatements方法的具体用法?Java SailConnection.removeStatements怎么用?Java SailConnection.removeStatements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.sail.SailConnection
的用法示例。
在下文中一共展示了SailConnection.removeStatements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putEntry
import org.openrdf.sail.SailConnection; //导入方法依赖的package包/类
/**
* Update the cache entry for the given resource with the given entry.
*
* @param resource the resource to update
* @param entry the entry for the resource
*/
@Override
public void putEntry(URI resource, CacheEntry entry) {
try {
try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
// store cache entry in database
dbcon.removeCacheEntry(resource.stringValue());
// update triples in cache
SailConnection con = store.getConnection();
try {
con.begin();
con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
for(Statement stmt : entry.getTriples()) {
con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), store.getValueFactory().createURI(cacheContext));
}
con.commit();
entry.setResource(store.getValueFactory().createURI(resource.stringValue()));
dbcon.storeCacheEntry(entry);
} catch(SailException ex) {
con.rollback();
} finally {
con.close();
}
}
} catch (SailException | SQLException e) {
log.error("could not retrieve cached triples from repository",e);
}
}
示例2: removeEntry
import org.openrdf.sail.SailConnection; //导入方法依赖的package包/类
/**
* Remove the cache entry for the given resource if it exists. Does nothing otherwise.
*
* @param resource the resource to remove the entry for
*/
@Override
public void removeEntry(URI resource) {
try {
try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
// store cache entry in database
dbcon.removeCacheEntry(resource.stringValue());
// update triples in cache
SailConnection con = store.getConnection();
try {
con.begin();
con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
con.commit();
} catch(SailException ex) {
con.rollback();
} finally {
con.close();
}
}
} catch (SailException | SQLException e) {
log.error("could not remove cached triples from repository",e);
}
}
示例3: clear
import org.openrdf.sail.SailConnection; //导入方法依赖的package包/类
/**
* Clear all entries in the cache backend.
*/
@Override
public void clear() {
try {
try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
// list all entries and remove them
CloseableIteration<KiWiCacheEntry, SQLException> entries = dbcon.listAll();
while (entries.hasNext()) {
dbcon.removeCacheEntry(entries.next());
}
// update triples in cache
SailConnection con = store.getConnection();
try {
con.begin();
con.removeStatements((Resource) null, null, null, store.getValueFactory().createURI(cacheContext));
con.commit();
} catch(SailException ex) {
con.rollback();
} finally {
con.close();
}
}
} catch (SailException | SQLException e) {
log.error("could not remove cached triples from repository",e);
}
}