Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to indicate the location of .ecore meta-model in the model ?
How to indicate the location of .ecore meta-model in the model ? [message #535104] Fri, 21 May 2010 09:57 Go to next message
Cong Kinh NGUYEN is currently offline Cong Kinh NGUYENFriend
Messages: 47
Registered: February 2010
Member
Hi,

I have a problem is described as the following:
- I created the cosmos.ecore meta-model.
- Then I created a model, for example HelloWorld.xmi and saved it in the same directory with my meta-model.
- After, I copied my model HelloWorld.xmi to another project in Eclipse (Java project). In fact, I wanted to open the model in the project, but the received message said that the URI in the model didn't find.

It seems that in this case, the model doesn't know where the meta-model is stored. Could you have any approach to avoid copying the meta-model with the model?

Thanks in advance,
Kinh
Re: How to indicate the location of .ecore meta-model in the model ? [message #535164 is a reply to message #535104] Fri, 21 May 2010 13:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010808030100040903020501
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Kinh,

Comments below.

Cong Kinh NGUYEN wrote:
> Hi,
>
> I have a problem is described as the following:
> - I created the cosmos.ecore meta-model.
> - Then I created a model, for example HelloWorld.xmi and saved it in
> the same directory with my meta-model.
> - After, I copied my model HelloWorld.xmi to another project in
> Eclipse (Java project). In fact, I wanted to open the model in the
> project, but the received message said that the URI in the model
> didn't find.
>
> It seems that in this case, the model doesn't know where the
> meta-model is stored. Could you have any approach to avoid copying the
> meta-model with the model?
I assume the *.xmi has an xsi:schemaLocation that refers to the
cosmos.ecore model using a relative location. The alternative would be
to use an absolute location, but then if you moved the model and the
instance to some other folder, the reference would be broken. So either
way, there's no perfect solution. If you want an absolute location
stored, you'd need to specialize a URI handler as supported by this option.

/**
* A {@link URIHandler} value that will be used to control how
URIs are {@link URI#resolve(URI) resolved} during load
* and {@link URI#deresolve(URI) deresolved} during save.
* @see URI
* @see URIHandler
* @see XMLHelper#resolve(URI, URI)
* @see XMLHelper#deresolve(URI)
* @see URIHandlerImpl
*/
String OPTION_URI_HANDLER = "URI_HANDLER";


>
>
> Thanks in advance,
> Kinh

--------------010808030100040903020501
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Kinh,<br>
<br>
Comments below.<br>
<br>
Cong Kinh NGUYEN wrote:
<blockquote cite="mid:ht5ldr$r81$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I have a problem is described as the following:
<br>
- I created the cosmos.ecore meta-model.
<br>
- Then I created a model, for example HelloWorld.xmi and saved it in
the same directory with my meta-model.
<br>
- After, I copied my model HelloWorld.xmi to another project in Eclipse
(Java project). In fact, I wanted to open the model in the project, but
the received message said that the URI in the model didn't find.
<br>
<br>
It seems that in this case, the model doesn't know where the meta-model
is stored. Could you have any approach to avoid copying the meta-model
with the model?</blockquote>
I assume the *.xmi has an xsi:schemaLocation that refers to the
cosmos.ecore model using a relative location.  The alternative would be
to use an absolute location, but then if you moved the model and the
instance to some other folder, the reference would be broken.  So
either way, there's no perfect solution.  If you want an absolute
location stored, you'd need to specialize a URI handler as supported by
this option.<br>
<blockquote><small>  /**<br>
   * A {@link URIHandler} value that will be used to control how URIs
are {@link URI#resolve(URI) resolved} during load <br>
   * and {@link URI#deresolve(URI) deresolved} during save.<br>
   * @see URI<br>
   * @see URIHandler<br>
   * @see XMLHelper#resolve(URI, URI)<br>
   * @see XMLHelper#deresolve(URI)<br>
   * @see URIHandlerImpl<br>
   */<br>
  String OPTION_URI_HANDLER = "URI_HANDLER";</small><br>
</blockquote>
<br>
<blockquote cite="mid:ht5ldr$r81$1@build.eclipse.org" type="cite"><br>
<br>
Thanks in advance,
<br>
Kinh
<br>
</blockquote>
</body>
</html>

--------------010808030100040903020501--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO]How to query the current data through the SQL statement in audit mode?
Next Topic:EMF Dynamic Templates
Goto Forum:
  


Current Time: Tue Apr 23 09:02:57 GMT 2024

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

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

Back to the top