|
Re: Wrong schemaLocation in Ecore file when using URI maps [message #648178 is a reply to message #648107] |
Tue, 11 January 2011 16:07 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Tom,
Comments below.
Tom Brandenburg wrote:
> Hello everyone,
>
> currently I have a little problem with a kind of project landscape and
> model-2-x transformations among it.
> Imagine you have the following project structure:
>
>
>
> This structure consists of the following files:
>
>
> my.samples.xpand.codegen
> |
> - src
> |
> + my.samples.xpand.codegen.model
> |
> - sample.uml
> + my.samples.xpand.codegen.workflow
> |
> - main.mwe
>
> my.othersamples.xpand.metamodel
> |
> - src
> |
> + my.othersamples.xpand.metamodel
> |
> - metamodel.ecore
>
> my.othersamples.xpand.transformation
> |
> - src
> |
> + my.othersamples.xpand.transformation
> |
> - trafo.ext
>
> The main.mwe workflow is executed to transform sample.uml according to
> trafo.ext and metamodel.ecore to another model (dump.ecore).
>
> This is how the workflow looks like:
>
>
> <?xml version="1.0"?>
> <workflow> <!-- Set Mappings -->
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup"
> platformUri="..">
> <uriMap from="platform:/resource/metamodel/"
>
> to=" platform:/resource/my.othersamples.xpand.metamodel/src/my/ot hersamples/xpand/ "
> />
> <uriMap from="platform:/resource/codegen/"
>
> to=" platform:/resource/my.othersamples.xpand.codegen/src/my/othe rsamples/xpand/codegen/ "
> />
> </bean>
> <!-- Set Properties -->
> <property name="mmMETAMODEL"
> value="platform:/resource/metamodel/metamodel/metamodel.ecore " />
> <property name="model"
> value="platform:/resource/codegen/model/sample.uml" />
> <property name="dump"
> value="platform:/resource/codegen/model/dump.ecore" />
> <property name="src-gen" value="src-gen" />
> <property name="fileEncoding" value="ISO-8859-1"/>
> <!-- Set UML environment -->
> <bean class="org.eclipse.xtend.typesystem.uml2.Setup"
> standardUML2Setup="true" />
> <bean id="UMLMetaModel"
> class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel">
> </bean>
> <!-- Read in the model -->
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <modelSlot value="model"/>
> <uri value="${model}"/>
> </component>
> <!-- clean directory -->
> <component class="org.eclipse.emf.mwe.utils.DirectoryCleaner">
> <directory value="${src-gen}" />
> </component>
> <!-- Model-2-Model transformation -->
> <component class="org.eclipse.xtend.XtendComponent">
> <metaModel idRef="UMLMetaModel"/>
> <metaModel
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelFile value="${mmMETAMODEL}"/>
> </metaModel>
> <invoke
> value=" my::othersamples::xpand::transformation::trafo::createModel( model) "/>
>
> <outputSlot value="model"/>
> </component>
> <!-- Write the model -->
> <component class="org.eclipse.emf.mwe.utils.Writer">
> <modelSlot value="model"/>
> <uri value="${dump}"/>
> </component> </workflow>
>
> Now, the problem is that metamodel.ecore is referenced wrongly in
> dump.ecore. There one can find
> "../../metamodel/metamodel/metamodel.ecore" for the schemaLocation,
> which is obviously wrong, because it lays in a total different project
> directory (nevertheless the rest of the file apart from the
> schemaLocation seems to be correct).
Why is it wrong? I see
platform:/resource/metamodel/metamodel/metamodel.ecore so I imagine that
if you reference this model from another model nested to levels deep,
i.e., platform:/resource/codegen/model/dump.ecore, in a different
project you'll get exactly this relative path.
> So what am I doing wrong with my URI maps? I already tried to set
> other platformUri's, but without success.
I don't see anything wrong.
>
> If I have metamodel.ecore in the same project like main.mwe than it is
> referenced properly and the file can be viewed in Eclipse.
What do you consider proper?
>
> Does anyone have an idea?
>
> Thanks in advance and best regards
> Tom
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Wrong schemaLocation in Ecore file when using URI maps [message #648349 is a reply to message #648264] |
Wed, 12 January 2011 14:30 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------030609040505050005050304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Tom,
Comments below.
Tom Brandenburg wrote:
> Hello Ed and thanks a lot for your answer! :)
>
> Well, dump.ecore is stored under:
> C:\Eclipse\workspace\my.samples.xpand.codegen\src\my\samples \xpand\codegen\model\
>
What's most relevant is what URI does its resource have and what URI
does the resource it's referring to have at the time you save it. What
you show above isn't even a URI, it's an OS-specific file path and isn't
relevant to answering your question. The relevant information appears
to be these URIs
platform:/resource/codegen/model/dump.ecore
platform:/resource/metamodel/metamodel/metamodel.ecore
With respect to those URIs, the relative path is correct.
Why are the URIs not like this?
platform:/resource/my.samples.xpand.codegen/src/my/samples/x pand/codegen/model/dump.ecore
platform:/resource/my.othersamples.xpand.metamodel/src/my/ot hersamples/xpand/metamodel/metamodel/metamodel.ecore
>
> When metamodel.ecore is referenced with
> ..\..\metamodel\metamodel\metamodel.ecore than the resulting path
> would be:
> C:\Eclipse\workspace\my.samples.xpand.codegen\src\my\samples \xpand\metamodel\metamodel\metamodel.ecore,
> right?
>
> Although it should be:
> C:\Eclipse\workspace\my.othersamples.xpand.metamodel
> \src\my\othersamples\xpand\metamodel\metamodel\metamodel.eco re
>
> So a proper reference in dump.ecore would be something like "
> ..\..\..\..\..\..\..\my.othersamples.xpand.metamodel\src\my\
> othersamples\xpand\metamodel\metamodel\metamodel.ecore "
> Otherwise Eclipse doesn't find the metamodel.ecore.
>
> Am I right?
No because what you're showing isn't even a URI. In particular \ is not
a segment separator in a URI. If you want to open resources in the
workspace you need to ensure that you save them using the URIs that will
be used when they're in the workspace (or at the very least, that are
relatively the same). I.e., it's fine to use
platform:/resource/<project>/<path> consistently or to use
file:/<wherever>/<project>/<path> consistently because then relative
paths will be the same regardless of whether you open the resource with
a platform:/resource/* URI or a file:/<wherever>/* URI.
--------------030609040505050005050304
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">
Tom,<br>
<br>
Comments below.<br>
<br>
Tom Brandenburg wrote:
<blockquote cite="mid:igjmmd$9ms$1@news.eclipse.org" type="cite">Hello
Ed and thanks a lot for your answer! :)
<br>
<br>
Well, dump.ecore is stored under:
<br>
C:\Eclipse\workspace\my.samples.xpand.codegen\src\my\samples \xpand\codegen\model\
<br>
</blockquote>
What's most relevant is what URI does its resource have and what URI
does the resource it's referring to have at the time you save it. What
you show above isn't even a URI, it's an OS-specific file path and
isn't relevant to answering your question. The relevant information
appears to be these URIs<br>
<blockquote>platform:/resource/codegen/model/dump.ecore<br >
platform:/resource/metamodel/metamodel/metamodel.ecore<br>
</blockquote>
With respect to those URIs, the relative path is correct. <br>
<br>
Why are the URIs not like this?<br>
<blockquote> platform:/resource/my.samples.xpand.codegen/src/my/samples/x pand/codegen/model/dump.ecore <br>
platform:/resource/my.othersamples.xpand.metamodel/src/my/ot hersamples/xpand/metamodel/metamodel/metamodel.ecore <br>
</blockquote>
<blockquote cite="mid:igjmmd$9ms$1@news.eclipse.org" type="cite"><br>
When metamodel.ecore is referenced with
...\..\metamodel\metamodel\metamodel.ecore than the resulting path would
be:
<br>
C:\Eclipse\workspace\my.samples.xpand.codegen\src\my\samples \xpand\metamodel\metamodel\metamodel.ecore,
right?
<br>
<br>
Although it should be:
<br>
C:\Eclipse\workspace\my.othersamples.xpand.metamodel
\src\my\othersamples\xpand\metamodel\metamodel\metamodel.eco re
<br>
<br>
So a proper reference in dump.ecore would be something like "
...\..\..\..\..\..\..\my.othersamples.xpand.metamodel\src\my \
othersamples\xpand\metamodel\metamodel\metamodel.ecore "
<br>
Otherwise Eclipse doesn't find the metamodel.ecore.
<br>
<br>
Am I right?
<br>
</blockquote>
No because what you're showing isn't even a URI. In particular \ is
not a segment separator in a URI. If you want to open resources in the
workspace you need to ensure that you save them using the URIs that
will be used when they're in the workspace (or at the very least, that
are relatively the same). I.e., it's fine to use
platform:/resource/<project>/<path& gt; consistently or to use
<a class="moz-txt-link-freetext" href="file:/">file:/</a> <wherever>/<project>/<pat h> consistently
because then relative paths will be the same regardless of whether you
open the resource with a platform:/resource/* URI or a
<a class="moz-txt-link-freetext" href="file:/">file:/</a><wherever>/* URI. <br>
</body>
</html>
--------------030609040505050005050304--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Wrong schemaLocation in Ecore file when using URI maps [message #648357 is a reply to message #648349] |
Wed, 12 January 2011 15:29 |
Tom Brandenburg Messages: 58 Registered: October 2010 Location: Abstatt, Germany |
Member |
|
|
Ed Merks wrote on Wed, 12 January 2011 09:30 |
What's most relevant is what URI does its resource have and what URI
does the resource it's referring to have at the time you save it. What
you show above isn't even a URI, it's an OS-specific file path and isn't
relevant to answering your question. The relevant information appears
to be these URIs
platform:/resource/codegen/model/dump.ecore
platform:/resource/metamodel/metamodel/metamodel.ecore
With respect to those URIs, the relative path is correct.
Why are the URIs not like this?
platform:/resource/my.samples.xpand.codegen/src/my/samples/x pand/codegen/model/dump.ecore
platform:/resource/my.othersamples.xpand.metamodel/src/my/ot hersamples/xpand/metamodel/metamodel/metamodel.ecore
|
Ok, this looks like a good idea I'll give it a try, but logically seen, it should work I thought that when I use URI maps the from path is virtual and the to path physical. I thought that the workflow and its components just use the virtual paths, to make the platform-URIs work, but originally know where physical files are and reference everything according to it. But consequently it does not look like this
Thanks for your suggestion!
Ed Merks wrote on Wed, 12 January 2011 09:30 |
No because what you're showing isn't even a URI. In particular \ is not
a segment separator in a URI. If you want to open resources in the
workspace you need to ensure that you save them using the URIs that will
be used when they're in the workspace (or at the very least, that are
relatively the same). I.e., it's fine to use
platform:/resource/<project>/<path> consistently or to use
file:/<wherever>/<project>/<path> consistently because then relative
paths will be the same regardless of whether you open the resource with
a platform:/resource/* URI or a file:/<wherever>/* URI.
|
Ok!
I'll give it a try and will provide a feedback.
Thanks and bye
Tom
|
|
|
|
Powered by
FUDForum. Page generated in 0.04242 seconds