/** * Returns a {@link TupleQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link TupleQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static TupleQueryResult limitResults(TupleQueryResult queryResult, long limit, long offset) { CloseableIteration<BindingSet, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof TupleQueryResult)) { return new IteratingTupleQueryResult(queryResult.getBindingNames(), iter); } return (TupleQueryResult)iter; }
/** * Returns a {@link GraphQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link GraphQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static GraphQueryResult limitResults(GraphQueryResult queryResult, long limit, long offset) { CloseableIteration<Statement, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof GraphQueryResult)) { return new IteratingGraphQueryResult(queryResult.getNamespaces(), iter); } return (GraphQueryResult)iter; }
/** * Returns a {@link GraphQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link GraphQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static GraphQueryResult limitResults(GraphQueryResult queryResult, long limit, long offset) { CloseableIteration<Statement, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof GraphQueryResult)) { return new IteratingGraphQueryResult(queryResult.getNamespaces(), iter); } return (GraphQueryResult)iter; }
/** * Returns a {@link TupleQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link TupleQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static TupleQueryResult limitResults(TupleQueryResult queryResult, long limit, long offset) { CloseableIteration<BindingSet, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof TupleQueryResult)) { return new IteratingTupleQueryResult(queryResult.getBindingNames(), iter); } return (TupleQueryResult)iter; }
/** * Returns a {@link TupleQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link TupleQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static TupleQueryResult limitResults(TupleQueryResult queryResult, long limit, long offset) { CloseableIteration<BindingSet, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof TupleQueryResult)) { return new IteratingTupleQueryResult(queryResult.getBindingNames(), iter); } return (TupleQueryResult)iter; }
/** * Returns a {@link GraphQueryResult} that returns at most the specified maximum number of solutions, * starting at the supplied offset. * * @param queryResult * a query result possibly containing more solutions than the specified maximum. * @param limit * the maximum number of solutions to return. If set to 0 or lower, no limit will be applied. * @param offset * the number of solutions to skip at the beginning. If set to 0 or lower, no offset will be * applied. * @return A {@link GraphQueryResult} that will at return at most the specified maximum number of * solutions. If neither {@code limit} nor {@code offset} are applied, this returns the original * {@code queryResult}. */ public static GraphQueryResult limitResults(GraphQueryResult queryResult, long limit, long offset) { CloseableIteration<Statement, QueryEvaluationException> iter = queryResult; if (offset > 0) { iter = new OffsetIteration<>(iter, offset); } if (limit > 0) { iter = new LimitIteration<>(iter, limit); } if (!(iter instanceof GraphQueryResult)) { return new IteratingGraphQueryResult(queryResult.getNamespaces(), iter); } return (GraphQueryResult)iter; }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Slice slice, BindingSet bindings) throws QueryEvaluationException { CloseableIteration<BindingSet, QueryEvaluationException> result = evaluate(slice.getArg(), bindings); if (slice.hasOffset()) { result = new OffsetIteration<BindingSet, QueryEvaluationException>(result, slice.getOffset()); } if (slice.hasLimit()) { result = new LimitIteration<BindingSet, QueryEvaluationException>(result, slice.getLimit()); } return result; }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Slice slice, BindingSet bindings) throws QueryEvaluationException { CloseableIteration<BindingSet, QueryEvaluationException> result = evaluate(slice.getArg(), bindings); if (slice.hasOffset()) { result = new OffsetIteration<BindingSet, QueryEvaluationException>(result, slice.getOffset()); } if (slice.hasLimit()) { result = new LimitIteration<BindingSet, QueryEvaluationException>(result, slice.getLimit()); } return result; }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Slice slice, BindingSet bindings) throws QueryEvaluationException { CloseableIteration<BindingSet, QueryEvaluationException> result = evaluate(slice.getArg(), bindings); if (slice.hasOffset()) { result = new OffsetIteration<BindingSet, QueryEvaluationException>(result, slice.getOffset()); } if (slice.hasLimit()) { result = new LimitIteration<BindingSet, QueryEvaluationException>(result, slice.getLimit()); } return result; }