Home » Modeling » OCL » How to make query operation visible for OCL
| | | | | | | | | |
Re: How to make query operation visible for OCL [message #845170 is a reply to message #844912] |
Sat, 14 April 2012 20:31 |
|
Hi, Piotr,
IIRC, the semantics of interface implementation in UML (where I think
it's actually called "realization") is very different from Java.
In UML, when a class realizes an interface, this indicates only that
the class provides, in some form, the features described by the
interface. In particular, there is no generalization semantics between
classes and interfaces. In UML, a class only conforms to other classes
to which it has generalization relationships. An interface conforms to
other interfaces to which it has generalizations. The two do not mix.
The class is free to realize the features of the interface in an
undefined way (a "semantic variation point" in the verbiage of the UML
spec). For example, in an UML model describing a Java application, a
class may realize properties of an interface by defining accessor
methods (getter/setter) in Java Bean style.
Anyways, because the type of your instance is a class, that class
doesn't inherit features of the interfaces that it realizes, so your
OCL expression won't be expected to work.
HTH,
Christian
On 2012-04-14 14:08:43 +0000, Piotr J. Puczynski said:
> I will add also some comment: it is easy to see the problem when you
> look at the model.
> What I am trying to do is to call query operation "through" the
> interface in OCL. It is quotation because of course instance
> specifications connected with links have type of classes, not
> interfaces. But one end of the link is defined to be type of the
> interface. I think this is the problem for OCL evaluator.
>
> Regards,
> Piotr
|
|
| | | | | |
Re: How to make query operation visible for OCL [message #845936 is a reply to message #845255] |
Sun, 15 April 2012 15:22 |
|
Hi, Piotr,
Yes, an interface operation should be realized by an operation, but
nonetheless, the realizing class must independently define that
operation, because it does not inherit it from the interface.
In your case, the end of the link is an InstanceSpecification whose
type is an Interface? I don't expect that the OCL interpreter handles
that case. The OCL specification doesn't have anything to say about
interfaces, so the interpreter probably doesn't recognize them. But,
my knowledge of the code is out-of-date. Perhaps the current committer
team can comment further.
Cheers,
Christian
On 2012-04-14 22:50:44 +0000, Piotr J. Puczynski said:
> Hi Christian,
> yes, there is a variation point for attributes of an interface, not for
> operations.
>
> Operations declared in interface must be realized in classifier that
> realize interface (as operations). It is also because protocol may be
> attached to the interface that checks call order of these operations.
>
> The link that is instance specification can have one end defined as
> Interface type and use the query operation in this way it is used in my
> model.
>
> Regards,
> Piotr
|
|
|
Re: How to make query operation visible for OCL [message #845952 is a reply to message #845936] |
Sun, 15 April 2012 15:45 |
Piotr J. Puczynski Messages: 17 Registered: January 2012 |
Junior Member |
|
|
Hi Christian,
Christian W. Damus wrote on Sun, 15 April 2012 11:22
Yes, an interface operation should be realized by an operation, but
nonetheless, the realizing class must independently define that
operation, because it does not inherit it from the interface.
Yes, this is what I just said in my previous post.
Christian W. Damus wrote on Sun, 15 April 2012 11:22
In your case, the end of the link is an InstanceSpecification whose
type is an Interface?
No, it isn't. If you red my previous post carefully, you will know it. Saying more in UML language: I have a link with one slot that has defining feature set to property to association of type of Interface. Simply saying, this is not unusual to refer to class "through" interface and call method in the class by referring to operation in the interface. Of course, the linked instance specification's classifier is Class (that realizes the interface), not Interface and I call query operation in this Class.
Ed, I will try to provide repro soon.
Regards,
Piotr J. Puczynski
|
|
| |
Re: How to make query operation visible for OCL [message #846001 is a reply to message #845963] |
Sun, 15 April 2012 16:52 |
|
Hi, Piotr,
Cool. I did not know that. Whether this is a recent development or
not, I clearly am too long out of touch to be of any help on this
issue. Thanks for the update!
Christian
On 2012-04-15 16:03:05 +0000, Piotr J. Puczynski said:
> Hi Christian again,
> I am not OCL expert but I found something about interfaces in OCL specs:
>
> Quote:
>> Note that for a definition of the semantics of OCL, UML's distinction
>> between classes and interfaces does not matter. OCL specifies
>> constraints for instances of a given interface specification. Whether
>> this specification is stated in the form of a class or interface
>> definition makes no difference.
>
>
> But I am not sure if they tackled this specific case in particular for
> query operations. I would not agree that OCL should be ignorant to this
> problem, I think it is just a question of if we want to have it and
> conform to UML specs or if we can live without it.
>
> Cheers,
> Piotr
|
|
|
Re: How to make query operation visible for OCL [message #846706 is a reply to message #846001] |
Mon, 16 April 2012 09:11 |
Ed Willink Messages: 7669 Registered: July 2009 |
Senior Member |
|
|
Hi
Very very little has intentionally changed on the UML-binding. This is
variously through lack of detailed understanding, concern about
inadvertently breaking legacy customers and the difficulty of migrating
the existing code to Xtext, polymorphic values, UML-alignment and a
modeled library.
Enhanced UML behaviour is gradually appearing as the UML-aligned code
evolves.
That said a simple uncontroversial fix to the UML-binding can be done;
six weeks is the deadline to get the fix into the Juno release.
Regards
Ed Willink
On 15/04/2012 17:52, Christian W. Damus wrote:
> Hi, Piotr,
>
> Cool. I did not know that. Whether this is a recent development or
> not, I clearly am too long out of touch to be of any help on this
> issue. Thanks for the update!
>
> Christian
>
> On 2012-04-15 16:03:05 +0000, Piotr J. Puczynski said:
>
>> Hi Christian again,
>> I am not OCL expert but I found something about interfaces in OCL specs:
>>
>> Quote:
>>> Note that for a definition of the semantics of OCL, UML's
>>> distinction between classes and interfaces does not matter. OCL
>>> specifies constraints for instances of a given interface
>>> specification. Whether this specification is stated in the form of a
>>> class or interface definition makes no difference.
>>
>>
>> But I am not sure if they tackled this specific case in particular
>> for query operations. I would not agree that OCL should be ignorant
>> to this problem, I think it is just a question of if we want to have
>> it and conform to UML specs or if we can live without it.
>>
>> Cheers,
>> Piotr
>
>
|
|
|
Goto Forum:
Current Time: Wed Sep 18 02:59:57 GMT 2024
Powered by FUDForum. Page generated in 0.05527 seconds
|