Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Question about OCL example
Question about OCL example [message #67762] Sat, 14 February 2009 15:47 Go to next message
Williams  is currently offline Williams
Messages: 43
Registered: July 2009
Member
I downloaded the OCL example from the website. I imported to my Eclipse.
But I received several compiler errors in file OCLConsolepage.java. The
errors complains about
The import org.eclipse.ocl.uml cannot be resolved

After I add the corresponding library, I get the following error at the
beginning of the file:

The type org.eclipse.uml2.uml.NamedElement cannot
be resolved. It is indirectly referenced from
required .class files

Can someone tell me how to fix the problem? In addition, is there any
document about the example? Thanks.
W.
Re: Question about OCL example [message #67805 is a reply to message #67762] Mon, 16 February 2009 15:04 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, W,

See some comments in-line, below.

HTH,

Christian


Williams wrote:
> I downloaded the OCL example from the website. I imported to my
> Eclipse. But I received several compiler errors in file
> OCLConsolepage.java. The errors complains about The import
> org.eclipse.ocl.uml cannot be resolved

I guess that you don't have the OCL SDK installed. That is definitely
the easier way to go because it solves several problems:

- creating the example projects in your workspace is as easy as
launching the "New -> Example..." wizard
- you will have all of the requirements of the example, including the
org.eclipse.ocl.uml plug-in
- you will have the OCL Developer Guide documentation in the Eclipse
Help, which includes a guide to the example


> After I add the corresponding library, I get the following error at the
> beginning of the file:

How did you add the org.eclipse.ocl.uml bundle to your dependencies?
It's an OSGi bundle/Eclipse plug-in, so the usual way is to add it to
your PDE target configuration. Don't just add it to the JDT classpath
of your project, because it won't work correctly that way. Unless, of
course, you're developing an Eclipse-less application, which is
supported by EMF, OCL, and UML2 ... but, then, you'll have a bunch of
registrations to perform in code that the plug-in metadata otherwise
does for you.


> The type org.eclipse.uml2.uml.NamedElement cannot be resolved. It is
> indirectly referenced from required .class files

Right, because the org.eclipse.ocl.uml bundle requires the UML API from
the MDT UML2 component. Again, installing the SDK ensures (via
Eclipse's Software Updates manager) that you have or can find all of the
dependencies.


> Can someone tell me how to fix the problem? In addition, is there any
> document about the example? Thanks.

Yes, as I mentioned, it is in the OCL SDK.


> W.
>
Re: Question about OCL example [message #67824 is a reply to message #67805] Tue, 17 February 2009 11:40 Go to previous messageGo to next message
Williams  is currently offline Williams
Messages: 43
Registered: July 2009
Member
Christian,

>> I downloaded the OCL example from the website. I imported to my
>> Eclipse. But I received several compiler errors in file
>> OCLConsolepage.java. The errors complains about The import
>> org.eclipse.ocl.uml cannot be resolved

> I guess that you don't have the OCL SDK installed. That is definitely
> the easier way to go because it solves several problems:

I think I have OCL SDK installed because after I click Help -> About
Eclipse SDK -> Plugin Details, I have OCL Compatibility API and
Documentation,
Source, Examples, Interpreter Example, Parser/Interpreter.

> - creating the example projects in your workspace is as easy as
> launching the "New -> Example..." wizard

That is what I did. Then I clicked on OCL Interpreter Example. Then
after several seconds, I saw a red cross next to
org.eclipse.emf.ocl.examples.interpreter.

> - you will have all of the requirements of the example, including the
> org.eclipse.ocl.uml plug-in

How can check these requirements?

> - you will have the OCL Developer Guide documentation in the Eclipse
> Help, which includes a guide to the example

Yes. I did see it. But When I read the first paragraph for the OCL
Interpreter example I got lost:

Description
This example plug-in is named org.eclipse.emf.ocl.examples.interpreter.
This plug-in contributes the OCL Interpreter menu to the library editor's
main menu and context menu. The menu has one item:

Show Console: Opens the interactive OCL console.

Where is the OCL Interpreter menu to the library editor's main menu
and context munu?
Thanks.
Williams


>> After I add the corresponding library, I get the following error at the
>> beginning of the file:

> How did you add the org.eclipse.ocl.uml bundle to your dependencies?
> It's an OSGi bundle/Eclipse plug-in, so the usual way is to add it to
> your PDE target configuration. Don't just add it to the JDT classpath
> of your project, because it won't work correctly that way. Unless, of
> course, you're developing an Eclipse-less application, which is
> supported by EMF, OCL, and UML2 ... but, then, you'll have a bunch of
> registrations to perform in code that the plug-in metadata otherwise
> does for you.


>> The type org.eclipse.uml2.uml.NamedElement cannot be resolved. It is
>> indirectly referenced from required .class files

> Right, because the org.eclipse.ocl.uml bundle requires the UML API from
> the MDT UML2 component. Again, installing the SDK ensures (via
> Eclipse's Software Updates manager) that you have or can find all of the
> dependencies.


>> Can someone tell me how to fix the problem? In addition, is there any
>> document about the example? Thanks.

> Yes, as I mentioned, it is in the OCL SDK.


>> W.
>>
Re: Question about OCL example [message #67843 is a reply to message #67824] Tue, 17 February 2009 14:11 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Williams,

From the descriptions of your problems, I guessed that you had gone
about things rather differently. Sorry about that.

It seems, then, that you installed the SDK by unzipping it into your
dropins/ folder. That warks, but doesn't provide the opportunity for p2
to tell you that UML2 is also needed for the complete SDK. You can
download it from here:

http://www.eclipse.org/modeling/mdt/downloads/?project=uml2& amp;sortBy=date

Now, having said that, the UML2 APIs are not needed if you are only
using OCL with Ecore models, and even the console example doesn't
require it. It's just an optional dependency, but obviously at
compile-time you will get red Xes. You should be able to ignore those
and run anyway, or else install the example into your workbench either
from the update site or the separate download ZIP on the OCL downloads page.

For legacy reasons, mostly, the example adds a "Show Console" menu
action to the editor generated for the EXTLibrary model that is an Ecore
example from EMF. There is another way to open the OCL console,
however, which is:

1. Open the Console view (in the "General" category of the
"Show View" menu; it's a basic component of the Eclipse SDK).

2. In the Console View's action bar, there is a "New Console"
button with a pull-down menu. One of the options in this
menu will be the OCL Console. This will let you open the
console in the context of any model editor, be it an Ecore
model, a UML model, a GMF generator model, or even a library
model.

HTH,

Christian


Williams wrote:
> Christian,
>
>>> I downloaded the OCL example from the website. I imported to my
>>> Eclipse. But I received several compiler errors in file
>>> OCLConsolepage.java. The errors complains about The import
>>> org.eclipse.ocl.uml cannot be resolved
>
>> I guess that you don't have the OCL SDK installed. That is definitely
>> the easier way to go because it solves several problems:
>
> I think I have OCL SDK installed because after I click Help -> About
> Eclipse SDK -> Plugin Details, I have OCL Compatibility API and
> Documentation,
> Source, Examples, Interpreter Example, Parser/Interpreter.
>
>> - creating the example projects in your workspace is as easy as
>> launching the "New -> Example..." wizard
>
> That is what I did. Then I clicked on OCL Interpreter Example. Then
> after several seconds, I saw a red cross next to
> org.eclipse.emf.ocl.examples.interpreter.
>
>> - you will have all of the requirements of the example, including the
>> org.eclipse.ocl.uml plug-in
>
> How can check these requirements?
>
>> - you will have the OCL Developer Guide documentation in the Eclipse
>> Help, which includes a guide to the example
>
> Yes. I did see it. But When I read the first paragraph for the OCL
> Interpreter example I got lost:
>
> Description
> This example plug-in is named org.eclipse.emf.ocl.examples.interpreter.
> This plug-in contributes the OCL Interpreter menu to the library
> editor's main menu and context menu. The menu has one item:
> Show Console: Opens the interactive OCL console.
> Where is the OCL Interpreter menu to the library editor's main menu
> and context munu? Thanks.
> Williams
>
>
>>> After I add the corresponding library, I get the following error at the
>>> beginning of the file:
>
>> How did you add the org.eclipse.ocl.uml bundle to your dependencies?
>> It's an OSGi bundle/Eclipse plug-in, so the usual way is to add it to
>> your PDE target configuration. Don't just add it to the JDT classpath
>> of your project, because it won't work correctly that way. Unless, of
>> course, you're developing an Eclipse-less application, which is
>> supported by EMF, OCL, and UML2 ... but, then, you'll have a bunch of
>> registrations to perform in code that the plug-in metadata otherwise
>> does for you.
>
>
>>> The type org.eclipse.uml2.uml.NamedElement cannot be resolved. It is
>>> indirectly referenced from required .class files
>
>> Right, because the org.eclipse.ocl.uml bundle requires the UML API
>> from the MDT UML2 component. Again, installing the SDK ensures (via
>> Eclipse's Software Updates manager) that you have or can find all of
>> the dependencies.
>
>
>>> Can someone tell me how to fix the problem? In addition, is there any
>>> document about the example? Thanks.
>
>> Yes, as I mentioned, it is in the OCL SDK.
>
>
>>> W.
>>>
>
>
Re: Question about OCL example [message #67861 is a reply to message #67843] Wed, 18 February 2009 15:28 Go to previous messageGo to next message
Williams  is currently offline Williams
Messages: 43
Registered: July 2009
Member
Christian W. Damus wrote:

> Hi, Williams,

> From the descriptions of your problems, I guessed that you had gone
> about things rather differently. Sorry about that.

> It seems, then, that you installed the SDK by unzipping it into your
> dropins/ folder. That warks, but doesn't provide the opportunity for p2
> to tell you that UML2 is also needed for the complete SDK. You can
> download it from here:

> http://www.eclipse.org/modeling/mdt/downloads/?project=uml2& amp;sortBy=date

I downloaded it and unzip to eclipse directory. and I see UML2 in my
plug-in details. But I still have the same compiler error?

Thanks.
W.


> Now, having said that, the UML2 APIs are not needed if you are only
> using OCL with Ecore models, and even the console example doesn't
> require it. It's just an optional dependency, but obviously at
> compile-time you will get red Xes. You should be able to ignore those
> and run anyway, or else install the example into your workbench either
> from the update site or the separate download ZIP on the OCL downloads page.

> For legacy reasons, mostly, the example adds a "Show Console" menu
> action to the editor generated for the EXTLibrary model that is an Ecore
> example from EMF. There is another way to open the OCL console,
> however, which is:

> 1. Open the Console view (in the "General" category of the
> "Show View" menu; it's a basic component of the Eclipse SDK).

> 2. In the Console View's action bar, there is a "New Console"
> button with a pull-down menu. One of the options in this
> menu will be the OCL Console. This will let you open the
> console in the context of any model editor, be it an Ecore
> model, a UML model, a GMF generator model, or even a library
> model.

> HTH,

> Christian


> Williams wrote:
>> Christian,
>>
>>>> I downloaded the OCL example from the website. I imported to my
>>>> Eclipse. But I received several compiler errors in file
>>>> OCLConsolepage.java. The errors complains about The import
>>>> org.eclipse.ocl.uml cannot be resolved
>>
>>> I guess that you don't have the OCL SDK installed. That is definitely
>>> the easier way to go because it solves several problems:
>>
>> I think I have OCL SDK installed because after I click Help -> About
>> Eclipse SDK -> Plugin Details, I have OCL Compatibility API and
>> Documentation,
>> Source, Examples, Interpreter Example, Parser/Interpreter.
>>
>>> - creating the example projects in your workspace is as easy as
>>> launching the "New -> Example..." wizard
>>
>> That is what I did. Then I clicked on OCL Interpreter Example. Then
>> after several seconds, I saw a red cross next to
>> org.eclipse.emf.ocl.examples.interpreter.
>>
>>> - you will have all of the requirements of the example, including the
>>> org.eclipse.ocl.uml plug-in
>>
>> How can check these requirements?
>>
>>> - you will have the OCL Developer Guide documentation in the Eclipse
>>> Help, which includes a guide to the example
>>
>> Yes. I did see it. But When I read the first paragraph for the OCL
>> Interpreter example I got lost:
>>
>> Description
>> This example plug-in is named org.eclipse.emf.ocl.examples.interpreter.
>> This plug-in contributes the OCL Interpreter menu to the library
>> editor's main menu and context menu. The menu has one item:
>> Show Console: Opens the interactive OCL console.
>> Where is the OCL Interpreter menu to the library editor's main menu
>> and context munu? Thanks.
>> Williams
>>
>>
>>>> After I add the corresponding library, I get the following error at the
>>>> beginning of the file:
>>
>>> How did you add the org.eclipse.ocl.uml bundle to your dependencies?
>>> It's an OSGi bundle/Eclipse plug-in, so the usual way is to add it to
>>> your PDE target configuration. Don't just add it to the JDT classpath
>>> of your project, because it won't work correctly that way. Unless, of
>>> course, you're developing an Eclipse-less application, which is
>>> supported by EMF, OCL, and UML2 ... but, then, you'll have a bunch of
>>> registrations to perform in code that the plug-in metadata otherwise
>>> does for you.
>>
>>
>>>> The type org.eclipse.uml2.uml.NamedElement cannot be resolved. It is
>>>> indirectly referenced from required .class files
>>
>>> Right, because the org.eclipse.ocl.uml bundle requires the UML API
>>> from the MDT UML2 component. Again, installing the SDK ensures (via
>>> Eclipse's Software Updates manager) that you have or can find all of
>>> the dependencies.
>>
>>
>>>> Can someone tell me how to fix the problem? In addition, is there any
>>>> document about the example? Thanks.
>>
>>> Yes, as I mentioned, it is in the OCL SDK.
>>
>>
>>>> W.
>>>>
>>
>>
Re: Question about OCL example [message #67882 is a reply to message #67843] Wed, 18 February 2009 16:16 Go to previous messageGo to next message
Williams  is currently offline Williams
Messages: 43
Registered: July 2009
Member
Christian,
Pls ignore my previous email. After I reimport the example, the redXs
are all gone. Now, I am trying to following the example. How should I do
in the next step. I need to create test project which includes Employee
model? I get
lost about what I need to do. Thanks.
W.
Re: Question about OCL example [message #67901 is a reply to message #67861] Wed, 18 February 2009 16:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Williams,

Now you're just looking at the standard PDE target and plug-in
dependency configuration tasks that are pervasive in Eclipse, and not
modeling or OCL specific.

In order for the PDE classpath container in the example project to
resolve the dependency on the org.eclipse.uml2.uml plug-in, so that the
JDT compiler will find its classes at compile-time, your PDE target has
to include the org.eclipse.uml2* plug-ins. In the PDE Target preference
page, make sure that you can see these plug-ins and that they are selected.

Cheers,

Christian


Williams wrote:
> Christian W. Damus wrote:
>
>> Hi, Williams,
>
>> From the descriptions of your problems, I guessed that you had gone
>> about things rather differently. Sorry about that.
>
>> It seems, then, that you installed the SDK by unzipping it into your
>> dropins/ folder. That warks, but doesn't provide the opportunity for
>> p2 to tell you that UML2 is also needed for the complete SDK. You can
>> download it from here:
>
>> http://www.eclipse.org/modeling/mdt/downloads/?project=uml2& amp;sortBy=date
>
> I downloaded it and unzip to eclipse directory. and I see UML2 in my
> plug-in details. But I still have the same compiler error?
>
> Thanks.
> W.
>
>
>> Now, having said that, the UML2 APIs are not needed if you are only
>> using OCL with Ecore models, and even the console example doesn't
>> require it. It's just an optional dependency, but obviously at
>> compile-time you will get red Xes. You should be able to ignore those
>> and run anyway, or else install the example into your workbench either
>> from the update site or the separate download ZIP on the OCL downloads
>> page.
>
>> For legacy reasons, mostly, the example adds a "Show Console" menu
>> action to the editor generated for the EXTLibrary model that is an
>> Ecore example from EMF. There is another way to open the OCL console,
>> however, which is:
>
>> 1. Open the Console view (in the "General" category of the
>> "Show View" menu; it's a basic component of the Eclipse SDK).
>
>> 2. In the Console View's action bar, there is a "New Console"
>> button with a pull-down menu. One of the options in this
>> menu will be the OCL Console. This will let you open the
>> console in the context of any model editor, be it an Ecore
>> model, a UML model, a GMF generator model, or even a library
>> model.
>
>> HTH,
>
>> Christian
>
>
>> Williams wrote:
>>> Christian,
>>>
>>>>> I downloaded the OCL example from the website. I imported to my
>>>>> Eclipse. But I received several compiler errors in file
>>>>> OCLConsolepage.java. The errors complains about The import
>>>>> org.eclipse.ocl.uml cannot be resolved
>>>
>>>> I guess that you don't have the OCL SDK installed. That is
>>>> definitely the easier way to go because it solves several problems:
>>>
>>> I think I have OCL SDK installed because after I click Help -> About
>>> Eclipse SDK -> Plugin Details, I have OCL Compatibility API and
>>> Documentation,
>>> Source, Examples, Interpreter Example, Parser/Interpreter.
>>>
>>>> - creating the example projects in your workspace is as easy as
>>>> launching the "New -> Example..." wizard
>>>
>>> That is what I did. Then I clicked on OCL Interpreter Example. Then
>>> after several seconds, I saw a red cross next to
>>> org.eclipse.emf.ocl.examples.interpreter.
>>>
>>>> - you will have all of the requirements of the example, including
>>>> the
>>>> org.eclipse.ocl.uml plug-in
>>>
>>> How can check these requirements?
>>>
>>>> - you will have the OCL Developer Guide documentation in the Eclipse
>>>> Help, which includes a guide to the example
>>>
>>> Yes. I did see it. But When I read the first paragraph for the OCL
>>> Interpreter example I got lost:
>>>
>>> Description
>>> This example plug-in is named
>>> org.eclipse.emf.ocl.examples.interpreter. This plug-in contributes
>>> the OCL Interpreter menu to the library editor's main menu and
>>> context menu. The menu has one item:
>>> Show Console: Opens the interactive OCL console.
>>> Where is the OCL Interpreter menu to the library editor's main
>>> menu and context munu? Thanks.
>>> Williams
>>>
>>>
>>>>> After I add the corresponding library, I get the following error at
>>>>> the
>>>>> beginning of the file:
>>>
>>>> How did you add the org.eclipse.ocl.uml bundle to your dependencies?
>>>> It's an OSGi bundle/Eclipse plug-in, so the usual way is to add it
>>>> to your PDE target configuration. Don't just add it to the JDT
>>>> classpath of your project, because it won't work correctly that
>>>> way. Unless, of course, you're developing an Eclipse-less
>>>> application, which is supported by EMF, OCL, and UML2 ... but, then,
>>>> you'll have a bunch of registrations to perform in code that the
>>>> plug-in metadata otherwise does for you.
>>>
>>>
>>>>> The type org.eclipse.uml2.uml.NamedElement cannot be resolved. It
>>>>> is indirectly referenced from required .class files
>>>
>>>> Right, because the org.eclipse.ocl.uml bundle requires the UML API
>>>> from the MDT UML2 component. Again, installing the SDK ensures (via
>>>> Eclipse's Software Updates manager) that you have or can find all of
>>>> the dependencies.
>>>
>>>
>>>>> Can someone tell me how to fix the problem? In addition, is there
>>>>> any document about the example? Thanks.
>>>
>>>> Yes, as I mentioned, it is in the OCL SDK.
>>>
>>>
>>>>> W.
>>>>>
>>>
>>>
>
>
Re: Question about OCL example [message #67987 is a reply to message #67882] Thu, 19 February 2009 07:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Williams,

Since this console plug-in is a project in your workspace, you need to
test it as you would any other Eclipse plug-in: in a run-time workbench.

I don't know about any Employee model, but I think the example guide
does talk about the EXTLibrary example from EMF, which three plug-ins
were also created in your workspace by the New Example wizard. In your
run-time workbench you can create a library model if you wish, but that
isn't necessary as I mentioned already: you can use the OCL console in
the context of any EMF-based model.

Cheers,

Christian


Williams wrote:
> Christian,
> Pls ignore my previous email. After I reimport the example, the redXs
> are all gone. Now, I am trying to following the example. How should I do
> in the next step. I need to create test project which includes Employee
> model? I get
> lost about what I need to do. Thanks.
> W.
>
Re: Question about OCL example [message #68144 is a reply to message #67987] Mon, 23 February 2009 10:23 Go to previous messageGo to next message
Williams  is currently offline Williams
Messages: 43
Registered: July 2009
Member
Christian,
could you pls tell me how I can use an example to see how the OCL
plug-in works? I get lost about what the OCL plug-in can do? My
understanding to OCL includes:
1. Define a class diagram at M-i level with OCL constraints,
2. Define an instance of the class diagram to check whether the OCL
constraints are satisfied or not

I need an example to go through this process. Thanaks.
W.


W. Damus wrote:

> Hi, Williams,

> Since this console plug-in is a project in your workspace, you need to
> test it as you would any other Eclipse plug-in: in a run-time workbench.

> I don't know about any Employee model, but I think the example guide
> does talk about the EXTLibrary example from EMF, which three plug-ins
> were also created in your workspace by the New Example wizard. In your
> run-time workbench you can create a library model if you wish, but that
> isn't necessary as I mentioned already: you can use the OCL console in
> the context of any EMF-based model.

> Cheers,

> Christian


> Williams wrote:
>> Christian,
>> Pls ignore my previous email. After I reimport the example, the redXs
>> are all gone. Now, I am trying to following the example. How should I do
>> in the next step. I need to create test project which includes Employee
>> model? I get
>> lost about what I need to do. Thanks.
>> W.
>>
Re: Question about OCL example [message #68243 is a reply to message #68144] Fri, 27 February 2009 10:46 Go to previous message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Williams,

I think your understanding of what OCL is useful for is accurate. By
"instance of the class diagram" you mean objects in your run-time
system, right? That is the idea ...

I'm not sure what else I can say besides what the Tutorial does in the
on-line help concerning usage of the API and the Examples Guide on the
subject of using the Console example. There is a wealth of good
introductory material for OCL on the Open Model CourseWare project page
in the GMT project:

http://www.eclipse.org/gmt/omcw/resources/chapter01/

HTH,

Christian


Williams wrote:
> Christian,
> could you pls tell me how I can use an example to see how the OCL
> plug-in works? I get lost about what the OCL plug-in can do? My
> understanding to OCL includes:
> 1. Define a class diagram at M-i level with OCL constraints,
> 2. Define an instance of the class diagram to check whether the OCL
> constraints are satisfied or not
> I need an example to go through this process. Thanaks.
> W.
>
>
> W. Damus wrote:
>
>> Hi, Williams,
>
>> Since this console plug-in is a project in your workspace, you need to
>> test it as you would any other Eclipse plug-in: in a run-time workbench.
>
>> I don't know about any Employee model, but I think the example guide
>> does talk about the EXTLibrary example from EMF, which three plug-ins
>> were also created in your workspace by the New Example wizard. In
>> your run-time workbench you can create a library model if you wish,
>> but that isn't necessary as I mentioned already: you can use the OCL
>> console in the context of any EMF-based model.
>
>> Cheers,
>
>> Christian
>
>
>> Williams wrote:
>>> Christian,
>>> Pls ignore my previous email. After I reimport the example, the
>>> redXs are all gone. Now, I am trying to following the example. How
>>> should I do in the next step. I need to create test project which
>>> includes Employee model? I get
>>> lost about what I need to do. Thanks.
>>> W.
>>>
>
>
Previous Topic:Example - "exampleOCL.zip" yEnc (1/1)
Next Topic:How to check my OCL constraints for "my custom profile" applied uml diagram
Goto Forum:
  


Current Time: Sat Jul 26 15:19:30 EDT 2014

Powered by FUDForum. Page generated in 0.02077 seconds