public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements( Resource subj, URI pred, Value obj, Resource... contexts) throws QueryEvaluationException { return new EmptyIteration<Statement, QueryEvaluationException>(); } });
@Override public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements( final Resource subj, final URI pred, final Value obj, final Resource... contexts) throws QueryEvaluationException { return new EmptyIteration<Statement, QueryEvaluationException>(); }
public RepositoryResult<Namespace> getNamespaces() throws RepositoryException { return new RepositoryResult<Namespace>(new EmptyIteration<Namespace, RepositoryException>()); }
public RepositoryResult<Namespace> getNamespaces() throws RepositoryException { return new RepositoryResult<Namespace>( new EmptyIteration<Namespace, RepositoryException>()); }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(EmptySet emptySet, BindingSet bindings) throws QueryEvaluationException { return new EmptyIteration<BindingSet, QueryEvaluationException>(); }
public JoinIterator(EvaluationStrategy strategy, Join join, BindingSet bindings) throws QueryEvaluationException { this.strategy = strategy; this.join = join; leftIter = strategy.evaluate(join.getLeftArg(), bindings); // Initialize with empty iteration so that var is never null rightIter = new EmptyIteration<BindingSet, QueryEvaluationException>(); }
@Override public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements( Resource subj, IRI pred, Value obj, Resource... contexts) throws QueryEvaluationException { if (funcInstance.equals(subj)) { if (pred != null) { Value v = argValues.get(pred); if (v != null && (obj == null || v.equals(obj))) { return new SingletonIteration<Statement, QueryEvaluationException>( vf.createStatement(subj, pred, v)); } } return new EmptyIteration<Statement, QueryEvaluationException>(); } else { return qpTripleSource.getStatements(subj, pred, obj, contexts); } }
public LeftJoinIterator(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings) throws QueryEvaluationException { this.strategy = strategy; this.join = join; this.scopeBindingNames = join.getBindingNames(); leftIter = strategy.evaluate(join.getLeftArg(), bindings); // Initialize with empty iteration so that var is never null rightIter = new EmptyIteration<BindingSet, QueryEvaluationException>(); }
/** * List all justifications supporting the given triple. * @param triple * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsForTriple(KiWiTriple triple) throws SQLException { if(triple.getId() < 0) { return new EmptyIteration<>(); } else { return listJustificationsForTriple(triple.getId()); } }
/** * List all justifications supporting the given triple. * @param triple * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsForTriple(KiWiTriple triple) throws SQLException { if(triple.getId() < 0) { return new EmptyIteration<>(); } else { return listJustificationsForTriple(triple.getId()); } }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Extension extension, BindingSet bindings) throws QueryEvaluationException { CloseableIteration<BindingSet, QueryEvaluationException> result; try { result = this.evaluate(extension.getArg(), bindings); } catch (ValueExprEvaluationException e) { // a type error in an extension argument should be silently ignored // and // result in zero bindings. result = new EmptyIteration<BindingSet, QueryEvaluationException>(); } result = new ExtensionIterator(extension, result, this); return result; }
/** * List all versions in the database affecting the given resource as subject; operates directly on the result set, * i.e. the iteration is carried out lazily and needs to be closed when iteration is completed. * * @return * @throws SQLException */ private CloseableIteration<Version, SQLException> listVersionsInternal(KiWiResource r) throws SQLException { if(r.getId() < 0) { return new EmptyIteration<Version, SQLException>(); } else { requireJDBCConnection(); PreparedStatement queryVersions = getPreparedStatement("load.versions_by_resource"); queryVersions.setLong(1,r.getId()); final ResultSet result = queryVersions.executeQuery(); return new ResultSetIteration<Version>(result, new ResultTransformerFunction<Version>() { @Override public Version apply(ResultSet row) throws SQLException { return constructVersionFromDatabase(result); } }); } }
/** * List all justifications supported by the given triple. * @param triple * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsBySupporting(KiWiTriple triple) throws SQLException { if(triple.getId() < 0) { return new EmptyIteration<>(); } else { requireJDBCConnection(); PreparedStatement listByTriple = getPreparedStatement("justifications.load_by_striple"); synchronized (listByTriple) { listByTriple.setLong(1, triple.getId()); ResultSet result = listByTriple.executeQuery(); return new ResultSetIteration<>(result, new ResultTransformerFunction<Justification>() { @Override public Justification apply(ResultSet row) throws SQLException { return constructJustificationFromDatabase(row); } }); } } }
/** * List all justifications supported by the given rule. * * @param rule * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsBySupporting(Rule rule) throws SQLException { if(rule.getId() <= 0) { return new EmptyIteration<>(); } else { requireJDBCConnection(); PreparedStatement listByRule = getPreparedStatement("justifications.load_by_srule"); synchronized (listByRule) { listByRule.setLong(1, rule.getId()); ResultSet result = listByRule.executeQuery(); return new ResultSetIteration<>(result, new ResultTransformerFunction<Justification>() { @Override public Justification apply(ResultSet row) throws SQLException { return constructJustificationFromDatabase(row); } }); } } }
/** * List all justifications supported by the given triple. * @param triple * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsBySupporting(KiWiTriple triple) throws SQLException { if(triple.getId() < 0) { return new EmptyIteration<>(); } else { requireJDBCConnection(); PreparedStatement listByTriple = getPreparedStatement("justifications.load_by_striple"); synchronized (listByTriple) { listByTriple.setLong(1, triple.getId()); ResultSet result = listByTriple.executeQuery(); return new ResultSetIteration<>(result, new ResultTransformerFunction<Justification>() { @Override public Justification apply(ResultSet row) throws SQLException { return constructJustificationFromDatabase(row); } }); } } }
/** * List all justifications supported by the given rule. * * @param rule * @return * @throws SQLException */ public CloseableIteration<Justification,SQLException> listJustificationsBySupporting(Rule rule) throws SQLException { if(rule.getId() <= 0) { return new EmptyIteration<>(); } else { requireJDBCConnection(); PreparedStatement listByRule = getPreparedStatement("justifications.load_by_srule"); synchronized (listByRule) { listByRule.setLong(1, rule.getId()); ResultSet result = listByRule.executeQuery(); return new ResultSetIteration<>(result, new ResultTransformerFunction<Justification>() { @Override public Justification apply(ResultSet row) throws SQLException { return constructJustificationFromDatabase(row); } }); } } }
private CloseableIteration<BindingSet, QueryEvaluationException> createNextIteration(Value subject, Value object) throws QueryEvaluationException { if (subject == null && object == null) { return new EmptyIteration<BindingSet, QueryEvaluationException>(); } Var subjVar = new Var(VARNAME_SUBJECT, subject); Var predVar = new Var(VARNAME_PREDICATE); Var objVar = new Var(VARNAME_OBJECT, object); StatementPattern pattern = new StatementPattern(subjVar, predVar, objVar); return strategy.evaluate(pattern, parentBindings); }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(ZeroLengthPath zlp, final BindingSet bindings) throws QueryEvaluationException { final Var subjectVar = zlp.getSubjectVar(); final Var objVar = zlp.getObjectVar(); final Var contextVar = zlp.getContextVar(); Value subj = null; try { subj = evaluate(subjectVar, bindings); } catch (QueryEvaluationException e) { } Value obj = null; try { obj = evaluate(objVar, bindings); } catch (QueryEvaluationException e) { } if (subj != null && obj != null) { if (!subj.equals(obj)) { return new EmptyIteration<BindingSet, QueryEvaluationException>(); } } return getZeroLengthPathIterator(bindings, subjectVar, objVar, contextVar, subj, obj); }
protected <X extends Exception> CloseableIteration<Statement, X> newStatementIterator( final Resource subj, final URI pred, final Value obj, final Resource... contexts) throws SailException { try { return new CumulusRDFIterator<X>( _crdf.queryWithIDs( (contexts == null) || (contexts.length == 0) ? new byte[][]{id(subj),id(pred),id(obj)} : new byte[][]{id(subj),id(pred),id(obj), id(contexts[0])}), _sail); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); return new EmptyIteration<Statement, X>(); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); return new EmptyIteration<Statement, X>(); } }
protected <X extends Exception> CloseableIteration<Statement, X> newStatementIterator( final Resource subj, final URI pred, final Value obj, final Resource... contexts) throws SailException { try { return new CumulusRDFIterator<X>( _crdf.queryWithIDs( (contexts == null) || (contexts.length == 0) ? new byte[][]{id(subj),id(pred),id(obj)} : new byte[][]{id(subj),id(pred),id(obj), id(contexts[0])}), _sail); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); return new EmptyIteration<Statement, X>(); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); return new EmptyIteration<Statement, X>(); } }