public static Expression fromNode(Node node) {
        if (node.asObjectNode().isPresent()) {
            ObjectNode on = node.asObjectNode().get();
            Optional<Node> ref = on.getMember("ref");
            Optional<Node> fn = on.getMember("fn");
            if ((ref.isPresent() ? 1 : 0) + (fn.isPresent() ? 1 : 0) != 1) {
                throw new SourceException("expected exactly one of `ref` or `fn` to be set, found "
                        + Node.printJson(node), node);
            }
            if (ref.isPresent()) {
                return getReference(Identifier.of(ref.get().expectStringNode("ref must be a string")), ref.get());
            }
            return context("while parsing fn", node, () -> FunctionNode.fromNode(on).createFunction());
        } else {
            return Literal.fromNode(node);
        }
    }
Constructs an expression from the provided {@link Node}.

@param node the node to construct the expression from.
@return the expression.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/expressions/Expression.java