|
Re: need guidance for execution of OCL query [message #520286 is a reply to message #519916] |
Thu, 11 March 2010 19:59 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi AJ
You've given yourself a very difficult first problem.
Firstly, I would use clearer names: countFeatures() really ought to
return an Integer count, rather than just be a wrapper for an existing
method.
Next: an invariant must be a boolean expression.
-----
Overriding is a complex semantic issue that has different definitions in
different languages, you therefore need to understand your semantics
and realise them.
In order to determine an override you need to compare the signature of
operationA against the signature of operationB. You therefore need
helper functions such as
overrides(signatureA : OrderedSet(Type), signatureB : OrderedSet(Type))
: Boolean ...
getSignature(operation : Operation) : OrderedSet(Type) ...
which you can use in iterations/set subtractions.
-----
You may find the MDT/OCL Example OCL Interpreter Console very helpful
for empirical exploring of your logic. As of M6, you can embed your OCL
in Ecore. See http://wiki.eclipse.org/MDT/OCLinEcore
Regards
Ed Willink
On 10/03/2010 14:02, albertlala96@yahoo.com wrote:
> Hi,
>
> I am new to OCL and trying to define a query to find response for a
> class. The definition on which I am working to solve for response for
> query is : number of methods plus the methods communication with other
> classes.
>
>
> - first I count Operations:
> context Classifier
> def: countFeatures(): Set(Feature) =
> self.allFeatures()
> def: countOperation(): Set(Feature) =
> self.countFeatures()->select(f|f.oclIsTypeOf(Operation))
>
> -- I look for overridden methods, because these methods also communicate
> with the class
> def: countOverriddentMethds(): Set(....) = ......// please help here
>
> -- and then the behvioral methods ( i mean methods which communicate
> with the other classes in sequence diagram)
>
> countOperation()->select(oclIsTypeOf(Operation).oclAsType(Message))
>
>
> inv RFC:
> countOperation()->size()+countOverriddentMethds()->size()+countBehvioralMethods()- >size()
>
>
>
> I am using Topcased to execute these queries.
>
> Thanks in advance,
> A.J
|
|
|
Powered by
FUDForum. Page generated in 0.03701 seconds