@Override public GraphQueryResult evaluate() throws QueryEvaluationException { if (hasStarted) throw new QueryEvaluationException("A materialization GraphQuery can only be evaluated once"); hasStarted = true; return new IteratingGraphQueryResult(ImmutableMap.of(), new GraphMaterializationIteration(graphResultSet)); }
result = new IteratingGraphQueryResult(getParsedQuery().getQueryNamespaces(), stIter); allGood = true; return result; try { if (result != null) { result.close();
result = new IteratingGraphQueryResult(getParsedQuery().getQueryNamespaces(), stIter); allGood = true; return result; try { if (result != null) { result.close();
result = new IteratingGraphQueryResult(getParsedQuery().getQueryNamespaces(), stIter); allGood = true; return result; try { if (result != null) { result.close();
@Override public GraphQueryResult evaluate() throws QueryEvaluationException { if (hasStarted) throw new QueryEvaluationException("A materialization GraphQuery can only be evaluated once"); hasStarted = true; return new IteratingGraphQueryResult(ImmutableMap.of(), new GraphMaterializationIteration(graphResultSet)); }
result = new IteratingGraphQueryResult(getParsedQuery().getQueryNamespaces(), stIter); allGood = true; return result; try { if (result != null) { result.close();
/** * Evaluates the query and returns a GraphQueryResult. */ public GraphQueryResult evaluate() throws QueryEvaluationException { try { // TODO: make this efficient for large result sets StatementCollector collector = new StatementCollector(); evaluate(collector); return new IteratingGraphQueryResult(collector.getNamespaces(), collector.getStatements()); } catch (RDFHandlerException e) { // Found a bug in StatementCollector? throw new RuntimeException(e); } }
result = new IteratingGraphQueryResult(getParsedQuery().getQueryNamespaces(), stIter); allGood = true; return result; try { if (result != null) { result.close();
/** * 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 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; }