Java Code Examples for org.eclipse.rdf4j.query.algebra.Slice#hasLimit()
The following examples show how to use
org.eclipse.rdf4j.query.algebra.Slice#hasLimit() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StrictEvaluationStrategy.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the limit of the current variable bindings before any further projection. */ protected long getLimit(QueryModelNode node) { long offset = 0; if (node instanceof Slice) { Slice slice = (Slice) node; if (slice.hasOffset() && slice.hasLimit()) { return slice.getOffset() + slice.getLimit(); } else if (slice.hasLimit()) { return slice.getLimit(); } else if (slice.hasOffset()) { offset = slice.getOffset(); } } QueryModelNode parent = node.getParentNode(); if (parent instanceof Distinct || parent instanceof Reduced || parent instanceof Slice) { long limit = getLimit(parent); if (offset > 0L && limit < Long.MAX_VALUE) { return offset + limit; } else { return limit; } } return Long.MAX_VALUE; }
Example 2
Source File: HalyardTupleExprEvaluation.java From Halyard with Apache License 2.0 | 6 votes |
/** * Evaluate {@link Slice} query model nodes. * @param parent * @param slice * @param bindings */ private void evaluateSlice(BindingSetPipe parent, Slice slice, BindingSet bindings) { final long offset = slice.hasOffset() ? slice.getOffset() : 0; final long limit = slice.hasLimit() ? offset + slice.getLimit() : Long.MAX_VALUE; evaluateTupleExpr(new BindingSetPipe(parent) { private final AtomicLong ll = new AtomicLong(0); @Override public boolean push(BindingSet bs) throws InterruptedException { long l = ll.incrementAndGet(); if (l > limit+1) { return false; } if (bs == null) return parent.push(null); if (l <= offset) { return true; } else if (l <= limit) { return parent.push(bs); } else { return parent.push(null); } } }, slice.getArg(), bindings); }
Example 3
Source File: HalyardTupleExprEvaluation.java From Halyard with Apache License 2.0 | 6 votes |
/** * Returns the limit of the current variable bindings before any further projection. */ private static long getLimit(QueryModelNode node) { long offset = 0; if (node instanceof Slice) { Slice slice = (Slice) node; if (slice.hasOffset() && slice.hasLimit()) { return slice.getOffset() + slice.getLimit(); } else if (slice.hasLimit()) { return slice.getLimit(); } else if (slice.hasOffset()) { offset = slice.getOffset(); } } QueryModelNode parent = node.getParentNode(); if (parent instanceof Distinct || parent instanceof Reduced || parent instanceof Slice) { long limit = getLimit(parent); if (offset > 0L && limit < Long.MAX_VALUE) { return offset + limit; } else { return limit; } } return Long.MAX_VALUE; }
Example 4
Source File: SpinRenderer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void meet(Slice node) throws RDFHandlerException { node.getArg().visit(this); if (node.hasLimit()) { handler.handleStatement(valueFactory.createStatement(subject, SP.LIMIT_PROPERTY, valueFactory.createLiteral(Long.toString(node.getLimit()), XMLSchema.INTEGER))); } if (node.hasOffset()) { handler.handleStatement(valueFactory.createStatement(subject, SP.OFFSET_PROPERTY, valueFactory.createLiteral(Long.toString(node.getOffset()), XMLSchema.INTEGER))); } }
Example 5
Source File: StrictEvaluationStrategy.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
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<>(result, slice.getOffset()); } if (slice.hasLimit()) { result = new LimitIteration<>(result, slice.getLimit()); } return result; }
Example 6
Source File: BaseTupleExprRenderer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @inheritDoc */ @Override public void meet(final Slice theSlice) throws Exception { if (theSlice.hasOffset()) { mOffset = theSlice.getOffset(); } if (theSlice.hasLimit()) { mLimit = theSlice.getLimit(); } theSlice.visitChildren(this); }
Example 7
Source File: ParallelEvaluationStrategyImpl.java From rya with Apache License 2.0 | 5 votes |
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; }