Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E641

For the complete documentation index optimized for AI agents, see llms.txt.

Closure Position Restriction

Erroneous Code Example

This error occurs when you place a closure operation in a position other than the last step of a traversal.

In this example, the closure is not at the end of the traversal.

Query getUser(userId: ID) =>
    user <- N<User>(userId)
    RETURN user::|u|{
                userID: u::ID
            }::Out<Knows>

Solution

Place closure operations only at the end of traversals.

Query getUser(userId: ID) =>
    user <- N<User>(userId)
    out_users <- user::Out<Knows>
    RETURN out_users, user::|u|{
                            userID: u::ID
                        }::Out<Knows>