private void visit(Expression<?> expr, QueryMetadata context) { if (expr != null) { expr.accept(this, context); } }
private void handle(List<?> args) { for (Object arg : args) { if (arg instanceof Expression) { ((Expression) arg).accept(this, null); } } }
private void visit(List<Expression<?>> exprs, QueryMetadata context) { for (Expression<?> arg : exprs) { arg.accept(this, context); } }
private void handle(@Nullable Expression<?> e) { if (e != null) { e.accept(this, null); } }
private ImmutableList<Expression<?>> visit(List<Expression<?>> args) { ImmutableList.Builder<Expression<?>> builder = ImmutableList.builder(); for (Expression<?> arg : args) { builder.add(arg.accept(this, null)); } return builder.build(); } }
@Override public Set<Expression<?>> visit(TemplateExpression<?> expr, Set<Expression<?>> known) { for (Object arg : expr.getArgs()) { if (arg instanceof Expression<?>) { known = ((Expression<?>)arg).accept(this, known); } } return known; }
@Override public Set<Expression<?>> visit(FactoryExpression<?> expr, Set<Expression<?>> known) { for (Expression<?> arg : expr.getArgs()) { known = arg.accept(this, known); } return known; }
@Override public Set<RelationalPath<?>> visit(FactoryExpression<?> expr, Set<RelationalPath<?>> known) { for (Expression<?> arg : expr.getArgs()) { known = arg.accept(this, known); } return known; }
@Override public Void visit(TemplateExpression<?> expr, QueryMetadata context) { for (Object arg : expr.getArgs()) { if (arg instanceof Expression<?>) { ((Expression<?>)arg).accept(this, context); } } return null; }
public final S handle(Object arg) { if (arg instanceof Expression) { ((Expression)arg).accept(this, null); } else { visitConstant(arg); } return self; }
@Override public Set<RelationalPath<?>> visit(Operation<?> expr, Set<RelationalPath<?>> known) { for (Expression<?> arg : expr.getArgs()) { known = arg.accept(this, known); } return known; }
@Override public Set<RelationalPath<?>> visit(TemplateExpression<?> expr, Set<RelationalPath<?>> known) { for (Object arg : expr.getArgs()) { if (arg instanceof Expression<?>) { known = ((Expression<?>)arg).accept(this, known); } } return known; }
@Override public STMT apply(Bindings input) { return new STMT( (ID) expr.getSubject().accept(QueryRDFVisitor.this, input), (UID) expr.getPredicate().accept(QueryRDFVisitor.this, input), (NODE) expr.getObject().accept(QueryRDFVisitor.this, input), (UID) expr.getContext().accept(QueryRDFVisitor.this, input)); } };
@Override public boolean apply(Bindings bindings) { NODE lhs = (NODE) expr.getArg(0).accept(QueryRDFVisitor.this, bindings); NODE rhs = (NODE) expr.getArg(1).accept(QueryRDFVisitor.this, bindings); if (lhs != null && rhs != null) { return lhs.getValue().equalsIgnoreCase(rhs.getValue()); } else { return lhs == rhs; } } };
public DBObject toSort(List<OrderSpecifier<?>> orderBys) { BasicDBObject sort = new BasicDBObject(); for (OrderSpecifier<?> orderBy : orderBys) { Object key = orderBy.getTarget().accept(this, null); sort.append(key.toString(), orderBy.getOrder() == Order.ASC ? 1 : -1); } return sort; }
private Set<Path<?>> getRootPaths(Collection<Expression<?>> exprs) { Set<Path<?>> paths = Sets.newHashSet(); for (Expression<?> e : exprs) { Path<?> path = e.accept(PathExtractor.DEFAULT, null); if (path != null && !path.getMetadata().isRoot()) { paths.add(path.getMetadata().getRoot()); } } return paths; }
@Override public Set<Expression<?>> visit(Operation<?> expr, Set<Expression<?>> known) { if (expr.getOperator() == Ops.ALIAS) { known = add(known, expr.getArg(1)); } for (Expression<?> arg : expr.getArgs()) { known = arg.accept(this, known); } return known; }
private Set<RelationalPath<?>> visitJoins(Iterable<JoinExpression> joins, Set<RelationalPath<?>> known) { for (JoinExpression j : joins) { known = j.getTarget().accept(this, known); if (j.getCondition() != null) { known = j.getCondition().accept(this, known); } } return known; }