We first extend our projection elements to include reverse attributes and attributes with implicit classes. The new BNF for projection elements is
<projection element> ::= <attribute name> '[' <class name> ']'
| '!' <attribute name> '[' <class name> ']'
| <attribute name>
;
Here the construct ! attr[ Class] represents a
reverse attribute. For example the variable declarations
Y IN FRAGMENT, X IN Y.!owns[PERSON], would be equivalent to
the declarations X IN PERSON, Y IN X.owns[FRAGMENT].
If the [ Class] is omitted from a projection element, then it is
equivalent to using the class of the attribute. For example if the owns
attribute of class PERSON has class FRAGMENT, then the
declaration X IN Y.owns is equivalent to
X IN Y.owns[FRAGMENT].
Next we allow variable declarations to involve series of attributes or reverse attributes rather than just single attributes. The extended syntax for variable declarations is
<variable declaration> ::= <variable> IN <class expression>
;
<class expression> ::= <class name>
| <variable> '.' <projection composition>
;
<projection composition> ::= <composition element list> <projection element>
;
<composition element list> ::= <null>
| <composition element> <composition element list>
;
<composition element> ::= <attribute name> '[' <class name> ']'
| '!' <attribute name> '[' <class name> ']'
| <attribute name> '.'
;
A variable declaration involving a projection composition is equivalent to
a series of variable declarations involving implicit or system
generated variables. For example the variable declaration
X IN Y.owns[FRAGMENT]sequence would be equivalent to
_1 IN Y.owns[FRAGMENT], X IN _1.sequence[VARCHAR(200)],
where _1 is a new variable.