Performance of EMF compare [message #1778668] |
Tue, 19 December 2017 11:55  |
Eclipse User |
|
|
|
Hi,
I am using EMF compare to compare two UML models (local models) by compare with each other option. My question is how can I measure how much time emf compare takes to get the differences as I have seen in some paper that they measure execution time of emf compare. Is there a trick to do that.
Thanks,
Taghreed
|
|
|
|
|
|
|
|
Re: Performance of EMF compare [message #1779906 is a reply to message #1779874] |
Mon, 15 January 2018 11:34   |
Eclipse User |
|
|
|
Hi Philip,
I am really sorry for bothering you with my questions but i am still naive in using EMF Compare.
I still have an error says that Package with uri 'http://www.eclipse.org/uml2/5.0.0/UML' not found.
The code that i am using is
package emfcomparetime;
import java.io.File;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.*;
import org.eclipse.emf.compare.match.DefaultComparisonFactory;
import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
import org.eclipse.emf.compare.match.DefaultMatchEngine;
import org.eclipse.emf.compare.match.IComparisonFactory;
import org.eclipse.emf.compare.match.IMatchEngine;
import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
import org.eclipse.emf.compare.match.impl.MatchEngineFactoryImpl;
import org.eclipse.emf.compare.match.impl.MatchEngineFactoryRegistryImpl;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.compare.utils.UseIdentifiers;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.emf.ecore.EPackage.*;
import org.eclipse.emf.ecore.resource.*;
import org.eclipse.uml2.uml.resource.*;
import org.eclipse.uml2.uml.*;
public class EmfcompareExecTime {
public Comparison compare(File model1, File model2) {
// Load the two input models
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();
String xmi1 = "modelECommerce-Jan5.uml";
String xmi2 = "modelECommerce-Jan5VR1.uml";
load(xmi1, resourceSet1);
load(xmi2, resourceSet2);
// Configure EMF Compare
IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.WHEN_AVAILABLE);
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
matchEngineFactory.setRanking(20);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);
EMFCompare comparator = EMFCompare.builder().setMatchEngineFactoryRegistry(matchEngineRegistry).build();
// Compare the two models
IComparisonScope scope = EMFCompare.createDefaultScope(resourceSet1, resourceSet2);
return comparator.compare(scope);
}
private void load(String absolutePath, ResourceSet resourceSet) {
URI uri = URI.createFileURI(absolutePath);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("uml", new XMIResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("modelECommerce-Jan5.uml", UMLResource.Factory.INSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("modelECommerce-Jan5VR1.uml", UMLResource.Factory.INSTANCE);
// Resource will be loaded within the resource set
resourceSet.getResource(uri, true);
}
public static void main(String[] args)
{
EmfcompareExecTime ee = new EmfcompareExecTime();
ee.compare(new File("modelECommerce-Jan5.uml"),new File("modelECommerce-Jan5VR1.uml"));
}
}
Can you please help me.
Thanks,
Taghreed.
|
|
|
|
Re: Performance of EMF compare [message #1780023 is a reply to message #1779972] |
Tue, 16 January 2018 10:15   |
Eclipse User |
|
|
|
Hi Laurent Goubet,
Thanks for your reply.I tried to fix the code but still have a problem says that Package with uri 'http://www.eclipse.org/papyrus/GQAM/1' not found i believe that package is related to the MARTE profile that i used to annotate my UML models.
Can you please help me. The following is my code:public class EmfcompareExecTime {
public Comparison compare(File model1, File model2) {
// Load the two input models
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();
String xmi1 = "modelECommerce-Jan5.uml";
String xmi2 = "modelECommerce-Jan5VR1.uml";
load(xmi1, org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet1));
load(xmi2, org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet2));
//org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet1);
//org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet2);
// Configure EMF Compare
IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.WHEN_AVAILABLE);
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
matchEngineFactory.setRanking(20);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);
EMFCompare comparator = EMFCompare.builder().setMatchEngineFactoryRegistry(matchEngineRegistry).build();
// Compare the two models
IComparisonScope scope = EMFCompare.createDefaultScope(resourceSet1, resourceSet2);
return comparator.compare(scope);
}
private void load(String absolutePath, ResourceSet resourceSet) {
URI uri = URI.createFileURI(absolutePath);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("uml", new XMIResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("modelECommerce-Jan5.uml", UMLResource.Factory.INSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("modelECommerce-Jan5VR1.uml", UMLResource.Factory.INSTANCE);
// Resource will be loaded within the resource set
resourceSet.getResource(uri, true);
}
public static void main(String[] args)
{
EmfcompareExecTime ee = new EmfcompareExecTime();
ee.compare(new File("modelECommerce-Jan5.uml"),new File("modelECommerce-Jan5VR1.uml"));
}
}
Thanks,
Taghreed
[Updated on: Tue, 16 January 2018 11:02] by Moderator
|
|
|
|
|
|
Re: Performance of EMF compare [message #1781131 is a reply to message #1781014] |
Thu, 01 February 2018 12:48   |
Eclipse User |
|
|
|
Hi Taghreed,
it seems the JVM is unable to find any jar providing this class at runtime. So you should look at your run config and see if it includes the required features or plug-ins; or if you include all features or plug-ins of the target definition, whether the target is missing a feature or plug-in that includes that.
The target of EMF Compare pulls the following from orbit:
location "http://download.eclipse.org/tools/orbit/downloads/drops/R20170307180635/repository/" {
com.google.guava [15.0.0,22.0.0)
com.google.gson [2.2.4,3.0.0)
org.junit [4,5)
org.apache.log4j [1.2.0,1.3.0)
/* Egit/Jgit */
javaewah
org.apache.commons.compress
org.kohsuke.args4j
/* Egit/Jgit */
org.mockito [1.9.0,2.0.0)
org.hamcrest [1.1.0,2.0.0)
}
Hope that helps!
Best wishes,
Philip
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07334 seconds