| ocl query [message #36871] |
Wed, 12 September 2007 08:15  |
|
Originally posted by: nickkirtley.gmail.com
hi,
I have a problem with an OCL query:
I have:
Component c1, with stereotyped port e, port has two interfaces, one
provided one required, provided is stereotyped and called ObserveEvent ,
required is stereotyped and called update.
Component c2, with stereotyped port c, port has two interfaces, one
provided one required, provided is stereotyped and called update ,
required is stereotyped and called ObserveEvent.
c2 has two properties, foo and bar, these two are connected with a
connector. Within the context of c2. The connector is stereotyped.
problem 1:
if self is c2: self.ownedPort.getRequireds does not work. Provided does
work. Is there a reason for this?
problem 2:
if self is c2: I want to traverse along the connector to c1 and check if
the interfaces of c1 have been stereotyped:
self.ownedConnector.end.role.type->select(name='c1').ownedElement
this returns port of c1. Problem is that I know I have a port, but OCL
doesn't know it's a port and thus does not give me the option of doing
port specific things. Infact the element above it, which is c1, also
doesn't know that it's a component and I can't just use .OwnedPort.
What I need is some sort of cast or that OCL would know directly what kind
of element it is dealing with.
So really with :
self.ownedConnector.end.role.type->select(name='c1') I would like to be able
to a component specific command - .ownedPort. Unfortunately I can't.
I suspect the problem is that I selected it with select, and thus OCL
doens't know what kind of element it is.
thx in advance,
Nick
|
|
|