Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [EMF Compare]Comparing own model (Dynamic Emf)
[EMF Compare]Comparing own model (Dynamic Emf) [message #96633] |
Wed, 12 September 2007 20:12  |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
Hi,
i want to compare my own datastructure with EMF Compare. Therefore i`ve
written a converter which converts my own datastructure to an EObject. Here
is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no resource
binded to the EObject. I didnt find a way to add a resource to an EObject.
How do I do this? And a more important question is, will this work in the
end or do I have an fatal mistake in my logic?
regards,
ChrisW
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96663 is a reply to message #96633] |
Thu, 13 September 2007 07:37   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------060600030307000503010203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
ChrisW,
Probably you should read some of the introductory material on the EMF
documentation page.
The Eclipse Modeling Framework Overview
< http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org .eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF .html>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will probably
help you understand the idea better:
Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
ChrisW wrote:
> Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore i`ve
> written a converter which converts my own datastructure to an EObject. Here
> is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no resource
> binded to the EObject. I didnt find a way to add a resource to an EObject.
> How do I do this? And a more important question is, will this work in the
> end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
>
--------------060600030307000503010203
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
Probably you should read some of the introductory material on the EMF
documentation page. <br>
<blockquote><a
href=" http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org .eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF .html">The
Eclipse Modeling Framework Overview</a><br>
</blockquote>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will probably
help you understand the idea better:<br>
<blockquote><a target="_out"
href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
</blockquote>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore i`ve
written a converter which converts my own datastructure to an EObject. Here
is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no resource
binded to the EObject. I didnt find a way to add a resource to an EObject.
How do I do this? And a more important question is, will this work in the
end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<br>
</body>
</html>
--------------060600030307000503010203--
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96677 is a reply to message #96663] |
Thu, 13 September 2007 11:11   |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
Thanks Ed, I will read those immediately
Ed Merks <merks@ca.ibm.com> wrote in
news:fcb7bb$sck$1@build.eclipse.org:
> ChrisW,
>
> Probably you should read some of the introductory material on the EMF
> documentation page.
>
> The Eclipse Modeling Framework Overview
> <http://dev.eclipse.org/viewcvs/indextools.cgi/
*checkout*/org.eclip
> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>
> I have a hard time imaging how mapping your data structure to an
> instance of Ecore would really be a good solution. I think you'd want
> to create an Ecore metamodel of your data structure and then convert
> your data to an instance of that metamodel. This article will
> probably help you understand the idea better:
>
> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>
>
>
> ChrisW wrote:
>> Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------060600030307000503010203
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> ChrisW,<br>
> <br>
> Probably you should read some of the introductory material on the EMF
> documentation page. <br>
> <blockquote><a
> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
*checkout*/org.ecl
> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
> Eclipse Modeling Framework Overview</a><br>
> </blockquote>
> I have a hard time imaging how mapping your data structure to an
> instance of Ecore would really be a good solution. I think you'd
> want to create an Ecore metamodel of your data structure and then
> convert your data to an instance of that metamodel. This article
> will probably help you understand the idea better:<br>
> <blockquote><a target="_out"
> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
> </blockquote>
> <br>
> <br>
> ChrisW wrote:
> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
> <pre wrap="">Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore
> i`ve written a converter which converts my own datastructure to an
> EObject. Here is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no
> resource binded to the EObject. I didnt find a way to add a resource
> to an EObject. How do I do this? And a more important question is,
> will this work in the end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------060600030307000503010203--
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96692 is a reply to message #96633] |
Thu, 13 September 2007 11:49   |
Eclipse User |
|
|
|
Hi,
Concerning the resource issue we really need this information during the
comparison in order to handle references going to external models. Imagine
you've got an Ecore model with EType references going to the Ecore
metamodel, we need to know that EString or EInt are from the same model to
get a good comparison.
Once you got your eObject structure you only need to add these structure in
a Resource itself in a resourceset, you can create it in memory without
serializing it, it doesn't mater. It will probably look like the following
code :
final EObject model1 = xxx // create your model
final EObject model2 = xxx // create your model
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.createResource(URI.createURI("http:///model1")).getContents().add(model1);
resourceSet.createResource(URI.createURI("http:///model2")).getContents().add(model2);
// Creates the match then the diff model for those two models
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);
Then you get all the delta in the diff model.
Cheers,
Cédric
ChrisW wrote:
> Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore i`ve
> written a converter which converts my own datastructure to an EObject.
> Here is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no resource
> binded to the EObject. I didnt find a way to add a resource to an EObject.
> How do I do this? And a more important question is, will this work in the
> end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96708 is a reply to message #96692] |
Thu, 13 September 2007 17:53   |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
Hi,
first i want to thank for your help.
resourceSet.createResource(URI.createURI("http:///model1")).getContents
().add(model1);
leads to an NullPointerException [.getContents() returns null ]
=?UTF-8?B?Q8OpZHJpYw==?= Brun <cedric.brun@obeo.fr> wrote in
news:fcbm62$a5k$1@build.eclipse.org:
> Hi,
>
> Concerning the resource issue we really need this information during
> the comparison in order to handle references going to external models.
> Imagine you've got an Ecore model with EType references going to the
> Ecore metamodel, we need to know that EString or EInt are from the
> same model to get a good comparison.
>
> Once you got your eObject structure you only need to add these
> structure in a Resource itself in a resourceset, you can create it in
> memory without serializing it, it doesn't mater. It will probably
> look like the following code :
>
> final EObject model1 = xxx // create your model
> final EObject model2 = xxx // create your model
>
> final ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.createResource(URI.createURI
("http:///model1")).getContents
> ().add(model1);
> resourceSet.createResource(URI.createURI
("http:///model2")).getContents
> ().add(model2);
>
> // Creates the match then the diff model for those two models
> final MatchModel match = new
> DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you get all the delta in the diff model.
>
> Cheers,
>
> Cédric
>
> ChrisW wrote:
>
>> Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96722 is a reply to message #96708] |
Thu, 13 September 2007 17:58   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------070500090107030305070300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
ChrisW,
While createResource might return null because your don't have any
registered factory to handle this URI, getContents cannot return null.
Maybe you should use "http:///model1.xml", but you still need to be sure
a resource factory is registered to handle that extension...
ChrisW wrote:
> Hi,
>
> first i want to thank for your help.
>
> resourceSet.createResource(URI.createURI("http:///model1")).getContents
> ().add(model1);
>
> leads to an NullPointerException [.getContents() returns null ]
>
>
> =?UTF-8?B?Q8OpZHJpYw==?= Brun <cedric.brun@obeo.fr> wrote in
> news:fcbm62$a5k$1@build.eclipse.org:
>
>
>> Hi,
>>
>> Concerning the resource issue we really need this information during
>> the comparison in order to handle references going to external models.
>> Imagine you've got an Ecore model with EType references going to the
>> Ecore metamodel, we need to know that EString or EInt are from the
>> same model to get a good comparison.
>>
>> Once you got your eObject structure you only need to add these
>> structure in a Resource itself in a resourceset, you can create it in
>> memory without serializing it, it doesn't mater. It will probably
>> look like the following code :
>>
>> final EObject model1 = xxx // create your model
>> final EObject model2 = xxx // create your model
>>
>> final ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.createResource(URI.createURI
>>
> ("http:///model1")).getContents
>
>> ().add(model1);
>> resourceSet.createResource(URI.createURI
>>
> ("http:///model2")).getContents
>
>> ().add(model2);
>>
>> // Creates the match then the diff model for those two models
>> final MatchModel match = new
>> DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>> final DiffModel diff = new DiffMaker().doDiff(match);
>>
>> Then you get all the delta in the diff model.
>>
>> Cheers,
>>
>> Cédric
>>
>> ChrisW wrote:
>>
>>
>>> Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>>
>
>
--------------070500090107030305070300
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
While createResource might return null because your don't have any
registered factory to handle this URI, getContents cannot return null.
Maybe you should use <a class="moz-txt-link-rfc2396E" href="http:///model1.xml">"http:///model1.xml"</a>, but you still need to be
sure a resource factory is registered to handle that extension...<br>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fccbg8$44e$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
first i want to thank for your help.
resourceSet.createResource(URI.createURI(<a class="moz-txt-link-rfc2396E" href="http:///model1">"http:///model1"</a>)).getContents
().add(model1);
leads to an NullPointerException [.getContents() returns null ]
=?UTF-8?B?Q8OpZHJpYw==?= Brun <a class="moz-txt-link-rfc2396E" href="mailto:cedric.brun@obeo.fr"><cedric.brun@obeo.fr></a> wrote in
<a class="moz-txt-link-freetext" href="news:fcbm62$a5k$1@build.eclipse.org:">news:fcbm62$a5k$1@build.eclipse.org:</a>
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
Concerning the resource issue we really need this information during
the comparison in order to handle references going to external models.
Imagine you've got an Ecore model with EType references going to the
Ecore metamodel, we need to know that EString or EInt are from the
same model to get a good comparison.
Once you got your eObject structure you only need to add these
structure in a Resource itself in a resourceset, you can create it in
memory without serializing it, it doesn't mater. It will probably
look like the following code :
final EObject model1 = xxx // create your model
final EObject model2 = xxx // create your model
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.createResource(URI.createURI
</pre>
</blockquote>
<pre wrap=""><!---->(<a class="moz-txt-link-rfc2396E" href="http:///model1">"http:///model1"</a>)).getContents
</pre>
<blockquote type="cite">
<pre wrap="">().add(model1);
resourceSet.createResource(URI.createURI
</pre>
</blockquote>
<pre wrap=""><!---->(<a class="moz-txt-link-rfc2396E" href="http:///model2">"http:///model2"</a>)).getContents
</pre>
<blockquote type="cite">
<pre wrap="">().add(model2);
// Creates the match then the diff model for those two models
final MatchModel match = new
DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);
Then you get all the delta in the diff model.
Cheers,
Cédric
ChrisW wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------070500090107030305070300--
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96738 is a reply to message #96677] |
Thu, 13 September 2007 18:02   |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
So.. i ve read all those papers and i think i am on a good way. But now i
have a new problem:
Like here explained:
http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip
se.emf.doc/references/overview/EMF.html Section Saving and loading
resources
i save my resources. the saving is no problem, but if I want to edit the
resources in the "Sample Reflector Ecore Model Editor" i get this
exception: PackageNotFoundException: Package with uri
'http:///model.ecore' not found.
Then I edit the file via the TextEditor and replace http://... with
file://...model.ecore. Then i can look at the file and even can compare
them.
But how do i do this automatically? I`ve taken a look into the EMF Faq
(there is an entry concerning this exception) but it doesnt help me.
thanks and regards,
ChrisW
ChrisW <the_chris_2002@web.de> wrote in news:fcbjv8$t7o$1
@build.eclipse.org:
> Thanks Ed, I will read those immediately
>
> Ed Merks <merks@ca.ibm.com> wrote in
> news:fcb7bb$sck$1@build.eclipse.org:
>
>> ChrisW,
>>
>> Probably you should read some of the introductory material on the EMF
>> documentation page.
>>
>> The Eclipse Modeling Framework Overview
>> <http://dev.eclipse.org/viewcvs/indextools.cgi/
> *checkout*/org.eclip
>> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>>
>> I have a hard time imaging how mapping your data structure to an
>> instance of Ecore would really be a good solution. I think you'd want
>> to create an Ecore metamodel of your data structure and then convert
>> your data to an instance of that metamodel. This article will
>> probably help you understand the idea better:
>>
>> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
>> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>>
>>
>>
>> ChrisW wrote:
>>> Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>>
>>
>>
>> Attachment decoded: untitled-2.txt
>> --------------060600030307000503010203
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> ChrisW,<br>
>> <br>
>> Probably you should read some of the introductory material on the EMF
>> documentation page. <br>
>> <blockquote><a
>> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
> *checkout*/org.ecl
>> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
>> Eclipse Modeling Framework Overview</a><br>
>> </blockquote>
>> I have a hard time imaging how mapping your data structure to an
>> instance of Ecore would really be a good solution. I think you'd
>> want to create an Ecore metamodel of your data structure and then
>> convert your data to an instance of that metamodel. This article
>> will probably help you understand the idea better:<br>
>> <blockquote><a target="_out"
>> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
>> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
>> </blockquote>
>> <br>
>> <br>
>> ChrisW wrote:
>> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
>> <pre wrap="">Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------060600030307000503010203--
>>
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96754 is a reply to message #96738] |
Thu, 13 September 2007 18:37   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------050506020305070702090606
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
ChrisW,
You can use XMLResource.OPTION_SCHEMA_LOCATION as a save option so that
the physical location of your Ecore model will be saved in the
resource. It should have the URI of the resource containing your Ecore
model as the xsi:schemaLocation's physical location.
ChrisW wrote:
> So.. i ve read all those papers and i think i am on a good way. But now i
> have a new problem:
>
> Like here explained:
> http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip
> se.emf.doc/references/overview/EMF.html Section Saving and loading
> resources
>
> i save my resources. the saving is no problem, but if I want to edit the
> resources in the "Sample Reflector Ecore Model Editor" i get this
> exception: PackageNotFoundException: Package with uri
> 'http:///model.ecore' not found.
>
> Then I edit the file via the TextEditor and replace http://... with
> file://...model.ecore. Then i can look at the file and even can compare
> them.
>
> But how do i do this automatically? I`ve taken a look into the EMF Faq
> (there is an entry concerning this exception) but it doesnt help me.
>
> thanks and regards,
> ChrisW
>
>
> ChrisW <the_chris_2002@web.de> wrote in news:fcbjv8$t7o$1
> @build.eclipse.org:
>
>
>> Thanks Ed, I will read those immediately
>>
>> Ed Merks <merks@ca.ibm.com> wrote in
>> news:fcb7bb$sck$1@build.eclipse.org:
>>
>>
>>> ChrisW,
>>>
>>> Probably you should read some of the introductory material on the EMF
>>> documentation page.
>>>
>>> The Eclipse Modeling Framework Overview
>>> <http://dev.eclipse.org/viewcvs/indextools.cgi/
>>>
>> *checkout*/org.eclip
>>
>>> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>>>
>>> I have a hard time imaging how mapping your data structure to an
>>> instance of Ecore would really be a good solution. I think you'd want
>>> to create an Ecore metamodel of your data structure and then convert
>>> your data to an instance of that metamodel. This article will
>>> probably help you understand the idea better:
>>>
>>> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
>>> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>>>
>>>
>>>
>>> ChrisW wrote:
>>>
>>>> Hi,
>>>>
>>>> i want to compare my own datastructure with EMF Compare. Therefore
>>>> i`ve written a converter which converts my own datastructure to an
>>>> EObject. Here is a snippet:
>>>>
>>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>>> xdmPackage.setName(model.getRoot().getName());
>>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>>> pack.getESubpackages().add(firstChild);
>>>>
>>>> return pack;
>>>>
>>>> Then i call the matching engine.
>>>>
>>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>>> model2, new NullProgressMonitor());
>>>>
>>>> That will result in an NullpointerException, because their is no
>>>> resource binded to the EObject. I didnt find a way to add a resource
>>>> to an EObject. How do I do this? And a more important question is,
>>>> will this work in the end or do I have an fatal mistake in my logic?
>>>>
>>>> regards,
>>>> ChrisW
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------060600030307000503010203
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> ChrisW,<br>
>>> <br>
>>> Probably you should read some of the introductory material on the EMF
>>> documentation page. <br>
>>> <blockquote><a
>>> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
>>>
>> *checkout*/org.ecl
>>
>>> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
>>> Eclipse Modeling Framework Overview</a><br>
>>> </blockquote>
>>> I have a hard time imaging how mapping your data structure to an
>>> instance of Ecore would really be a good solution. I think you'd
>>> want to create an Ecore metamodel of your data structure and then
>>> convert your data to an instance of that metamodel. This article
>>> will probably help you understand the idea better:<br>
>>> <blockquote><a target="_out"
>>> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
>>> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
>>> </blockquote>
>>> <br>
>>> <br>
>>> ChrisW wrote:
>>> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
>>> <pre wrap="">Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------060600030307000503010203--
>>>
>>>
>
>
--------------050506020305070702090606
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
You can use XMLResource.OPTION_SCHEMA_LOCATION as a save option so that
the physical location of your Ecore model will be saved in the
resource. It should have the URI of the resource containing your
Ecore model as the xsi:schemaLocation's physical location.<br>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fccc2a$44e$2@build.eclipse.org" type="cite">
<pre wrap="">So.. i ve read all those papers and i think i am on a good way. But now i
have a new problem:
Like here explained:
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip"> http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip</a>
se.emf.doc/references/overview/EMF.html Section Saving and loading
resources
i save my resources. the saving is no problem, but if I want to edit the
resources in the "Sample Reflector Ecore Model Editor" i get this
exception: PackageNotFoundException: Package with uri
'<a class="moz-txt-link-freetext" href="http:///model.ecore">http:///model.ecore</a>' not found.
Then I edit the file via the TextEditor and replace <a class="moz-txt-link-freetext" href="http://">http://</a>... with
<a class="moz-txt-link-freetext" href="file://...model.ecore">file://...model.ecore</a>. Then i can look at the file and even can compare
them.
But how do i do this automatically? I`ve taken a look into the EMF Faq
(there is an entry concerning this exception) but it doesnt help me.
thanks and regards,
ChrisW
ChrisW <a class="moz-txt-link-rfc2396E" href="mailto:the_chris_2002@web.de"><the_chris_2002@web.de></a> wrote in <a class="moz-txt-link-freetext" href="news:fcbjv8$t7o$1">news:fcbjv8$t7o$1</a>
@build.eclipse.org:
</pre>
<blockquote type="cite">
<pre wrap="">Thanks Ed, I will read those immediately
Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote in
<a class="moz-txt-link-freetext" href="news:fcb7bb$sck$1@build.eclipse.org:">news:fcb7bb$sck$1@build.eclipse.org:</a>
</pre>
<blockquote type="cite">
<pre wrap="">ChrisW,
Probably you should read some of the introductory material on the EMF
documentation page.
The Eclipse Modeling Framework Overview
<<a class="moz-txt-link-freetext" href="http://dev.eclipse.org/viewcvs/indextools.cgi/">http://dev.eclipse.org/viewcvs/indextools.cgi/</a>
</pre>
</blockquote>
<pre wrap="">*checkout*/org.eclip
</pre>
<blockquote type="cite">
<pre wrap=""> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html& amp;gt;
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will
probably help you understand the idea better:
Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
Capabilities <a class="moz-txt-link-rfc2396E" href="http://www.devx.com/Java/Article/29093/0/page/1"><http://www.devx.com/Java/Article/29093/0/page/1></a>
ChrisW wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------060600030307000503010203
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
Probably you should read some of the introductory material on the EMF
documentation page.&nbsp;&nbsp; <br>
<blockquote><a
href="<a class="moz-txt-link-freetext" href="http://dev.eclipse.org/viewcvs/indextools.cgi/">http://dev.eclipse.org/viewcvs/indextools.cgi/</a>
</pre>
</blockquote>
<pre wrap="">*checkout*/org.ecl
</pre>
<blockquote type="cite">
<pre wrap=""> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
Eclipse Modeling Framework Overview</a><br>
</blockquote>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution.&nbsp; I think you'd
want to create an Ecore metamodel of your data structure and then
convert your data to an instance of that metamodel.&nbsp; This article
will probably help you understand the idea better:<br>
<blockquote><a target="_out"
href=<a class="moz-txt-link-rfc2396E" href="http://www.devx.com/Java/Article/29093/0/page/1">"http://www.devx.com/Java/Article/29093/0/page/1"</a>>Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
</blockquote>
<br>
<br>
ChrisW wrote:
<blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:mid:fc9v9h$gv7$1@build.eclipse.org">"mid:fc9v9h$gv7$1@build.eclipse.org"</a> type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<br>
</body>
</html>
Attachment decoded: untitled-3.htm
--------------060600030307000503010203--
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------050506020305070702090606--
|
|
| |
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609707 is a reply to message #96633] |
Thu, 13 September 2007 07:37  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060600030307000503010203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
ChrisW,
Probably you should read some of the introductory material on the EMF
documentation page.
The Eclipse Modeling Framework Overview
< http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org .eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF .html>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will probably
help you understand the idea better:
Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
ChrisW wrote:
> Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore i`ve
> written a converter which converts my own datastructure to an EObject. Here
> is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no resource
> binded to the EObject. I didnt find a way to add a resource to an EObject.
> How do I do this? And a more important question is, will this work in the
> end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
>
--------------060600030307000503010203
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
Probably you should read some of the introductory material on the EMF
documentation page. <br>
<blockquote><a
href=" http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org .eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF .html">The
Eclipse Modeling Framework Overview</a><br>
</blockquote>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will probably
help you understand the idea better:<br>
<blockquote><a target="_out"
href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
</blockquote>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore i`ve
written a converter which converts my own datastructure to an EObject. Here
is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no resource
binded to the EObject. I didnt find a way to add a resource to an EObject.
How do I do this? And a more important question is, will this work in the
end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<br>
</body>
</html>
--------------060600030307000503010203--
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609708 is a reply to message #96663] |
Thu, 13 September 2007 11:11  |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
Thanks Ed, I will read those immediately
Ed Merks <merks@ca.ibm.com> wrote in
news:fcb7bb$sck$1@build.eclipse.org:
> ChrisW,
>
> Probably you should read some of the introductory material on the EMF
> documentation page.
>
> The Eclipse Modeling Framework Overview
> <http://dev.eclipse.org/viewcvs/indextools.cgi/
*checkout*/org.eclip
> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>
> I have a hard time imaging how mapping your data structure to an
> instance of Ecore would really be a good solution. I think you'd want
> to create an Ecore metamodel of your data structure and then convert
> your data to an instance of that metamodel. This article will
> probably help you understand the idea better:
>
> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>
>
>
> ChrisW wrote:
>> Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------060600030307000503010203
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> ChrisW,<br>
> <br>
> Probably you should read some of the introductory material on the EMF
> documentation page. <br>
> <blockquote><a
> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
*checkout*/org.ecl
> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
> Eclipse Modeling Framework Overview</a><br>
> </blockquote>
> I have a hard time imaging how mapping your data structure to an
> instance of Ecore would really be a good solution. I think you'd
> want to create an Ecore metamodel of your data structure and then
> convert your data to an instance of that metamodel. This article
> will probably help you understand the idea better:<br>
> <blockquote><a target="_out"
> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
> </blockquote>
> <br>
> <br>
> ChrisW wrote:
> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
> <pre wrap="">Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore
> i`ve written a converter which converts my own datastructure to an
> EObject. Here is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no
> resource binded to the EObject. I didnt find a way to add a resource
> to an EObject. How do I do this? And a more important question is,
> will this work in the end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------060600030307000503010203--
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609709 is a reply to message #96633] |
Thu, 13 September 2007 11:49  |
Eclipse User |
|
|
|
Hi,
Concerning the resource issue we really need this information during the
comparison in order to handle references going to external models. Imagine
you've got an Ecore model with EType references going to the Ecore
metamodel, we need to know that EString or EInt are from the same model to
get a good comparison.
Once you got your eObject structure you only need to add these structure in
a Resource itself in a resourceset, you can create it in memory without
serializing it, it doesn't mater. It will probably look like the following
code :
final EObject model1 = xxx // create your model
final EObject model2 = xxx // create your model
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.createResource(URI.createURI("http:///model1")).getContents().add(model1);
resourceSet.createResource(URI.createURI("http:///model2")).getContents().add(model2);
// Creates the match then the diff model for those two models
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);
Then you get all the delta in the diff model.
Cheers,
Cédric
ChrisW wrote:
> Hi,
>
> i want to compare my own datastructure with EMF Compare. Therefore i`ve
> written a converter which converts my own datastructure to an EObject.
> Here is a snippet:
>
> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> xdmPackage.setName(model.getRoot().getName());
> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
> firstChild.setName(model.getRoot().getfirstChild().getName() );
> pack.getESubpackages().add(firstChild);
>
> return pack;
>
> Then i call the matching engine.
>
> final MatchModel match = new DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
>
> That will result in an NullpointerException, because their is no resource
> binded to the EObject. I didnt find a way to add a resource to an EObject.
> How do I do this? And a more important question is, will this work in the
> end or do I have an fatal mistake in my logic?
>
> regards,
> ChrisW
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609710 is a reply to message #96692] |
Thu, 13 September 2007 17:53  |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
Hi,
first i want to thank for your help.
resourceSet.createResource(URI.createURI("http:///model1")).getContents
().add(model1);
leads to an NullPointerException [.getContents() returns null ]
=?UTF-8?B?Q8OpZHJpYw==?= Brun <cedric.brun@obeo.fr> wrote in
news:fcbm62$a5k$1@build.eclipse.org:
> Hi,
>
> Concerning the resource issue we really need this information during
> the comparison in order to handle references going to external models.
> Imagine you've got an Ecore model with EType references going to the
> Ecore metamodel, we need to know that EString or EInt are from the
> same model to get a good comparison.
>
> Once you got your eObject structure you only need to add these
> structure in a Resource itself in a resourceset, you can create it in
> memory without serializing it, it doesn't mater. It will probably
> look like the following code :
>
> final EObject model1 = xxx // create your model
> final EObject model2 = xxx // create your model
>
> final ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.createResource(URI.createURI
("http:///model1")).getContents
> ().add(model1);
> resourceSet.createResource(URI.createURI
("http:///model2")).getContents
> ().add(model2);
>
> // Creates the match then the diff model for those two models
> final MatchModel match = new
> DifferencesServices().modelMatch(model1,
> model2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you get all the delta in the diff model.
>
> Cheers,
>
> Cédric
>
> ChrisW wrote:
>
>> Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609711 is a reply to message #96708] |
Thu, 13 September 2007 17:58  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------070500090107030305070300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
ChrisW,
While createResource might return null because your don't have any
registered factory to handle this URI, getContents cannot return null.
Maybe you should use "http:///model1.xml", but you still need to be sure
a resource factory is registered to handle that extension...
ChrisW wrote:
> Hi,
>
> first i want to thank for your help.
>
> resourceSet.createResource(URI.createURI("http:///model1")).getContents
> ().add(model1);
>
> leads to an NullPointerException [.getContents() returns null ]
>
>
> =?UTF-8?B?Q8OpZHJpYw==?= Brun <cedric.brun@obeo.fr> wrote in
> news:fcbm62$a5k$1@build.eclipse.org:
>
>
>> Hi,
>>
>> Concerning the resource issue we really need this information during
>> the comparison in order to handle references going to external models.
>> Imagine you've got an Ecore model with EType references going to the
>> Ecore metamodel, we need to know that EString or EInt are from the
>> same model to get a good comparison.
>>
>> Once you got your eObject structure you only need to add these
>> structure in a Resource itself in a resourceset, you can create it in
>> memory without serializing it, it doesn't mater. It will probably
>> look like the following code :
>>
>> final EObject model1 = xxx // create your model
>> final EObject model2 = xxx // create your model
>>
>> final ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.createResource(URI.createURI
>>
> ("http:///model1")).getContents
>
>> ().add(model1);
>> resourceSet.createResource(URI.createURI
>>
> ("http:///model2")).getContents
>
>> ().add(model2);
>>
>> // Creates the match then the diff model for those two models
>> final MatchModel match = new
>> DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>> final DiffModel diff = new DiffMaker().doDiff(match);
>>
>> Then you get all the delta in the diff model.
>>
>> Cheers,
>>
>> Cédric
>>
>> ChrisW wrote:
>>
>>
>>> Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>>
>
>
--------------070500090107030305070300
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
While createResource might return null because your don't have any
registered factory to handle this URI, getContents cannot return null.
Maybe you should use <a class="moz-txt-link-rfc2396E" href="http:///model1.xml">"http:///model1.xml"</a>, but you still need to be
sure a resource factory is registered to handle that extension...<br>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fccbg8$44e$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
first i want to thank for your help.
resourceSet.createResource(URI.createURI(<a class="moz-txt-link-rfc2396E" href="http:///model1">"http:///model1"</a>)).getContents
().add(model1);
leads to an NullPointerException [.getContents() returns null ]
=?UTF-8?B?Q8OpZHJpYw==?= Brun <a class="moz-txt-link-rfc2396E" href="mailto:cedric.brun@obeo.fr"><cedric.brun@obeo.fr></a> wrote in
<a class="moz-txt-link-freetext" href="news:fcbm62$a5k$1@build.eclipse.org:">news:fcbm62$a5k$1@build.eclipse.org:</a>
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
Concerning the resource issue we really need this information during
the comparison in order to handle references going to external models.
Imagine you've got an Ecore model with EType references going to the
Ecore metamodel, we need to know that EString or EInt are from the
same model to get a good comparison.
Once you got your eObject structure you only need to add these
structure in a Resource itself in a resourceset, you can create it in
memory without serializing it, it doesn't mater. It will probably
look like the following code :
final EObject model1 = xxx // create your model
final EObject model2 = xxx // create your model
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.createResource(URI.createURI
</pre>
</blockquote>
<pre wrap=""><!---->(<a class="moz-txt-link-rfc2396E" href="http:///model1">"http:///model1"</a>)).getContents
</pre>
<blockquote type="cite">
<pre wrap="">().add(model1);
resourceSet.createResource(URI.createURI
</pre>
</blockquote>
<pre wrap=""><!---->(<a class="moz-txt-link-rfc2396E" href="http:///model2">"http:///model2"</a>)).getContents
</pre>
<blockquote type="cite">
<pre wrap="">().add(model2);
// Creates the match then the diff model for those two models
final MatchModel match = new
DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);
Then you get all the delta in the diff model.
Cheers,
Cédric
ChrisW wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------070500090107030305070300--
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609712 is a reply to message #96677] |
Thu, 13 September 2007 18:02  |
Eclipse User |
|
|
|
Originally posted by: the_chris_2002.web.de
So.. i ve read all those papers and i think i am on a good way. But now i
have a new problem:
Like here explained:
http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip
se.emf.doc/references/overview/EMF.html Section Saving and loading
resources
i save my resources. the saving is no problem, but if I want to edit the
resources in the "Sample Reflector Ecore Model Editor" i get this
exception: PackageNotFoundException: Package with uri
'http:///model.ecore' not found.
Then I edit the file via the TextEditor and replace http://.. with
file://...model.ecore Then i can look at the file and even can compare
them.
But how do i do this automatically? I`ve taken a look into the EMF Faq
(there is an entry concerning this exception) but it doesnt help me.
thanks and regards,
ChrisW
ChrisW <the_chris_2002@web.de> wrote in news:fcbjv8$t7o$1
@build.eclipse.org:
> Thanks Ed, I will read those immediately
>
> Ed Merks <merks@ca.ibm.com> wrote in
> news:fcb7bb$sck$1@build.eclipse.org:
>
>> ChrisW,
>>
>> Probably you should read some of the introductory material on the EMF
>> documentation page.
>>
>> The Eclipse Modeling Framework Overview
>> <http://dev.eclipse.org/viewcvs/indextools.cgi/
> *checkout*/org.eclip
>> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>>
>> I have a hard time imaging how mapping your data structure to an
>> instance of Ecore would really be a good solution. I think you'd want
>> to create an Ecore metamodel of your data structure and then convert
>> your data to an instance of that metamodel. This article will
>> probably help you understand the idea better:
>>
>> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
>> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>>
>>
>>
>> ChrisW wrote:
>>> Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>>
>>
>>
>> Attachment decoded: untitled-2.txt
>> --------------060600030307000503010203
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> ChrisW,<br>
>> <br>
>> Probably you should read some of the introductory material on the EMF
>> documentation page. <br>
>> <blockquote><a
>> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
> *checkout*/org.ecl
>> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
>> Eclipse Modeling Framework Overview</a><br>
>> </blockquote>
>> I have a hard time imaging how mapping your data structure to an
>> instance of Ecore would really be a good solution. I think you'd
>> want to create an Ecore metamodel of your data structure and then
>> convert your data to an instance of that metamodel. This article
>> will probably help you understand the idea better:<br>
>> <blockquote><a target="_out"
>> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
>> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
>> </blockquote>
>> <br>
>> <br>
>> ChrisW wrote:
>> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
>> <pre wrap="">Hi,
>>
>> i want to compare my own datastructure with EMF Compare. Therefore
>> i`ve written a converter which converts my own datastructure to an
>> EObject. Here is a snippet:
>>
>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>> xdmPackage.setName(model.getRoot().getName());
>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>> pack.getESubpackages().add(firstChild);
>>
>> return pack;
>>
>> Then i call the matching engine.
>>
>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>> model2, new NullProgressMonitor());
>>
>> That will result in an NullpointerException, because their is no
>> resource binded to the EObject. I didnt find a way to add a resource
>> to an EObject. How do I do this? And a more important question is,
>> will this work in the end or do I have an fatal mistake in my logic?
>>
>> regards,
>> ChrisW
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------060600030307000503010203--
>>
>
|
|
|
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609713 is a reply to message #96738] |
Thu, 13 September 2007 18:37  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------050506020305070702090606
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
ChrisW,
You can use XMLResource.OPTION_SCHEMA_LOCATION as a save option so that
the physical location of your Ecore model will be saved in the
resource. It should have the URI of the resource containing your Ecore
model as the xsi:schemaLocation's physical location.
ChrisW wrote:
> So.. i ve read all those papers and i think i am on a good way. But now i
> have a new problem:
>
> Like here explained:
> http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip
> se.emf.doc/references/overview/EMF.html Section Saving and loading
> resources
>
> i save my resources. the saving is no problem, but if I want to edit the
> resources in the "Sample Reflector Ecore Model Editor" i get this
> exception: PackageNotFoundException: Package with uri
> 'http:///model.ecore' not found.
>
> Then I edit the file via the TextEditor and replace http://.. with
> file://...model.ecore Then i can look at the file and even can compare
> them.
>
> But how do i do this automatically? I`ve taken a look into the EMF Faq
> (there is an entry concerning this exception) but it doesnt help me.
>
> thanks and regards,
> ChrisW
>
>
> ChrisW <the_chris_2002@web.de> wrote in news:fcbjv8$t7o$1
> @build.eclipse.org:
>
>
>> Thanks Ed, I will read those immediately
>>
>> Ed Merks <merks@ca.ibm.com> wrote in
>> news:fcb7bb$sck$1@build.eclipse.org:
>>
>>
>>> ChrisW,
>>>
>>> Probably you should read some of the introductory material on the EMF
>>> documentation page.
>>>
>>> The Eclipse Modeling Framework Overview
>>> <http://dev.eclipse.org/viewcvs/indextools.cgi/
>>>
>> *checkout*/org.eclip
>>
>>> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html>
>>>
>>> I have a hard time imaging how mapping your data structure to an
>>> instance of Ecore would really be a good solution. I think you'd want
>>> to create an Ecore metamodel of your data structure and then convert
>>> your data to an instance of that metamodel. This article will
>>> probably help you understand the idea better:
>>>
>>> Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
>>> Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>
>>>
>>>
>>>
>>> ChrisW wrote:
>>>
>>>> Hi,
>>>>
>>>> i want to compare my own datastructure with EMF Compare. Therefore
>>>> i`ve written a converter which converts my own datastructure to an
>>>> EObject. Here is a snippet:
>>>>
>>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>>> xdmPackage.setName(model.getRoot().getName());
>>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>>> pack.getESubpackages().add(firstChild);
>>>>
>>>> return pack;
>>>>
>>>> Then i call the matching engine.
>>>>
>>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>>> model2, new NullProgressMonitor());
>>>>
>>>> That will result in an NullpointerException, because their is no
>>>> resource binded to the EObject. I didnt find a way to add a resource
>>>> to an EObject. How do I do this? And a more important question is,
>>>> will this work in the end or do I have an fatal mistake in my logic?
>>>>
>>>> regards,
>>>> ChrisW
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------060600030307000503010203
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> ChrisW,<br>
>>> <br>
>>> Probably you should read some of the introductory material on the EMF
>>> documentation page. <br>
>>> <blockquote><a
>>> href="http://dev.eclipse.org/viewcvs/indextools.cgi/
>>>
>> *checkout*/org.ecl
>>
>>> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
>>> Eclipse Modeling Framework Overview</a><br>
>>> </blockquote>
>>> I have a hard time imaging how mapping your data structure to an
>>> instance of Ecore would really be a good solution. I think you'd
>>> want to create an Ecore metamodel of your data structure and then
>>> convert your data to an instance of that metamodel. This article
>>> will probably help you understand the idea better:<br>
>>> <blockquote><a target="_out"
>>> href="http://www.devx.com/Java/Article/29093/0/page/1">Discover the
>>> Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
>>> </blockquote>
>>> <br>
>>> <br>
>>> ChrisW wrote:
>>> <blockquote cite="mid:fc9v9h$gv7$1@build.eclipse.org" type="cite">
>>> <pre wrap="">Hi,
>>>
>>> i want to compare my own datastructure with EMF Compare. Therefore
>>> i`ve written a converter which converts my own datastructure to an
>>> EObject. Here is a snippet:
>>>
>>> EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
>>> xdmPackage.setName(model.getRoot().getName());
>>> EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
>>> firstChild.setName(model.getRoot().getfirstChild().getName() );
>>> pack.getESubpackages().add(firstChild);
>>>
>>> return pack;
>>>
>>> Then i call the matching engine.
>>>
>>> final MatchModel match = new DifferencesServices().modelMatch(model1,
>>> model2, new NullProgressMonitor());
>>>
>>> That will result in an NullpointerException, because their is no
>>> resource binded to the EObject. I didnt find a way to add a resource
>>> to an EObject. How do I do this? And a more important question is,
>>> will this work in the end or do I have an fatal mistake in my logic?
>>>
>>> regards,
>>> ChrisW
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------060600030307000503010203--
>>>
>>>
>
>
--------------050506020305070702090606
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
You can use XMLResource.OPTION_SCHEMA_LOCATION as a save option so that
the physical location of your Ecore model will be saved in the
resource. It should have the URI of the resource containing your
Ecore model as the xsi:schemaLocation's physical location.<br>
<br>
<br>
ChrisW wrote:
<blockquote cite="mid:fccc2a$44e$2@build.eclipse.org" type="cite">
<pre wrap="">So.. i ve read all those papers and i think i am on a good way. But now i
have a new problem:
Like here explained:
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip"> http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.em f/doc/org.eclip</a>
se.emf.doc/references/overview/EMF.html Section Saving and loading
resources
i save my resources. the saving is no problem, but if I want to edit the
resources in the "Sample Reflector Ecore Model Editor" i get this
exception: PackageNotFoundException: Package with uri
'<a class="moz-txt-link-freetext" href="http:///model.ecore">http:///model.ecore</a>' not found.
Then I edit the file via the TextEditor and replace <a class="moz-txt-link-freetext" href="http://">http://</a>... with
<a class="moz-txt-link-freetext" href="file://...model.ecore">file://...model.ecore</a>. Then i can look at the file and even can compare
them.
But how do i do this automatically? I`ve taken a look into the EMF Faq
(there is an entry concerning this exception) but it doesnt help me.
thanks and regards,
ChrisW
ChrisW <a class="moz-txt-link-rfc2396E" href="mailto:the_chris_2002@web.de"><the_chris_2002@web.de></a> wrote in <a class="moz-txt-link-freetext" href="news:fcbjv8$t7o$1">news:fcbjv8$t7o$1</a>
@build.eclipse.org:
</pre>
<blockquote type="cite">
<pre wrap="">Thanks Ed, I will read those immediately
Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote in
<a class="moz-txt-link-freetext" href="news:fcb7bb$sck$1@build.eclipse.org:">news:fcb7bb$sck$1@build.eclipse.org:</a>
</pre>
<blockquote type="cite">
<pre wrap="">ChrisW,
Probably you should read some of the introductory material on the EMF
documentation page.
The Eclipse Modeling Framework Overview
<<a class="moz-txt-link-freetext" href="http://dev.eclipse.org/viewcvs/indextools.cgi/">http://dev.eclipse.org/viewcvs/indextools.cgi/</a>
</pre>
</blockquote>
<pre wrap="">*checkout*/org.eclip
</pre>
<blockquote type="cite">
<pre wrap=""> se.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html& amp;gt;
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution. I think you'd want
to create an Ecore metamodel of your data structure and then convert
your data to an instance of that metamodel. This article will
probably help you understand the idea better:
Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
Capabilities <a class="moz-txt-link-rfc2396E" href="http://www.devx.com/Java/Article/29093/0/page/1"><http://www.devx.com/Java/Article/29093/0/page/1></a>
ChrisW wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------060600030307000503010203
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ChrisW,<br>
<br>
Probably you should read some of the introductory material on the EMF
documentation page.&nbsp;&nbsp; <br>
<blockquote><a
href="<a class="moz-txt-link-freetext" href="http://dev.eclipse.org/viewcvs/indextools.cgi/">http://dev.eclipse.org/viewcvs/indextools.cgi/</a>
</pre>
</blockquote>
<pre wrap="">*checkout*/org.ecl
</pre>
<blockquote type="cite">
<pre wrap=""> ipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.htm l ">The
Eclipse Modeling Framework Overview</a><br>
</blockquote>
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution.&nbsp; I think you'd
want to create an Ecore metamodel of your data structure and then
convert your data to an instance of that metamodel.&nbsp; This article
will probably help you understand the idea better:<br>
<blockquote><a target="_out"
href=<a class="moz-txt-link-rfc2396E" href="http://www.devx.com/Java/Article/29093/0/page/1">"http://www.devx.com/Java/Article/29093/0/page/1"</a>>Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities</a><br>
</blockquote>
<br>
<br>
ChrisW wrote:
<blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:mid:fc9v9h$gv7$1@build.eclipse.org">"mid:fc9v9h$gv7$1@build.eclipse.org"</a> type="cite">
<pre wrap="">Hi,
i want to compare my own datastructure with EMF Compare. Therefore
i`ve written a converter which converts my own datastructure to an
EObject. Here is a snippet:
EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
xdmPackage.setName(model.getRoot().getName());
EPackage firstChild = EcoreFactory.eINSTANCE.createEPackage();
firstChild.setName(model.getRoot().getfirstChild().getName() );
pack.getESubpackages().add(firstChild);
return pack;
Then i call the matching engine.
final MatchModel match = new DifferencesServices().modelMatch(model1,
model2, new NullProgressMonitor());
That will result in an NullpointerException, because their is no
resource binded to the EObject. I didnt find a way to add a resource
to an EObject. How do I do this? And a more important question is,
will this work in the end or do I have an fatal mistake in my logic?
regards,
ChrisW
</pre>
</blockquote>
<br>
</body>
</html>
Attachment decoded: untitled-3.htm
--------------060600030307000503010203--
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------050506020305070702090606--
|
|
| |
Goto Forum:
Current Time: Wed May 07 10:45:35 EDT 2025
Powered by FUDForum. Page generated in 0.05295 seconds
|