Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare]Comparing own model (Dynamic Emf)
[EMF Compare]Comparing own model (Dynamic Emf) [message #96633] Thu, 13 September 2007 00:12 Go to next message
Eclipse UserFriend
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 11:37 Go to previous messageGo to next message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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 15:11 Go to previous messageGo to next message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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 15:49 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #96708 is a reply to message #96692] Thu, 13 September 2007 21:53 Go to previous messageGo to next message
Eclipse UserFriend
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 21:58 Go to previous messageGo to next message
Eclipse UserFriend
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.&nbsp;
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">&lt;cedric.brun@obeo.fr&gt;</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&Atilde;&copy;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 22:02 Go to previous messageGo to next message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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 22:37 Go to previous messageGo to next message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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&nbsp; Ecore model will be saved in the
resource.&nbsp;&nbsp; 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">&lt;the_chris_2002@web.de&gt;</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">&lt;merks@ca.ibm.com&gt;</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
&lt;<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">&lt;http://www.devx.com/Java/Article/29093/0/page/1&gt;</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
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
ChrisW,&lt;br&gt;
&lt;br&gt;
Probably you should read some of the introductory material on the EMF
documentation page.&amp;nbsp;&amp;nbsp; &lt;br&gt;
&lt;blockquote&gt;&lt;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 "&gt;The
Eclipse Modeling Framework Overview&lt;/a&gt;&lt;br&gt;
&lt;/blockquote&gt;
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution.&amp;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.&amp;nbsp; This article
will probably help you understand the idea better:&lt;br&gt;
&lt;blockquote&gt;&lt;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>&gt;Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities&lt;/a&gt;&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;br&gt;
ChrisW wrote:
&lt;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"&gt;
&lt;pre wrap=""&gt;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
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

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 #96768 is a reply to message #96754] Thu, 13 September 2007 23:27 Go to previous message
Eclipse UserFriend
Originally posted by: the_chris_2002.web.de

Thanks for your help, now it is working currectly :)
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609707 is a reply to message #96633] Thu, 13 September 2007 11:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33132
Registered: July 2009
Senior Member
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.&nbsp;&nbsp; <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.&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="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--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609708 is a reply to message #96663] Thu, 13 September 2007 15:11 Go to previous message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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 15:49 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609710 is a reply to message #96692] Thu, 13 September 2007 21:53 Go to previous message
Eclipse UserFriend
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 21:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33132
Registered: July 2009
Senior Member
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.&nbsp;
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">&lt;cedric.brun@obeo.fr&gt;</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&Atilde;&copy;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--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609712 is a reply to message #96677] Thu, 13 September 2007 22:02 Go to previous message
Eclipse UserFriend
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.&nbsp;&nbsp; <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.&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="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 22:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33132
Registered: July 2009
Senior Member
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.&nbsp;&nbsp; <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.&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="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&nbsp; Ecore model will be saved in the
resource.&nbsp;&nbsp; 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">&lt;the_chris_2002@web.de&gt;</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">&lt;merks@ca.ibm.com&gt;</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
&lt;<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">&lt;http://www.devx.com/Java/Article/29093/0/page/1&gt;</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
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
ChrisW,&lt;br&gt;
&lt;br&gt;
Probably you should read some of the introductory material on the EMF
documentation page.&amp;nbsp;&amp;nbsp; &lt;br&gt;
&lt;blockquote&gt;&lt;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 "&gt;The
Eclipse Modeling Framework Overview&lt;/a&gt;&lt;br&gt;
&lt;/blockquote&gt;
I have a hard time imaging how mapping your data structure to an
instance of Ecore would really be a good solution.&amp;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.&amp;nbsp; This article
will probably help you understand the idea better:&lt;br&gt;
&lt;blockquote&gt;&lt;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>&gt;Discover the
Eclipse Modeling Framework (EMF) and Its Dynamic Capabilities&lt;/a&gt;&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;br&gt;
ChrisW wrote:
&lt;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"&gt;
&lt;pre wrap=""&gt;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
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------060600030307000503010203--

</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------050506020305070702090606--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF Compare]Comparing own model (Dynamic Emf) [message #609714 is a reply to message #96754] Thu, 13 September 2007 23:27 Go to previous message
Eclipse UserFriend
Originally posted by: the_chris_2002.web.de

Thanks for your help, now it is working currectly :)
Previous Topic:[CDO][0.8.0] Accessing more directly the data
Next Topic:[Search] Development Plan
Goto Forum:
  


Current Time: Sun Apr 14 00:44:50 GMT 2024

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

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

Back to the top