suppose I have a simple Ecore as bellow:
---- (0..3) (0..*) ---------
| A | ---------------------- | B | // AB is association name
---- AB |-------- |
|age:EInt |
---------
I would like to write a query that its output is as below:
---- (0..3) (0..*) ---------
| A | ---------------------- | B' | // AB' is association name
---- AB' |-------- | // B' is subset of B where age > 20
|age:EInt | // and AB' is subset of AB
---------
I can write a query to get B' like B'=B->select(b:B | B.age>20)
I would like to write a query in OCL to get AB'. Semi-formal definition of AB' would be: AB'= all AB which its B side is restricted to B'
, in other words AB' is the same association as AB, but its target(co-domain) is restricted to B'.
I looked at OCL reference, but it seems that it is intended to work on Classes (like A and B here) rather than associations (like AB) in terms of query results. Am I right?
Any suggestion is appreciated.
Thanks