@Override
    public Set<RelationalPath<?>> visit(Path<?> expr, Set<RelationalPath<?>> known) {
        if (expr.getMetadata().isRoot()) {
            if (expr instanceof RelationalPath) {
                known = add(known, (RelationalPath<?>) expr);
            }
        } else {
            known = expr.getMetadata().getParent().accept(this, known);
        }
        return known;
    }
{@code RelationalPathExtractor} extracts {@link RelationalPath} instances from expressions and queries

@author tiwe
querydsl-sql/src/main/java/com/querydsl/sql/RelationalPathExtractor.java