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 versions in the database; 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, Date from, Date to) throws SQLException { requireJDBCConnection(); PreparedStatement queryVersions = getPreparedStatement("load.versions_by_resource_between"); synchronized (queryVersions) { queryVersions.clearParameters(); if(r.getId() < 0) { return new EmptyIteration<Version, SQLException>(); } else { queryVersions.setLong(1, r.getId()); queryVersions.setTimestamp(2, new Timestamp(from.getTime())); queryVersions.setTimestamp(3, new Timestamp(to.getTime())); final ResultSet result = queryVersions.executeQuery(); return new ResultSetIteration<Version>(result, new ResultTransformerFunction<Version>() { @Override public Version apply(ResultSet row) throws SQLException { return constructVersionFromDatabase(result); } }); } } }
/** * This method pairs each {@link BindingSet} in the specified collection * with the StatementPattern constraints and issues a query to Rya using the * {@link RyaQueryEngine}. */ @Override public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Collection<BindingSet> bindingset) throws QueryEvaluationException { if (bindingset.size() == 0) { return new EmptyIteration<>(); } queryEngine = RyaQueryEngineFactory.getQueryEngine(conf); Set<Map.Entry<RyaStatement, BindingSet>> statements = new HashSet<>(); Iterator<BindingSet> iter = bindingset.iterator(); while (iter.hasNext()) { BindingSet bs = iter.next(); statements.add(new RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, BindingSet>( getRyaStatementFromBindings(bs), bs)); } final CloseableIteration<? extends Entry<RyaStatement, BindingSet>, RyaDAOException> iteration; try { iteration = queryEngine.queryWithBindingSet(statements, conf); } catch (RyaDAOException e) { throw new RuntimeException(e); } return new PropertyFilterAndBindingSetJoinIteration(iteration, properties, statement); }
/** * 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; }
return new EmptyIteration<Statement, SQLException>(); return new EmptyIteration<Statement, SQLException>(); return new EmptyIteration<Statement, SQLException>(); return new EmptyIteration<Statement, SQLException>();
/** * 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); }