/** * Checks whether the filter node's value expression node is in CNF. */ static public boolean isCNF(final FilterNode filter) { return isCNF(filter.getValueExpressionNode()); }
/** * Checks whether the filter node's value expression node is in CNF. */ static public boolean isCNF(final FilterNode filter) { return isCNF(filter.getValueExpressionNode()); }
/** * Checks whether the given filter node is trivially satisfied * * @param filterNode * @param definiteVars * @param maybeVars * @return */ boolean filterAlwaysSatisifed(FilterNode filterNode, Set<IVariable<?>> definiteVars, Set<IVariable<?>> maybeVars) { boolean alwaysSatisifed = false; alwaysSatisifed |= boundAlwaysSatisifed(filterNode.getValueExpressionNode(),definiteVars); alwaysSatisifed |= notBoundAlwaysSatisifed(filterNode.getValueExpressionNode(),maybeVars); // note: you may add further special cases here in future ... return alwaysSatisifed; }
/** * Checks whether the given filter node is trivially satisfied * * @param filterNode * @param definiteVars * @param maybeVars * @return */ boolean filterAlwaysSatisifed(FilterNode filterNode, Set<IVariable<?>> definiteVars, Set<IVariable<?>> maybeVars) { boolean alwaysSatisifed = false; alwaysSatisifed |= boundAlwaysSatisifed(filterNode.getValueExpressionNode(),definiteVars); alwaysSatisifed |= notBoundAlwaysSatisifed(filterNode.getValueExpressionNode(),maybeVars); // note: you may add further special cases here in future ... return alwaysSatisifed; }
@Override public String toString(final int indent) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(indent(indent)); sb.append("FILTER( ").append(getValueExpressionNode().toString(indent+1)).append(" )"); // if (getQueryHints() != null) { // sb.append("\n"); // sb.append(indent(indent)); // sb.append(Annotations.QUERY_HINTS); // sb.append("="); // sb.append(getQueryHints().toString()); // } return sb.toString(); }
@Override public String toString(final int indent) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(indent(indent)); sb.append("FILTER( ").append(getValueExpressionNode().toString(indent+1)).append(" )"); // if (getQueryHints() != null) { // sb.append("\n"); // sb.append(indent(indent)); // sb.append(Annotations.QUERY_HINTS); // sb.append("="); // sb.append(getQueryHints().toString()); // } return sb.toString(); }
@Override public void handle(final AST2BOpContext context, final QueryRoot queryRoot, final QueryHintScope scope, final ASTBase op, final Boolean value) { if (op instanceof FilterNode) { final IValueExpressionNode n = ((FilterNode) op) .getValueExpressionNode(); assert(n != null); @SuppressWarnings("rawtypes") final IValueExpression n2 = n.getValueExpression(); if (n2 != null && n2 instanceof RegexBOp) { ((RegexBOp)n2).setMatchNonString(value); } } }
@Override public void handle(final AST2BOpContext context, final QueryRoot queryRoot, final QueryHintScope scope, final ASTBase op, final Boolean value) { if (op instanceof FilterNode) { final IValueExpressionNode n = ((FilterNode) op) .getValueExpressionNode(); assert(n != null); @SuppressWarnings("rawtypes") final IValueExpression n2 = n.getValueExpression(); if (n2 != null && n2 instanceof RegexBOp) { ((RegexBOp)n2).setMatchNonString(value); } } }
@SuppressWarnings("rawtypes") public IValueExpression<? extends IV> getValueExpression() { final IValueExpression<? extends IV> ve = getValueExpressionNode() .getValueExpression(); if(ve instanceof IVariable<?>) { /* * Wrap a bare variable in an EBV operator. This is necessary in * order for it to properly self-report its materialization * requirements. It is also necessary in order for the * materialization pipeline to notice that a TermId can not be * interpreted as a boolean (there is no problem "getting" the * TermId from the variable, but its EBV is undefined until the RDF * Value is materialized for that TermId). */ return new EBVBOp(ve); } return ve; }
@SuppressWarnings("rawtypes") public IValueExpression<? extends IV> getValueExpression() { final IValueExpression<? extends IV> ve = getValueExpressionNode() .getValueExpression(); if(ve instanceof IVariable<?>) { /* * Wrap a bare variable in an EBV operator. This is necessary in * order for it to properly self-report its materialization * requirements. It is also necessary in order for the * materialization pipeline to notice that a TermId can not be * interpreted as a boolean (there is no problem "getting" the * TermId from the variable, but its EBV is undefined until the RDF * Value is materialized for that TermId). */ return new EBVBOp(ve); } return ve; }
IValueExpressionNode inner = filter.getValueExpressionNode();
final IValueExpressionNode vexpr = filter.getValueExpressionNode(); applyToValueExpressionNode(val, vexpr);
/** * Optimize a single FilterNode. We want to replace a search in search * function node with an In function node. */ protected void optimize(final AST2BOpContext ctx, final StaticAnalysis sa, final JoinGroupNode group, final FilterNode filterNode) { final IValueExpressionNode veNode = filterNode.getValueExpressionNode(); if (veNode instanceof FunctionNode) { final FunctionNode funcNode = (FunctionNode) veNode; if (funcNode.getFunctionURI().equals(BDS.SEARCH_IN_SEARCH)) { filterNode.setArg(0, convert(ctx, funcNode)); } } }
final IValueExpressionNode vexpr = filter.getValueExpressionNode(); applyToValueExpressionNode(val, vexpr);
/** * Optimize a single FilterNode. We want to replace a search in search * function node with an In function node. */ protected void optimize(final AST2BOpContext ctx, final StaticAnalysis sa, final JoinGroupNode group, final FilterNode filterNode) { final IValueExpressionNode veNode = filterNode.getValueExpressionNode(); if (veNode instanceof FunctionNode) { final FunctionNode funcNode = (FunctionNode) veNode; if (funcNode.getFunctionURI().equals(BDS.SEARCH_IN_SEARCH)) { filterNode.setArg(0, convert(ctx, funcNode)); } } }
new GlobalAnnotations( context.getLexiconNamespace(), context.getTimestamp()); AST2BOpUtility.toVE(getBOpContext(), globals, fn.getValueExpressionNode());
new GlobalAnnotations( context.getLexiconNamespace(), context.getTimestamp()); AST2BOpUtility.toVE(getBOpContext(), globals, fn.getValueExpressionNode());
new GlobalAnnotations( context.getLexiconNamespace(), context.getTimestamp()); AST2BOpUtility.toVE(getBOpContext(), globals, fn.getValueExpressionNode());