Enumerating distinct property values

The thing you're looking for is the WITH clause, which is like a RETURN but lets you continue operating on the results. This is where you would use aggregations, DISTINCT, additional filtering, and other stuff, and it also defines which variables remain in scope for later in the query: any variables you do not include in the WITH clause are dropped out of scope.