public String visit()

in asterix-graphix/src/main/java/org/apache/asterix/graphix/lang/rewrite/print/SqlppASTPrintQueryVisitor.java [201:254]


    public String visit(FromClause fromClause, Void arg) {
        final Function<AbstractClause, String> abstractClauseFormatter = c -> {
            if (c.getClauseType() == Clause.ClauseType.LET_CLAUSE) {
                return " LET " + visitAndSwallowException(c);

            } else if (c.getClauseType() == Clause.ClauseType.WHERE_CLAUSE) {
                return " WHERE " + visitAndSwallowException(c);
            }
            return visitAndSwallowException(c);
        };
        final Function<LowerSwitchClause, String> fixedPointClauseFormatter = c -> {
            LowerSwitchClause.ClauseOutputEnvironment outputEnvironment = c.getClauseOutputEnvironment();
            String outputString =
                    String.format("`%s` = { \"vertex-iteration\": `%s`, \"vertex-join\": `%s`, \"path\": `%s` }",
                            formatIdentifierForQuery(outputEnvironment.getOutputVariable().getVar()),
                            formatIdentifierForQuery(outputEnvironment.getOutputVertexIterationVariable().getVar()),
                            formatIdentifierForQuery(outputEnvironment.getOutputVertexJoinVariable().getVar()),
                            formatIdentifierForQuery(outputEnvironment.getPathVariable().getVar()));
            Iterator<Pair<ElementLabel, List<CollectionTable.Entry>>> entryIterator =
                    c.getCollectionLookupTable().entryIterator();
            List<String> collectionKeyValuePairStrings = new ArrayList<>();
            while (entryIterator.hasNext()) {
                Pair<ElementLabel, List<CollectionTable.Entry>> mapEntry = entryIterator.next();
                for (CollectionTable.Entry entry : mapEntry.second) {
                    collectionKeyValuePairStrings
                            .add(String.format("\"%s TO %s [ %s ] TO %s\":  [ %s ] ", mapEntry.getFirst(),
                                    entry.getEdgeLabel(), entry.getEdgeDirection(), entry.getDestinationLabel(),
                                    StreamSupport.stream(entry.getClauseCollection().spliterator(), false)
                                            .map(abstractClauseFormatter).collect(Collectors.joining(", "))));
                }
            }
            ElementLabel startingLabel = c.getClauseInputEnvironment().getStartingLabel();
            return String.format("%s = { \"StartLabel\": %s, %s }", outputString, startingLabel,
                    String.join(",", collectionKeyValuePairStrings));
        };

        if (fromClause instanceof FromGraphClause) {
            FromGraphClause fromGraphClause = (FromGraphClause) fromClause;
            LowerListClause lowerClause = (LowerListClause) fromGraphClause.getLowerClause();
            Spliterator<AbstractClause> clauseCollectionIterator = lowerClause.getClauseCollection().spliterator();
            return String.format(" FROM %s ", StreamSupport.stream(clauseCollectionIterator, false).map(c -> {
                if (c instanceof LowerSwitchClause) {
                    return " FIXED-POINT " + fixedPointClauseFormatter.apply((LowerSwitchClause) c);

                } else {
                    return abstractClauseFormatter.apply(c);
                }
            }).collect(Collectors.joining(", ")));

        } else {
            return String.format(" FROM %s ", fromClause.getFromTerms().stream().map(this::visitAndSwallowException)
                    .collect(Collectors.joining(", ")));
        }
    }