@Override public NodeValue eval(NodeValue x, NodeValue y) { if ( ARQ.isStrictMode() ) return XSDFuncOp.numAdd(x, y) ; return NodeValueOps.additionNV(x, y) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { if ( ARQ.isStrictMode() ) return XSDFuncOp.numDivide(x, y) ; return NodeValueOps.divisionNV(x, y) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { if ( ARQ.isStrictMode() ) return XSDFuncOp.numSubtract(x, y) ; return NodeValueOps.subtractionNV(x, y) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { if ( ARQ.isStrictMode() ) return XSDFuncOp.numMultiply(x, y) ; return NodeValueOps.multiplicationNV(x, y) ; }
private static void check(Collection<Var> scope, ElementService el) { if ( ARQ.isStrictMode() && el.getServiceNode().isVariable() ) { Var var = Var.alloc(el.getServiceNode()) ; if ( ! scope.contains(var) ) throw new QueryParseException("SERVICE: Variable not already in-scope: "+var+" in "+el, -1 , -1) ; } } }
private void init(Expr pattern, Expr flags) { if ( ! ARQ.isStrictMode() ) { try { if ( pattern.isConstant() && pattern.getConstant().isString() && ( flags==null || flags.isConstant() ) ) regexEngine = makeRegexEngine(pattern.getConstant(), (flags==null)?null:flags.getConstant()) ; } catch (ExprEvalException ex) { // Here, we are doing static compilation of the pattern. // ExprEvalException does not have a stacktrace. // We could throw a non-eval exception. throw ex; //new ExprException(ex.getMessage(), ex.getCause()); } } }
private static Pair<Var, NodeValue> preprocess(Expr e) { if (!(e instanceof E_NotEquals)) return null; ExprFunction2 eq = (ExprFunction2) e; Expr left = eq.getArg1(); Expr right = eq.getArg2(); Var var = null; NodeValue constant = null; if (left.isVariable() && right.isConstant()) { var = left.asVar(); constant = right.getConstant(); } else if (right.isVariable() && left.isConstant()) { var = right.asVar(); constant = left.getConstant(); } if (var == null || constant == null) return null; // Final check for "!=" where a FILTER != can do value matching when the // graph does not. // Value based? if (!ARQ.isStrictMode() && constant.isLiteral()) return null; return Pair.create(var, constant); }
if (!ARQ.isStrictMode() && constant.isString()) return null;