@Override public CloseableIteration<? extends List<? extends Value>, QueryEvaluationException> evaluate( final ValueFactory valueFactory, final Value... args) throws QueryEvaluationException { return new SingletonIteration<List<? extends Value>, QueryEvaluationException>( Collections.singletonList(valueFactory.createLiteral(args.length))); } }
@Override public E next() throws X { E result = value.getAndSet(null); if (result == null) { close(); throw new NoSuchElementException(); } return result; }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(EmptySet emptySet, BindingSet bindings) throws QueryEvaluationException { return new EmptyIteration<BindingSet, QueryEvaluationException>(); }
@Override public E next() throws X { E result = value.getAndSet(null); if (result == null) { close(); throw new NoSuchElementException(); } return result; }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(EmptySet emptySet, BindingSet bindings) throws QueryEvaluationException { return new EmptyIteration<BindingSet, QueryEvaluationException>(); }
@Override public E next() throws X { E result = value.getAndSet(null); if (result == null) { close(); throw new NoSuchElementException(); } return result; }
@Override public CloseableIteration<? extends List<? extends Value>, QueryEvaluationException> evaluate( ValueFactory valueFactory, Value... args) throws QueryEvaluationException { Literal result = new Concat().evaluate(valueFactory, args); return new SingletonIteration<List<? extends Value>, QueryEvaluationException>( Collections.singletonList(result)); } }
@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); } }
@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); } }
@Override public boolean ask(Service service, BindingSet bindings, String baseUri) throws QueryEvaluationException { try (final CloseableIteration<BindingSet, QueryEvaluationException> iter = evaluate(service, new SingletonIteration<BindingSet, QueryEvaluationException>(bindings), baseUri);) { while (iter.hasNext()) { BindingSet bs = iter.next(); String firstVar = service.getBindingNames().iterator().next(); return QueryEvaluationUtil.getEffectiveBooleanValue(bs.getValue(firstVar)); } } return false; }
@Override public boolean ask(Service service, BindingSet bindings, String baseUri) throws QueryEvaluationException { try (final CloseableIteration<BindingSet, QueryEvaluationException> iter = evaluate(service, new SingletonIteration<BindingSet, QueryEvaluationException>(bindings), baseUri);) { while (iter.hasNext()) { BindingSet bs = iter.next(); String firstVar = service.getBindingNames().iterator().next(); return QueryEvaluationUtil.getEffectiveBooleanValue(bs.getValue(firstVar)); } } return false; }
eval = evaluate(service, new SingletonIteration<BindingSet, QueryEvaluationException>(bindings), baseUri); iter = service.isSilent() ? new SilentIteration(eval) : eval;
eval = evaluate(service, new SingletonIteration<BindingSet, QueryEvaluationException>(bindings), baseUri); iter = service.isSilent() ? new SilentIteration(eval) : eval;
private RepositoryResult<Statement> getStatementsSingleTriple(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { if (hasStatement(subj, pred, obj, includeInferred, contexts)) { Statement st = getValueFactory().createStatement(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } }
private RepositoryResult<Statement> getStatementsSingleTriple(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { if (hasStatement(subj, pred, obj, includeInferred, contexts)) { Statement st = getValueFactory().createStatement(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<>(st); return new RepositoryResult<>(cursor); } else { return new RepositoryResult<>(new EmptyIteration<>()); } }
private RepositoryResult<Statement> getStatementsSingleTriple(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { if (hasStatement(subj, pred, obj, includeInferred, contexts)) { Statement st = getValueFactory().createStatement(subj, pred, obj); CloseableIteration<Statement, RepositoryException> cursor; cursor = new SingletonIteration<Statement, RepositoryException>(st); return new RepositoryResult<Statement>(cursor); } else { return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); } }
addBindings(queryOp, arguments, args); Value result = BooleanLiteral.valueOf(queryOp.evaluate()); iter = new SingletonIteration<List<Value>, QueryEvaluationException>( Collections.singletonList(result));
return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings); else return new EmptyIteration<BindingSet, QueryEvaluationException>(); return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings); return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings);
return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings); else return new EmptyIteration<BindingSet, QueryEvaluationException>(); return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings); return new SingletonIteration<BindingSet, QueryEvaluationException>(bindings);
addBindings(queryOp, args); Value result = BooleanLiteral.valueOf(queryOp.evaluate()); return new SingletonIteration<List<Value>, QueryEvaluationException>( Collections.singletonList(result));