@Override public IAccessPath<ISPO> getAccessPath(final Resource s, final URI p, final Value o) { return getAccessPath(s, p, o, null/*c*/, null/* filter */, null/* range */); }
@Override public IAccessPath<ISPO> getAccessPath(final Resource s, final URI p, final Value o) { return getAccessPath(s, p, o, null/*c*/, null/* filter */, null/* range */); }
public IAccessPath<ISPO> getAccessPath(final Resource s, final URI p, final Value o, final IElementFilter<ISPO> filter) { return getAccessPath(s, p, o, null/* c */, filter, null/* range */); }
public IAccessPath<ISPO> getAccessPath(final Resource s, final URI p, final Value o, final IElementFilter<ISPO> filter) { return getAccessPath(s, p, o, null/* c */, filter, null/* range */); }
final public IAccessPath<ISPO> getAccessPath(final IKeyOrder<ISPO> keyOrder) { return getAccessPath(keyOrder, null/* filter */); }
final public IAccessPath<ISPO> getAccessPath(final IKeyOrder<ISPO> keyOrder) { return getAccessPath(keyOrder, null/* filter */); }
@Override final public long removeStatements(final Resource s, final URI p, final Value o, final Resource c) { return getAccessPath(s, p, o, c).removeAll(); }
@Override final public long removeStatements(final Resource s, final URI p, final Value o, final Resource c) { return getAccessPath(s, p, o, c).removeAll(); }
/** * {@inheritDoc} * <p> * Core implementation. */ @Override final public long getStatementCount(final Resource c, final boolean exact) { if (exact) { return getAccessPath(null/* s */, null/* p */, null/* o */, c) .rangeCount(exact); } else { return getAccessPath(null/* s */, null/* p */, null/* o */, c) .rangeCount(exact); } }
/** * {@inheritDoc} * <p> * Core implementation. */ @Override final public long getStatementCount(final Resource c, final boolean exact) { if (exact) { return getAccessPath(null/* s */, null/* p */, null/* o */, c) .rangeCount(exact); } else { return getAccessPath(null/* s */, null/* p */, null/* o */, c) .rangeCount(exact); } }
/** * The #of explicit statements in the database (exact count based on * key-range scan). * <p> * Note: In order to get the #of explicit statements in the repository we * have to actually do a range scan and figure out for each statement * whether or not it is explicit. * * @param c * The context (optional). When not given, the count is reported * across all named graphs. */ public long getExplicitStatementCount(final Resource c) { return getAccessPath(null/* s */, null/* p */, null/* o */, c, ExplicitSPOFilter.INSTANCE, null).rangeCount(true/* exact */); }
/** * The #of explicit statements in the database (exact count based on * key-range scan). * <p> * Note: In order to get the #of explicit statements in the repository we * have to actually do a range scan and figure out for each statement * whether or not it is explicit. * * @param c * The context (optional). When not given, the count is reported * across all named graphs. */ public long getExplicitStatementCount(final Resource c) { return getAccessPath(null/* s */, null/* p */, null/* o */, c, ExplicitSPOFilter.INSTANCE, null).rangeCount(true/* exact */); }
@Override final public BigdataStatementIterator getStatements(final Resource s, final URI p, final Value o, final Resource c) { return asStatementIterator(getAccessPath(s, p, o, c).iterator()); }
@Override final public BigdataStatementIterator getStatements(final Resource s, final URI p, final Value o, final Resource c) { return asStatementIterator(getAccessPath(s, p, o, c).iterator()); }
/** * Removes all "inferred" statements from the database and the proof * chains (if any) associated with those inferences (does NOT commit the * database). */ public synchronized void removeAllEntailments() throws SailException { assertWritableConn(); flushStatementBuffers(true/* assertions */, true/* retractions */); if (quads) { // quads materalized inferences not supported yet. throw new UnsupportedOperationException(); } @SuppressWarnings("rawtypes") final IV NULL = null; database .getAccessPath(NULL, NULL, NULL, InferredSPOFilter.INSTANCE) .removeAll(); }
/** * Removes all "inferred" statements from the database and the proof * chains (if any) associated with those inferences (does NOT commit the * database). */ public synchronized void removeAllEntailments() throws SailException { assertWritableConn(); flushStatementBuffers(true/* assertions */, true/* retractions */); if (quads) { // quads materalized inferences not supported yet. throw new UnsupportedOperationException(); } @SuppressWarnings("rawtypes") final IV NULL = null; database .getAccessPath(NULL, NULL, NULL, InferredSPOFilter.INSTANCE) .removeAll(); }
@Override public Void call() throws Exception { final long begin = System.currentTimeMillis(); BigdataSailRepositoryConnection conn = null; try { conn = getQueryConnection(); // Range count all statements matching that access path. long rangeCount = 0; if (c != null && c.length > 0) { for (Resource r : c) { rangeCount += conn.getTripleStore().getAccessPath(s, p, o, r) .rangeCount(exact); } } else { rangeCount += conn.getTripleStore() .getAccessPath(s, p, o, (Resource) null) .rangeCount(exact); } final long elapsed = System.currentTimeMillis() - begin; buildAndCommitRangeCountResponse(resp, rangeCount, elapsed); return null; } finally { if (conn != null) { conn.close(); } } }
protected void getSames(IV id, Set<IV> sames) { IChunkedOrderedIterator<ISPO> it = db.getAccessPath(id, sameAs, null).iterator(); try { while (it.hasNext()) { IV same = it.next().o(); if (!sames.contains(same)) { sames.add(same); getSames(same, sames); } } } finally { it.close(); } it = db.getAccessPath(null, sameAs, id).iterator(); try { while (it.hasNext()) { IV same = it.next().s(); if (!sames.contains(same)) { sames.add(same); getSames(same, sames); } } } finally { it.close(); } }
/** * Throw an exception unless the graph is non-empty. * <p> * Note: This *MUST* use the view of the tripleStore which is associated * with the SailConnection in case the view is isolated by a transaction. * <P> * Note: If the IV could not be resolved, then that is proof that there is * no named graph for that RDF Resource. * * @see https://sourceforge.net/apps/trac/bigdata/ticket/569 * (LOAD-CREATE-LOAD using virgin journal fails with "Graph exists" * exception) */ static private void assertGraphExists(final AST2BOpUpdateContext context, final BigdataURI c) { if (c.getIV() != null && context.conn .getTripleStore() .getAccessPath(null/* s */, null/* p */, null/* o */, c.getIV()).rangeCount(false/* exact */) != 0) { throw new GraphExistsException(c); } }
/** * Throw an exception unless the graph is non-empty. * <p> * Note: This *MUST* use the view of the tripleStore which is associated * with the SailConnection in case the view is isolated by a transaction. * <P> * Note: If the IV could not be resolved, then that is proof that there is * no named graph for that RDF Resource. * * @see https://sourceforge.net/apps/trac/bigdata/ticket/569 * (LOAD-CREATE-LOAD using virgin journal fails with "Graph exists" * exception) */ static private void assertGraphExists(final AST2BOpUpdateContext context, final BigdataURI c) { if (c.getIV() != null && context.conn .getTripleStore() .getAccessPath(null/* s */, null/* p */, null/* o */, c.getIV()).rangeCount(false/* exact */) != 0) { throw new GraphExistsException(c); } }