/** * @param inputBindings * @throws QueryEvaluationException */ public BatchingServiceIteration( CloseableIteration<BindingSet, QueryEvaluationException> inputBindings, int blockSize, Service service) throws QueryEvaluationException { super(inputBindings, null, EmptyBindingSet.getInstance()); this.blockSize = blockSize; this.service = service; run(); }
protected CloseableIteration<BindingSet, QueryEvaluationException> evaluateInternal(EvaluationStrategy strategy, TupleExpr tupleExpr) { return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance()); }
/** * @param inputBindings * @throws QueryEvaluationException */ public BatchingServiceIteration( CloseableIteration<BindingSet, QueryEvaluationException> inputBindings, int blockSize, Service service) throws QueryEvaluationException { super(inputBindings, null, EmptyBindingSet.getInstance()); this.blockSize = blockSize; this.service = service; run(); }
/** * @param inputBindings * @throws QueryEvaluationException */ public BatchingServiceIteration( CloseableIteration<BindingSet, QueryEvaluationException> inputBindings, int blockSize, Service service) throws QueryEvaluationException { super(inputBindings, null, EmptyBindingSet.getInstance()); this.blockSize = blockSize; this.service = service; run(); }
public UpdateContext(UpdateExpr updateExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) { assert updateExpr != null; this.updateExpr = updateExpr; if (dataset == null) { this.dataset = new SimpleDataset(); } else { this.dataset = dataset; } if (bindings == null) { this.bindings = EmptyBindingSet.getInstance(); } else { this.bindings = bindings; } this.includeInferred = includeInferred; }
public UpdateContext(UpdateExpr updateExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) { assert updateExpr != null; this.updateExpr = updateExpr; if (dataset == null) { this.dataset = new SimpleDataset(); } else { this.dataset = dataset; } if (bindings == null) { this.bindings = EmptyBindingSet.getInstance(); } else { this.bindings = bindings; } this.includeInferred = includeInferred; }
@Override protected void meetUnaryValueOperator(UnaryValueOperator unaryValueOp) { super.meetUnaryValueOperator(unaryValueOp); if (isConstant(unaryValueOp.getArg())) { try { Value value = strategy.evaluate(unaryValueOp, EmptyBindingSet.getInstance()); unaryValueOp.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { // TODO: incompatible values types(?), remove the affected part // of the query tree logger.debug("Failed to evaluate UnaryValueOperator with a constant argument", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
@Override protected void meetUnaryValueOperator(UnaryValueOperator unaryValueOp) { super.meetUnaryValueOperator(unaryValueOp); if (isConstant(unaryValueOp.getArg())) { try { Value value = strategy.evaluate(unaryValueOp, EmptyBindingSet.getInstance()); unaryValueOp.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { // TODO: incompatible values types(?), remove the affected part // of the query tree logger.debug("Failed to evaluate UnaryValueOperator with a constant argument", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
Value value = strategy.evaluate(functionCall, EmptyBindingSet.getInstance()); functionCall.replaceWith(new ValueConstant(value));
Value value = strategy.evaluate(functionCall, EmptyBindingSet.getInstance()); functionCall.replaceWith(new ValueConstant(value));
@Override protected void meetBinaryValueOperator(BinaryValueOperator binaryValueOp) { super.meetBinaryValueOperator(binaryValueOp); if (isConstant(binaryValueOp.getLeftArg()) && isConstant(binaryValueOp.getRightArg())) { try { Value value = strategy.evaluate(binaryValueOp, EmptyBindingSet.getInstance()); binaryValueOp.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { // TODO: incompatible values types(?), remove the affected part // of the query tree logger.debug("Failed to evaluate BinaryValueOperator with two constant arguments", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
@Override protected void meetBinaryValueOperator(BinaryValueOperator binaryValueOp) { super.meetBinaryValueOperator(binaryValueOp); if (isConstant(binaryValueOp.getLeftArg()) && isConstant(binaryValueOp.getRightArg())) { try { Value value = strategy.evaluate(binaryValueOp, EmptyBindingSet.getInstance()); binaryValueOp.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { // TODO: incompatible values types(?), remove the affected part // of the query tree logger.debug("Failed to evaluate BinaryValueOperator with two constant arguments", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
@Override public void meet(If node) { super.meet(node); if (isConstant(node.getCondition())) { try { if (strategy.isTrue(node.getCondition(), EmptyBindingSet.getInstance())) { node.replaceWith(node.getResult()); } else { node.replaceWith(node.getAlternative()); } } catch (ValueExprEvaluationException e) { logger.debug("Failed to evaluate UnaryValueOperator with a constant argument", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
@Override public void meet(If node) { super.meet(node); if (isConstant(node.getCondition())) { try { if (strategy.isTrue(node.getCondition(), EmptyBindingSet.getInstance())) { node.replaceWith(node.getResult()); } else { node.replaceWith(node.getAlternative()); } } catch (ValueExprEvaluationException e) { logger.debug("Failed to evaluate UnaryValueOperator with a constant argument", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
/** * Override meetBinaryValueOperator */ @Override public void meet(Regex node) { super.meetNode(node); if (isConstant(node.getArg()) && isConstant(node.getPatternArg()) && isConstant(node.getFlagsArg())) { try { Value value = strategy.evaluate(node, EmptyBindingSet.getInstance()); node.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { logger.debug("Failed to evaluate BinaryValueOperator with two constant arguments", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
/** * Override meetBinaryValueOperator */ @Override public void meet(Regex node) { super.meetNode(node); if (isConstant(node.getArg()) && isConstant(node.getPatternArg()) && isConstant(node.getFlagsArg())) { try { Value value = strategy.evaluate(node, EmptyBindingSet.getInstance()); node.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { logger.debug("Failed to evaluate BinaryValueOperator with two constant arguments", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
private void evaluateIntoStatements(ParsedGraphQuery query, Collection<Statement> statements) throws SailException, RDFHandlerException, QueryEvaluationException { CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = getWrappedConnection().evaluate( query.getTupleExpr(), null, EmptyBindingSet.getInstance(), true); try { ValueFactory vf = getValueFactory(); while (bindingsIter.hasNext()) { BindingSet bindings = bindingsIter.next(); Value subj = bindings.getValue("subject"); Value pred = bindings.getValue("predicate"); Value obj = bindings.getValue("object"); if (subj instanceof Resource && pred instanceof IRI && obj != null) { statements.add(vf.createStatement((Resource)subj, (IRI)pred, obj)); } } } finally { bindingsIter.close(); } } } // end inner class DirectTypeHierarchyInferencerConnection
private void evaluateIntoStatements(ParsedGraphQuery query, Collection<Statement> statements) throws SailException, RDFHandlerException, QueryEvaluationException { CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = getWrappedConnection().evaluate( query.getTupleExpr(), null, EmptyBindingSet.getInstance(), true); try { ValueFactory factory = getValueFactory(); while (bindingsIter.hasNext()) { BindingSet bindings = bindingsIter.next(); Value subj = bindings.getValue("subject"); Value pred = bindings.getValue("predicate"); Value obj = bindings.getValue("object"); if (subj instanceof Resource && pred instanceof IRI && obj != null) { statements.add(factory.createStatement((Resource)subj, (IRI)pred, obj)); } } } finally { bindingsIter.close(); } } }
boolean value = strategy.isTrue(or, EmptyBindingSet.getInstance()); or.replaceWith(new ValueConstant(BooleanLiteral.valueOf(value))); boolean leftIsTrue = strategy.isTrue(or.getLeftArg(), EmptyBindingSet.getInstance()); if (leftIsTrue) { or.replaceWith(new ValueConstant(BooleanLiteral.TRUE)); boolean rightIsTrue = strategy.isTrue(or.getRightArg(), EmptyBindingSet.getInstance()); if (rightIsTrue) { or.replaceWith(new ValueConstant(BooleanLiteral.TRUE));
boolean value = strategy.isTrue(and, EmptyBindingSet.getInstance()); and.replaceWith(new ValueConstant(BooleanLiteral.valueOf(value))); boolean leftIsTrue = strategy.isTrue(and.getLeftArg(), EmptyBindingSet.getInstance()); if (leftIsTrue) { and.replaceWith(and.getRightArg()); boolean rightIsTrue = strategy.isTrue(and.getRightArg(), EmptyBindingSet.getInstance()); if (rightIsTrue) { and.replaceWith(and.getLeftArg());