public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { try { if (!isEmptyOrResourcePresent(contexts)) return false; return contains(dataset(), subj, pred, obj, contexts); } catch (SailException e) { throw new ModelException(e); } }
public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { try { if (!isEmptyOrResourcePresent(contexts)) return false; return contains(dataset(), subj, pred, obj, contexts); } catch (SailException e) { throw new ModelException(e); } }
public synchronized boolean clear(Resource... contexts) { try { if (contains(null, null, null, contexts)) { sink().clear(contexts); size = -1; return true; } } catch (SailException e) { throw new ModelException(e); } return false; }
public synchronized boolean clear(Resource... contexts) { try { if (contains(null, null, null, contexts)) { sink().clear(contexts); size = -1; return true; } } catch (SailException e) { throw new ModelException(e); } return false; }
public synchronized boolean add(Resource subj, IRI pred, Value obj, Resource... contexts) { if (subj == null || pred == null || obj == null) throw new UnsupportedOperationException("Incomplete statement"); try { if (contains(subj, pred, obj, contexts)) { logger.trace("already contains statement {} {} {} {}", subj, pred, obj, contexts); return false; } if (size >= 0) { size++; } if (contexts == null || contexts.length == 0) { sink().approve(subj, pred, obj, null); } else { for (Resource ctx : contexts) { sink().approve(subj, pred, obj, ctx); } } return true; } catch (SailException e) { throw new ModelException(e); } }
public synchronized boolean add(Resource subj, IRI pred, Value obj, Resource... contexts) { if (subj == null || pred == null || obj == null) throw new UnsupportedOperationException("Incomplete statement"); try { if (contains(subj, pred, obj, contexts)) { logger.trace("already contains statement {} {} {} {}", subj, pred, obj, contexts); return false; } if (size >= 0) { size++; } if (contexts == null || contexts.length == 0) { sink().approve(subj, pred, obj, null); } else { for (Resource ctx : contexts) { sink().approve(subj, pred, obj, ctx); } } return true; } catch (SailException e) { throw new ModelException(e); } }
public synchronized boolean remove(Resource subj, IRI pred, Value obj, Resource... contexts) { try { if (contains(subj, pred, obj, contexts)) { size = -1; CloseableIteration<? extends Statement, SailException> stmts; stmts = dataset().getStatements(subj, pred, obj, contexts); try { while (stmts.hasNext()) { Statement st = stmts.next(); sink().deprecate(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext()); } } finally { stmts.close(); } return true; } } catch (SailException e) { throw new ModelException(e); } return false; }
public synchronized boolean remove(Resource subj, IRI pred, Value obj, Resource... contexts) { try { if (contains(subj, pred, obj, contexts)) { size = -1; CloseableIteration<? extends Statement, SailException> stmts; stmts = dataset().getStatements(subj, pred, obj, contexts); try { while (stmts.hasNext()) { Statement st = stmts.next(); sink().deprecate(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext()); } } finally { stmts.close(); } return true; } } catch (SailException e) { throw new ModelException(e); } return false; }