Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Merge EMF (UML) Models
Merge EMF (UML) Models [message #129230] Mon, 01 September 2008 07:53 Go to next message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Hello,

I wanted to reply to
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg04924.html
but it was impossible (archived post), that's why I write this new post.

According to the code posted in this last URL, I could merge two EMF
models. The fact is that I have few problems using this code.

Here is mine : (that's the same as the one in the other post, except the
URI models)

import java.io.File;
import java.util.Collections;

import org.eclipse.emf.compare.diff.merge.service.MergeService;
import org.eclipse.emf.compare.diff.metamodel.DiffModel;
import org.eclipse.emf.compare.diff.service.DiffService;
import org.eclipse.emf.compare.match.metamodel.MatchModel;
import org.eclipse.emf.compare.match.service.MatchService;
import org.eclipse.emf.compare.util.ModelUtils;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.common.util.URI;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			final ResourceSet modelResourceSet = new ResourceSetImpl();

			Resource model1 = ModelUtils
					.load(
							URI
									.createFileURI("D:/eclipse/workspace/com.odyssee.service/model/service.uml"),
							modelResourceSet).eResource();
			Resource model2 = ModelUtils
					.load(
							new java.io.File(
									"D:/BAV3/workspace/com.odyssee.calcul/model/calcul.uml"),
							modelResourceSet).eResource();
			// Matches elements of the two models
			final MatchModel match = MatchService.doResourceMatch(model1,
					model2, null);
			// Detects differences
			final DiffModel diff = DiffService.doDiff(match);
			// Merges all differences from model1 to model2
			MergeService.merge(diff.getOwnedElements(), true);
		} catch (Exception exception) {
			exception.printStackTrace();
		}
	}

}


Here is the error I get when launching the application:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/emf/ecore/xmi/impl/XMIResourceFactoryImpl
at
org.eclipse.emf.compare.util.ModelUtils.createResource(Model Utils.java:121)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :319)
at Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException:
org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 3 more

--> When I debug, the problem occurs on the loading of model1 : "Resource
model1 = ModelUtils.load( ..."

My questions are:
1. Why using "URI.createFileURI" for model1 ? My two models already
exists, and I just want if possible to create another one to get the
merging of my two models
2. is there is a problem of merging *.uml models (with the same metamodel
UML2) instead of *.ecore, like in the URL posted at the top of this post ?

And if you have any ideas to help solving my problem, everything is
welcomed !

Regards,

Pierre
Re: Merge EMF (UML) Models [message #129246 is a reply to message #129230] Mon, 01 September 2008 11:17 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090203060308000202090107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Pierre,

This exception means you haven't got the jar org.eclipse.emf.ecore.xmi
which is needed by EMF Compare. You need to put this dependency in your
classpath.

As for 'createFileURI', we use it in order to convert the location of
the model to a 'file:' scheme URI.

Cheers,

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #129258 is a reply to message #129246] Mon, 01 September 2008 15:09 Go to previous messageGo to next message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks a lot for your support Laurent.

Now I can launch my application with you answer, but I get an exception :

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:/D:/------/model/------.uml, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLL oadImpl.java:83)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:191)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1210)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
at Main.main(Main.java:26)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:/D:/------/model/------.uml, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2565)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
... 6 more

Apparently caused by the metamodel of my UML2 models... How can I load or
precise this UML2 resource ?

Regards,

Pierre
Re: Merge EMF (UML) Models [message #129270 is a reply to message #129258] Mon, 01 September 2008 16:16 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080600020801060601080105
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Pierre,

You need to :
1) Add all the dependencies needed from UML2

And if you are running this code standalone (not as an eclipse plugin)
2) Register the UML package against in the package registry (see
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.compare/examples/org.eclipse.emf.compare.exampl es.standalone/?root=Modeling_Project
for a standalone example)

If not in the registry, you can also register the UML package in the
resourceSet you load the models in through code such as :
ResourceSet resourceSet = new ResourceSetImpl();
UMLPackage umlPackage = UMLPackage.eINSTANCE;
resourceSet.getPackageRegistry().put(umlPackage.getNsURI(),
umlPackage);

Cheers

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #129296 is a reply to message #129270] Tue, 02 September 2008 08:35 Go to previous messageGo to next message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks for your support Laurent.

But I don't really understand what you mean when saying "Add all the
dependencies needed from UML2" : where I have to precise these
dependencies ? In my java code ?
And as I'm running my code in standalone, I have to register UML
Package... But in the following code, UMLPackage & UMLResource are not
recognised :

// Register additionnal packages here. For UML2 for instance :
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);

I did not find any package to import where I can get these interfaces.

Regards,

Pierre
Re: Merge EMF (UML) Models [message #129309 is a reply to message #129296] Tue, 02 September 2008 09:28 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040005090905070907030809
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Pierre,

Since you're running standalone, you could take a look at the sample we
provide on the CVS at
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.compare/examples/org.eclipse.emf.compare.exampl es.standalone/?root=Modeling_Project
for an example.

The dependencies to UML2 need to be added in the classpath as you did
earlier for the jar org.eclipse.emf.ecore.xmi. IIRC, the needed jars for
UML2 were
- org.eclipse.uml2.common
- org.eclipse.uml2.uml
- org.eclipse.uml2.uml.resources

Regard,

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #129377 is a reply to message #129309] Tue, 02 September 2008 13:58 Go to previous messageGo to next message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks again Laurent.

I can now start loading my models, but I get a nullPointerException..
According to this code (I saw the sample on CVS) :

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;

import org.eclipse.emf.compare.diff.merge.service.MergeService;
import org.eclipse.emf.compare.diff.metamodel.DiffElement;
import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
import org.eclipse.emf.compare.diff.metamodel.DiffModel;
import org.eclipse.emf.compare.diff.metamodel.ModelInputSnapshot;
import org.eclipse.emf.compare.diff.service.DiffService;
import org.eclipse.emf.compare.match.metamodel.MatchModel;
import org.eclipse.emf.compare.match.service.MatchService;
import org.eclipse.emf.compare.util.ModelUtils;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;

public final class ExampleLauncher {
	/**
	 * This class doesn't need to be instantiated.
	 */
	private ExampleLauncher() {
		// prevents instantiation
	}

	public static void main(String[] args) {
		// Creates the resourceSet where we'll load the models
		final ResourceSet resourceSet = new ResourceSetImpl();

		// Register additional packages here. For UML2:
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
				UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
		resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
				UMLPackage.eINSTANCE);

		try {
			System.out.println("Loading resources.\n"); //$NON-NLS-1$
			// Loads the model to modify
			final EObject model1 = ModelUtils
					.load(
							new File(
									"D:/eclipse/workspace/EMFTEST/model/model.uml"),
							resourceSet);
			
			System.out.println("Loaded.");
		} catch (Exception e) { // shouldn't be thrown
			e.printStackTrace();
		}
	}
}


I got this exception :

Loading resources.

java.lang.NullPointerException
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFe atureType(XMLHandler.java:2132)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2010)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHa ndler.java:131)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1789)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1013)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1210)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
at ExampleLauncher.main(ExampleLauncher.java:68)

Which means that my model does not load... But it really exists on my file
system... Any ideas ? :s

Thanks for your support.

Cheers,

P.
Re: Merge EMF (UML) Models [message #129390 is a reply to message #129377] Tue, 02 September 2008 14:15 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060700030007080804040903
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Pierre,

Well that's one I do not understand :(. Can your model be loaded within
Eclipse in the ecore editor? I'd expect it not to be valid and EMF
Compare relies on EMF for the model loading so we need it to be a
loadable model. If it can be loaded in the sample ecore editor ... well
I hope Ed will jump in and save the day!

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #129403 is a reply to message #129390] Tue, 02 September 2008 14:38 Go to previous messageGo to next message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
My models were exported via Magic Draw in "EMF UML2 (v2.x) XMI" and all
can be viewed in UML Model Editor. But no one can be loaded via the java
code I wrote in my last post...
Re: Merge EMF (UML) Models [message #129416 is a reply to message #129403] Tue, 02 September 2008 14:55 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080608070503060405000604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Ha, a possible cause would then be the UML version. Within eclipse an
"in-place" transformation from UML2 to UML2.1 takes place so that the
loaded model is conform to the new meta-model. I don't really know how
to trigger this through code though.

Take a look at UMLResource and UMLResourceFactory,
UML22UMLExtendedMetaData, ... and post a specific entry for this since I
cannot help you further on this topic (I'm interested in your results
though, I'll probably add this to the standalone sample if you find
anything).

Cheers!

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #620275 is a reply to message #129230] Mon, 01 September 2008 11:17 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090203060308000202090107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Pierre,

This exception means you haven't got the jar org.eclipse.emf.ecore.xmi
which is needed by EMF Compare. You need to put this dependency in your
classpath.

As for 'createFileURI', we use it in order to convert the location of
the model to a 'file:' scheme URI.

Cheers,

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #620276 is a reply to message #129246] Mon, 01 September 2008 15:09 Go to previous message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks a lot for your support Laurent.

Now I can launch my application with you answer, but I get an exception :

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:/D:/------/model/------.uml, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLL oadImpl.java:83)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:191)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1210)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
at Main.main(Main.java:26)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:/D:/------/model/------.uml, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2565)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
... 6 more

Apparently caused by the metamodel of my UML2 models... How can I load or
precise this UML2 resource ?

Regards,

Pierre
Re: Merge EMF (UML) Models [message #620277 is a reply to message #129258] Mon, 01 September 2008 16:16 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080600020801060601080105
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Pierre,

You need to :
1) Add all the dependencies needed from UML2

And if you are running this code standalone (not as an eclipse plugin)
2) Register the UML package against in the package registry (see
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.compare/examples/org.eclipse.emf.compare.exampl es.standalone/?root=Modeling_Project
for a standalone example)

If not in the registry, you can also register the UML package in the
resourceSet you load the models in through code such as :
ResourceSet resourceSet = new ResourceSetImpl();
UMLPackage umlPackage = UMLPackage.eINSTANCE;
resourceSet.getPackageRegistry().put(umlPackage.getNsURI(),
umlPackage);

Cheers

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #620279 is a reply to message #129270] Tue, 02 September 2008 08:35 Go to previous message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks for your support Laurent.

But I don't really understand what you mean when saying "Add all the
dependencies needed from UML2" : where I have to precise these
dependencies ? In my java code ?
And as I'm running my code in standalone, I have to register UML
Package... But in the following code, UMLPackage & UMLResource are not
recognised :

// Register additionnal packages here. For UML2 for instance :
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);

I did not find any package to import where I can get these interfaces.

Regards,

Pierre
Re: Merge EMF (UML) Models [message #620280 is a reply to message #129296] Tue, 02 September 2008 09:28 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040005090905070907030809
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Pierre,

Since you're running standalone, you could take a look at the sample we
provide on the CVS at
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.compare/examples/org.eclipse.emf.compare.exampl es.standalone/?root=Modeling_Project
for an example.

The dependencies to UML2 need to be added in the classpath as you did
earlier for the jar org.eclipse.emf.ecore.xmi. IIRC, the needed jars for
UML2 were
- org.eclipse.uml2.common
- org.eclipse.uml2.uml
- org.eclipse.uml2.uml.resources

Regard,

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #620285 is a reply to message #129309] Tue, 02 September 2008 13:58 Go to previous message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks again Laurent.

I can now start loading my models, but I get a nullPointerException..
According to this code (I saw the sample on CVS) :

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;

import org.eclipse.emf.compare.diff.merge.service.MergeService;
import org.eclipse.emf.compare.diff.metamodel.DiffElement;
import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
import org.eclipse.emf.compare.diff.metamodel.DiffModel;
import org.eclipse.emf.compare.diff.metamodel.ModelInputSnapshot;
import org.eclipse.emf.compare.diff.service.DiffService;
import org.eclipse.emf.compare.match.metamodel.MatchModel;
import org.eclipse.emf.compare.match.service.MatchService;
import org.eclipse.emf.compare.util.ModelUtils;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;

public final class ExampleLauncher {
	/**
	 * This class doesn't need to be instantiated.
	 */
	private ExampleLauncher() {
		// prevents instantiation
	}

	public static void main(String[] args) {
		// Creates the resourceSet where we'll load the models
		final ResourceSet resourceSet = new ResourceSetImpl();

		// Register additional packages here. For UML2:
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
				UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
		resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
				UMLPackage.eINSTANCE);

		try {
			System.out.println("Loading resources.\n"); //$NON-NLS-1$
			// Loads the model to modify
			final EObject model1 = ModelUtils
					.load(
							new File(
									"D:/eclipse/workspace/EMFTEST/model/model.uml"),
							resourceSet);
			
			System.out.println("Loaded.");
		} catch (Exception e) { // shouldn't be thrown
			e.printStackTrace();
		}
	}
}


I got this exception :

Loading resources.

java.lang.NullPointerException
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFe atureType(XMLHandler.java:2132)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2010)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHa ndler.java:131)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1789)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1013)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2516)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2397)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1444)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1009)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:991)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:711)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocume ntParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1414)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1210)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
at ExampleLauncher.main(ExampleLauncher.java:68)

Which means that my model does not load... But it really exists on my file
system... Any ideas ? :s

Thanks for your support.

Cheers,

P.
Re: Merge EMF (UML) Models [message #620286 is a reply to message #129377] Tue, 02 September 2008 14:15 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060700030007080804040903
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Pierre,

Well that's one I do not understand :(. Can your model be loaded within
Eclipse in the ecore editor? I'd expect it not to be valid and EMF
Compare relies on EMF for the model loading so we need it to be a
loadable model. If it can be loaded in the sample ecore editor ... well
I hope Ed will jump in and save the day!

Laurent Goubet
Obeo

Pierre a
Re: Merge EMF (UML) Models [message #620287 is a reply to message #129390] Tue, 02 September 2008 14:38 Go to previous message
Pierre is currently offline PierreFriend
Messages: 21
Registered: July 2009
Junior Member
My models were exported via Magic Draw in "EMF UML2 (v2.x) XMI" and all
can be viewed in UML Model Editor. But no one can be loaded via the java
code I wrote in my last post...
Re: Merge EMF (UML) Models [message #620288 is a reply to message #129403] Tue, 02 September 2008 14:55 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080608070503060405000604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Ha, a possible cause would then be the UML version. Within eclipse an
"in-place" transformation from UML2 to UML2.1 takes place so that the
loaded model is conform to the new meta-model. I don't really know how
to trigger this through code though.

Take a look at UMLResource and UMLResourceFactory,
UML22UMLExtendedMetaData, ... and post a specific entry for this since I
cannot help you further on this topic (I'm interested in your results
though, I'll probably add this to the standalone sample if you find
anything).

Cheers!

Laurent Goubet
Obeo

Pierre a
Previous Topic:[EMF Compare] Wrong targets in movements?
Next Topic:[Announce] EMFT COMPARE 0.8.1RC1 is available
Goto Forum:
  


Current Time: Fri Apr 19 22:08:01 GMT 2024

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

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

Back to the top