@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { // compute scoring if (qc.scoring) { double s = 0; boolean f = false; for (final Expr expr : exprs) { final Item it = expr.ebv(qc, info); f |= it.bool(ii); s += it.score(); } return Bln.get(f, Scoring.avg(s, exprs.length)); } // standard evaluation for (final Expr expr : exprs) { if (expr.ebv(qc, info).bool(ii)) return Bln.TRUE; } return Bln.FALSE; }
@Override public final Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return Bln.get(toMap(exprs[0], qc).contains(toAtomItem(exprs[1], qc), ii)); }
/** * Checks if the specified item is a boolean. Returns the boolean or throws an exception. * * @param it item be checked * @return boolean * @throws QueryException query exception */ protected final boolean toBoolean(final Item it) throws QueryException { final Type ip = checkNoEmpty(it, AtomType.BLN).type; if (ip == AtomType.BLN) return it.bool(info); if (ip.isUntyped()) return Bln.parse(it.string(info), info); throw castError(it, AtomType.BLN, info); }