| Parsing problem. [message #31769] |
Tue, 03 July 2007 09:30  |
Juan Pedro Silva Messages: 247 Registered: July 2009 |
Senior Member |
|
|
Hi all, I am working on some rules for a UML profile (constraints on
stereotypes), and can't seem to get this one right.
Let me explain the situation. The desired rule would be (in text):
"A component with this stereotype cannot use interfaces directly".
Ok, so, now in OCL. I will try to write it not so concise so that it can
be easily understood. Part A, B, and C are not in the code, I'm placing
them here so I can refer to each one independently. Context= the
stereotype applied to Component:
(Part A)
let d: Set(Dependency) = self.base_Component.clientDependency->select(e
| e.oclIsKindOf(Usage))
(Part B)
in let j: Set(Dependency) = d->select(supplier.oclIsKindOf(Interface))
(Part C)
in j->isEmpty()
That is one way of writing it, isn't it?, at least I thought it was.
However, I get a "Error... Iteration expression body must be a boolean
expresion..." (sorry I'm not thorough in the error message, but my IDE
doesn't let me copy it).
So, going through it piece by piece:
"Part A" is Ok, I think. At least it parses with no errors.
"Part C" is so simple, it can be wrong.
"Part B". Well, here is the problem. I get that
"supplier.oclIsKindOf(Interface)" is not a boolean expression!!.
Correct me if I'm wrong, but I am standing in a Set of Dependency, I get
each Dependency and ask if it's "supplier" role (an instance of
"NamedElement") is of the type or subtype of Interface, am I right?.
I don't see my mistake here. Perhaps I'm just too submerged on the
subject to see it.
I hope someone can enlighten me.
Thank you,
Juan Pedro
|
|
|