Home » Modeling » UML2 » EMF - not possible to create a profile model
EMF - not possible to create a profile model [message #1334476] |
Mon, 05 May 2014 11:55  |
Eclipse User |
|
|
|
Hello,
I have an issue with creating an EMF profile file. In the ZIP file I attached, a minimal example is provided (targeting Epsilon developments, however I reduced it to the EMF part to solve the current issue). There, it is possible to create the model file "LeftModel.uml", as the output to the console shows.
However, when I try to create the profile file, this does not work. In the subsequent step, I try to create the EMF model for "LeftModel.uml", trying to use my profile file. However, this results in exceptions.
Any support is very much appreciated, thanks.
Kind regards, Alex
|
|
|
Re: EMF - not possible to create a profile model [message #1334691 is a reply to message #1334476] |
Mon, 05 May 2014 14:06   |
Eclipse User |
|
|
|
Hi, Alex,
The example you provided doesn't seem to be reduced to just EMF: it
has Epsilon dependencies. Moreover, half of the code seems to be
commented out. And I don't know what any of it is actually trying to
do. Is there supposed to be anything in these model files? Are you
creating new files or loading existing files? It's all quite opaque to
me (I know nothing of Epsilon).
I can't run the example code without quite a bit of work. Can you just
share what the exceptions are that you are seeing? It appears, at
least, that you are running this code "stand-alone" (not in the context
of a running Eclipse instance). In that case, in order to for work
with UML Profiles, you have a few EMF and UML2 registries to populate,
first. Have a look at the UMLResourcesUtil::init(ResourceSet) API and
how it is used by the UML2 JUnit tests for an example (especially the
tests in the org.eclipse.uml2.uml.bug.tests package).
Cheers,
Christian
On 2014-05-05 15:55:43 +0000, Alexander Fülleborn said:
> Hello,
>
> I have an issue with creating an EMF profile file. In the ZIP file I
> attached, a minimal example is provided (targeting Epsilon
> developments, however I reduced it to the EMF part to solve the current
> issue). There, it is possible to create the model file "LeftModel.uml",
> as the output to the console shows.
>
> However, when I try to create the profile file, this does not work. In
> the subsequent step, I try to create the EMF model for "LeftModel.uml",
> trying to use my profile file. However, this results in exceptions.
>
> Any support is very much appreciated, thanks.
>
> Kind regards, Alex
> <image>
|
|
|
Re: EMF - not possible to create a profile model [message #1337353 is a reply to message #1334691] |
Tue, 06 May 2014 16:54   |
Eclipse User |
|
|
|
Hi Christian,
thanks a lot for your quick and constructive answer. I am so sorry that my example is too opaque for you, please excuse. Well, I have the following comments/answers (but also further questions ;-(() on it:
"The example you provided doesn't seem to be reduced to just EMF: it
has Epsilon dependencies."
==> You're right. I should remove it completely.
"Moreover, half of the code seems to be
commented out. And I don't know what any of it is actually trying to
do. Is there supposed to be anything in these model files? Are you
creating new files or loading existing files? It's all quite opaque to
me (I know nothing of Epsilon)."
==> I want to create models from *uml files that are then used by Epsilon to compare or transform them. The first part is my concern most important at the moment that I addressed to you.
"I can't run the example code without quite a bit of work. Can you just
share what the exceptions are that you are seeing?"
==> I propose that I first reduce the example really to EMF - as you propose. I found out that the exceptions have also an "Epsilon flavour".
"It appears, at
least, that you are running this code "stand-alone" (not in the context
of a running Eclipse instance). In that case, in order to for work
with UML Profiles, you have a few EMF and UML2 registries to populate,
first. Have a look at the UMLResourcesUtil::init(ResourceSet) API and
how it is used by the UML2 JUnit tests for an example (especially the
tests in the org.eclipse.uml2.uml.bug.tests package)."
==> That is true - it is a standalone scenario. I had a look to the sources you provided. However, I have quite a bit of problems to translate them to my case. E.g., in my current code, I create a list of "IModel" which is Epsilon specific. Unfortunately, I do not find an EMF type that I can use instead to replace this. Would it be possible that you give me any further hints?
What my program needs to do is:
1.) The "foundation" - to be solved first: Create model from file with a specific dsl profile
- be started in a separate Eclipse instance
- create a UML2 model from a .uml file, using a profile that is also provided as a .uml file
2.) Wrap the created UML2 models to Epsilon models in order to compare or transform them - to be supported by Epsilon expertise.
Thanks a lot for your appreciated support for 1.),
KR, Alex
|
|
|
Re: EMF - not possible to create a profile model [message #1340314 is a reply to message #1337353] |
Wed, 07 May 2014 22:21   |
Eclipse User |
|
|
|
Hi, Alex,
If I understand correctly, by "create models" you actually mean to
"load models" from serialized resources (XML files) into memory.
Creating models suggests creating something that doesn't exist, yet;
you want to load something that already exists.
So, this is done much as with any EMF-based application (remember I
know nothing of Epsilon): in a ResourceSet, create a Resource on the
URI of the document (*.uml file) you want to load, then as the resource
to load itself. The *.uml file containing your model will have within
it properly encoded references to the profile that cause it to be
loaded automatically in the same resource set; you don't have to load
the profile explicitly.
The EMF tutorials [1], UML "Getting Started" [2] and "Introduction to
UML2 Profiles" [3] tutorials should help with all of this.
For stand-alone applications working with UML, there is (as previously
mentioned), some extra registration that needs to be done using the
UMLResourcesUtil: UMLResourcesUtil.init(ResourceSet). The UML
tutorials actually cover this. Moreover, those tutorials are shipped
with the latest milestone (Luna M7 [4]) of the UML2 SDK as installable
example projects, providing code that runs. Find them in the "File ->
New -> Example..." wizard.
HTH,
Christian
[1] http://www.eclipse.org/modeling/emf/docs/
[2] https://wiki.eclipse.org/MDT/UML2/Getting_Started_with_UML2
[3] https://wiki.eclipse.org/MDT/UML2/Introduction_to_UML2_Profiles
[4]
http://www.eclipse.org/modeling/mdt/downloads/?showAll=1&hlbuild=S201405050725&project=uml2
On 2014-05-06 20:54:02 +0000, Alexander Fülleborn said:
> Hi Christian,
>
> thanks a lot for your quick and constructive answer. I am so sorry that
> my example is too opaque for you, please excuse. Well, I have the
> following comments/answers (but also further questions ;-(() on it:
>
>
> "The example you provided doesn't seem to be reduced to just EMF: it
> has Epsilon dependencies."
>
> ==> You're right. I should remove it completely.
>
> "Moreover, half of the code seems to be
> commented out. And I don't know what any of it is actually trying to
> do. Is there supposed to be anything in these model files? Are you
> creating new files or loading existing files? It's all quite opaque to
> me (I know nothing of Epsilon)."
>
> ==> I want to create models from *uml files that are then used by
> Epsilon to compare or transform them. The first part is my concern most
> important at the moment that I addressed to you.
>
> "I can't run the example code without quite a bit of work. Can you just
> share what the exceptions are that you are seeing?"
>
> ==> I propose that I first reduce the example really to EMF - as you
> propose. I found out that the exceptions have also an "Epsilon flavour".
>
> "It appears, at
> least, that you are running this code "stand-alone" (not in the context
> of a running Eclipse instance). In that case, in order to for work
> with UML Profiles, you have a few EMF and UML2 registries to populate,
> first. Have a look at the UMLResourcesUtil::init(ResourceSet) API and
> how it is used by the UML2 JUnit tests for an example (especially the
> tests in the org.eclipse.uml2.uml.bug.tests package)."
>
> ==> That is true - it is a standalone scenario. I had a look to the
> sources you provided. However, I have quite a bit of problems to
> translate them to my case. E.g., in my current code, I create a list of
> "IModel" which is Epsilon specific. Unfortunately, I do not find an EMF
> type that I can use instead to replace this. Would it be possible that
> you give me any further hints?
>
> What my program needs to do is:
>
> 1.) The "foundation" - to be solved first: Create model from file with
> a specific dsl profile
> - be started in a separate Eclipse instance
> - create a UML2 model from a .uml file, using a profile that is also
> provided as a .uml file
>
> 2.) Wrap the created UML2 models to Epsilon models in order to compare
> or transform them - to be supported by Epsilon expertise.
>
> Thanks a lot for your appreciated support for 1.),
>
> KR, Alex
|
|
| |
Re: EMF - not possible to create a profile model [message #1350873 is a reply to message #1350565] |
Mon, 12 May 2014 17:27   |
Eclipse User |
|
|
|
Hi, Alex,
The problem was that your code started down the right path to getting a
URI for the UML resource to load (by looking up the classpath resource
URL), but then didn't do anything with that. Instead, it tried to load
a file resource from the absolute filesystem path "/res/LeftModel.uml"
which, of course, doesn't exist.
Find attached an update of your code sample that fixes this problem and
succeeds in loading the model and dumping its contents to standard
output. A launch configuration file is included.
Note a few changes in the project (you might want to do a directory
diff to see what's changed):
* it is converted to a plug-in project in order to simplify management of
the classpath (the included launch config doesn't launch an Eclipse
instance, though, but just a pure Java app). The classpath configured
in your project had hard-coded paths to particular versions of Eclipse
plug-in JARs that I don't have and in locations in your computer's
filesystem that meant nothing to my computer :-)
* the ProPManMinimalExample::main method, as I said, started to
compute the correct URI for the LeftModel.uml resource but then
abandoned it
* the ProPManMinimalExample::getModel method used the EcoreUtil
getEObjectsByType method, which returns a list, instead of just
getEObjectByType, which returns the first matching element. Simple
typo that you would have found if loading the resource had succeeded
Cheers,
Christian
|
|
| |
Re: EMF - not possible to create a profile model [message #1353310 is a reply to message #1351946] |
Tue, 13 May 2014 17:37   |
Eclipse User |
|
|
|
Hi, Alex,
You don't need to do anything that my updated sample doesn't do.
The point is that the PDE can use an OSGi bundle manifest's description
of its dependencies to generate a classpath automatically, based on the
symbolic names of the bundles it requires, instead of hard-coding a
classpath comprising specific JARs in specific locations on a
particular filesystem.
If some classes aren't found, you'll need to add to the MANIFEST.MF
dependencies on the bundles (or packages) that provide those classes.
If you don't know what the OSGi manifest is and how it works, you need
to read up on OSGi and how Eclipse uses it to implement its plug-in
architecture.
Cheers,
Christian
On 2014-05-13 08:20:33 +0000, Alexander Fülleborn said:
> Hi Christian,
>
> thanks a lot for your support and the provided solution! I just would
> like to test it. As I still get errors due to the fact that some
> classes are not found, I would like to get back to the following part
> of your answer:
>
> "[...]
> * it is converted to a plug-in project in order to simplify management of
> the classpath (the included launch config doesn't launch an Eclipse
> instance, though, but just a pure Java app). The classpath configured
> in your project had hard-coded paths to particular versions of Eclipse
> plug-in JARs that I don't have and in locations in your computer's
> filesystem that meant nothing to my computer :)
> [...]"
>
> What do I need to simplify the management of the classpath in my
> environment? I have not that much experience with Eclipse to exactly
> understand what you have done to make it work.
>
> Thanks a lot and kind regards, Alex
|
|
| |
Goto Forum:
Current Time: Wed Jul 23 13:41:36 EDT 2025
Powered by FUDForum. Page generated in 0.08353 seconds
|