Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Check profile application(No successful check because of different namespace uris when saving models?)
Check profile application [message #875370] Tue, 22 May 2012 16:01 Go to next message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Hi,

I have created a UML model programmatically. The model is saved as file and contains a profile application.

Now I want to realize the loading of models: For this purpose I load the model, then I load my profile from file and check whether the profile is applied. Because if not, the profile is expected to be applied.

Well, now my problem is, that the check whether my profile is applied does not work.

		if (!model.isProfileApplied(myProfile)) {
			System.out.println("Profile not applied");
			applyProfile(model, myProfile);
		}



My profile is never applied according to this check Smile (Of course within the file it is added).

However, I assume there is some problem concerning the namespace uri. Because every time I save my model the profile gets a new namespace uri:

Here are some examples of the top of my models:

<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:My="http:///schemas/My/_D1CfgKQmEeGs79gf9MX0Ow/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="http:///schemas/My/_D1CfgKQmEeGs79gf9MX0Ow/0 file:/C:/...location...myProfile.uml">

Another file:

<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:My="http:///schemas/My/_KifO8KQmEeGs79gf9MX0Ow/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="http:///schemas/My/_KifO8KQmEeGs79gf9MX0Ow/0 file:/C:/...location...myProfile.uml">


So the namespace uri is different every time. Do you have any idea why the namespace is not identical?

Within the profile I have set the namespace uri:

<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_bO2YlM0cEd6AF7oF64guDA" name="MyProfile">
  <eAnnotations xmi:id="_Ap4f4FAYEeGaQIAuFv90zA" source="http://www.eclipse.org/uml2/2.0.0/UML">
    <contents xsi:type="ecore:EPackage" name="My" nsURI="http://www.etc./My" nsPrefix="My">


I have checked to load and save the profile. And also in this case, the NS Uri is reset to a random value.

Regards

Tex
Re: Check profile application [message #875858 is a reply to message #875370] Wed, 23 May 2012 13:09 Go to previous message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Maaaaaaan Smile The solution: I did always a profile.define() before applying it. This changed the namespace uri.

So: If you already have a working profile, don't do a define Smile
Previous Topic:Store model in database
Next Topic:Make UML profile plug-in visible
Goto Forum:
  


Current Time: Thu Oct 23 08:56:20 GMT 2014

Powered by FUDForum. Page generated in 0.15718 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software