|
|
|
|
Re: New in OCL [message #1551663 is a reply to message #1477296] |
Wed, 07 January 2015 19:24 |
Tony Chou Messages: 8 Registered: January 2015 |
Junior Member |
|
|
Hi Ed -
I am a newbie to OCL too. Could you shed some light on the following (it will be appended for sure) questions?
I first created a new .ocl file from my UML model and was playing around OCL queries to get my feet wet. This is a side effort in conjunction with the need of creating a BIRT report since there are a lot of Row Mapping queries I have to customize there. But just by coming to the OCL editor (Not an xtext one) there are several not-so-clear points I need some light on.
Question 1
Let me start with my very basic question. I first selected my UML model and set the Context Element to one of the higher-level packages. I have used several packages in my UML model since I like to use their "folder" nature to organize similiar concepts.
Then I did this simple expression: self
After clicking the "Evaluate OCL Document" button in the tool bar, I saw the following shown in the (OCL) Console.
Successfully run the query. Result:
org.eclipse.uml2.uml.internal.impl.PackageImpl@ 43924392 (name: Batch Load Strategy Concepts, visibility: <unset>)
So it looks this indeed is a Package and implemented by PackageImpl.
Then, I typed the following by Ctrl+Space - self.getAllAppliedProfiles() and got the following:
Successfully run the query. Result:
1.) org.eclipse.uml2.uml.internal.impl.ProfileImpl@ 37543754 (name: Default, visibility: <unset>)
2.) org.eclipse.uml2.uml.internal.impl.ProfileImpl@ 18561856 (name: Business Modeling, visibility: <unset>)
3.) org.eclipse.uml2.uml.internal.impl.ProfileImpl@ 3ad83ad8 (name: Standard, visibility: <unset>)
4.) org.eclipse.uml2.uml.internal.impl.ProfileImpl@ 2fea2fea (name: Deployment, visibility: <unset>)
It looked great. So, I spent some time to look for the "Package" interface provided by JavaDoc from org.eclipse.uml2.uml and found out there is a public getOwner() method. I put that "self.getOwner()" and evaluated it. Obviously it didn't work. It said:
Evaluation Error: Cannot find operation (getOwner()) for the type (Package)
What defines what operations I can put into the OCL editor for the OCL file I created? Is there a single source to show all of them? I have seen this site for OCL operations but is that all are allowed? (Sorry it wouldn't let me put in links since I am a new user.)
Question 2
One other thing that confuses me most is why can't I simply paste the contents of an OCL file into this editor?
Question 3
Last question is - since OCL is a language, and it support recursion, what can I do to traverse all of my packages from a given package so I can organize them in my BIRT report? Could you please help me with the OCL query?
Sincerely,
Tony Chou
|
|
|
|
Powered by
FUDForum. Page generated in 0.02726 seconds