Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Parsing problem.
Parsing problem. [message #31769] Tue, 03 July 2007 09:30 Go to previous message
Juan Pedro Silva is currently offline 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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:problem with multiStatus
Next Topic:regex/ocl
Goto Forum:
  


Current Time: Mon May 20 03:24:41 EDT 2013

Powered by FUDForum. Page generated in 0.01829 seconds