While I wait for the link in the other post to be moderated... (If it doesn't show up, do a Google Search for "What the heck is SUBQUERY?" and read the Fun with Objective-C blog entry.)
"Should the property be allocated and initialized before the query is executed? How should it be populated?" I'm concerned that you're misunderstanding how the expression works.
A simple subquery looks like this:
SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42)
That's the subquery expression for: the values from collection that each (individually) match "property = 'foo' and number = 42".
That syntax exists because
ANY collection.property = 'foo' AND ANY collection.number = 42
can be satisfied by two different members of collection. In contrast
SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42).@count > 0
isn't true unless the same member of collection has 'foo' and 42 for its values.
Subquery takes three arguments:
1. An expression which evaluates to a collection of values
2. A variable name that you're going to use to refer to the indivual values of the expression in #1
3. A predicate containing the variable name from #2 which is going to be evaluated for each value in #1
and results in the collection of the values that passed the predicate.
If you have a to-many relationship on an object, that's a convenient value to use as an expression for argument #1. But you could just as well use the value of another subquery expression, or any of the other expressions that evaluate to collections.