SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
EclipseCon 2011




      What every developer
           EMF Compare ?



             Cédric Brun
             Obeo, France



copyright 2011 Obeo
in action!




●   SVN, CVS, GIT
●   UML, EMF, DSL's
●   History, Compare, Merge
Component of
                    EMF
●   Graduated
●   Stable API
●   pure Java JAR
●   Extensible
The Tool
How is it
Working ?
Matching Strategies

  XMI-ID                                                         GenericMatchEngine

options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.FALSE);
MatchModel match = MatchService.doContentMatch(left,right options);




  ID-Attribute
options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.FALSE);
MatchModel match = MatchService.doContentMatch(left,right options);




                                                defaults are XMI-ID, then ID-attributes and then reflective
Your own matching strategy



 public class AddressBookMatcher extends GenericMatchEngine {

 /**
  * {@inheritDoc}
  */
 @Override
 protected boolean isSimilar(EObject obj1, EObject obj2) throws FactoryException {
 /*
  * If we've got a People, only check the name similarity.
  */
 if (obj1 instanceof People || obj2 instanceof People)
 return nameDistance(obj1, obj2) > 0.8;
 /*
  * Contacts are similar if : the associated people is similar + their content is quite the same.
  */
 if (obj1 instanceof Contact && obj2 instanceof Contact) {
 EObject obj1Parent = obj1.eContainer();
 EObject obj2Parent = obj2.eContainer();
 if (obj1Parent instanceof People && obj2Parent instanceof People)
 return isSimilar(obj1Parent, obj2Parent) && contentDistance(obj1, obj2) > 0.5;
 }

 /*
  * If it's something we don't know about, then use the generic behavior.
  */
 return super.isSimilar(obj1, obj2);
 }
Comparing
People alice = createAlice();
v1Book.getPeoples().add(alice);

v2Book = EcoreUtil.copy(v1Book);

People bob = createBob();
v2Book.getPeoples().add(bob);




MatchModel match = new AddressBookMatcher().contentMatch(v1Book, v2Book, noOptions());

DiffModel delta = DiffService.doDiff(match);

DiffElement addbob = DiffHelper.isAdded(bob, delta);
assertNotNull("the addition of Bob has not been detected", addbob);
Merging




boolean mergeLeftToRight = true;
for (DiffElement diff : delta.getDifferences()) {
MergeService.merge(diff, mergeLeftToRight);
}

match = new AddressBookMatcher().contentMatch(v1Book, v2Book, noOptions());

delta = DiffService.doDiff(match);

assertEquals("We still have a difference whereas we merged all the diff elements", 0,
delta //$NON-NLS-1$
.getDifferences().size());
aliceLocal.setBirthday("07/05/84");
aliceRemote.setBirthday("07/07/84");

MatchModel match = new AddressBookMatcher().contentMatch(v2LocalBook, v2RemoteBook, v1Book,
noOptions());

DiffModel delta = DiffService.doDiff(match, true);
List<DiffElement> conflicts = new ArrayList<DiffElement>();

for (DiffElement diff : delta.getDifferences()) {
if (diff.isConflicting()) {
conflicts.add(diff);
}
}

assertEquals("We should have a conflict on Alice's birthday", 1, conflicts.size());
}
Exporting the delta.
Diff is a model => You can use Acceleo to generate code based on a diff
    e.g : SQL migration scripts based on a entity models comparison
Other usages we've
             heard of ?

Non regression Testing
    Selective assertEquals() on models

Transforming a destructive process in an incremental one
Using the diff + original version as an input for a process
Interactive Model Transformation
    Leveraging the UI + custom Match and Merge
What's
         cooking ?

                     ●   UML dedicated support
                     ●   Enhanced generic editor
                     ●   GMF and Papyrus Integration
References
 Website :
 ●

  ● http://www.eclipse.org/modeling/emf?project=compare

  ● http://wiki.eclipse.org/index.php/EMF ompare
                                        C
                                        _


 Support : EMF newsgroup and mailling list
 ●




 Downloads :
 ●

  ● Indigo Update Site

  ● Eclipse Modeling Package




 Source Code
 ●

  ● git://git.eclipse.org/gitroot/emfcompare/org.eclipse.emf.compare.git

Weitere ähnliche Inhalte

Ähnlich wie What every developer should know about EMF Compare

Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.jsBert Wijnants
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe MassesHolger Schill
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkDave Steinberg
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andevMike Nakhimovich
 
Dojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspectiveDojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspectivecjolif
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0Michael Vorburger
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...EnlightenmentProject
 
iOS overview
iOS overviewiOS overview
iOS overviewgupta25
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important PartsSergey Bolshchikov
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAttila Bertók
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptxStefan Oprea
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 

Ähnlich wie What every developer should know about EMF Compare (20)

Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.js
 
Eugenia
EugeniaEugenia
Eugenia
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 
Refactoring
RefactoringRefactoring
Refactoring
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
Dojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspectiveDojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspective
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
 
Refactoring
RefactoringRefactoring
Refactoring
 
Koin Quickstart
Koin QuickstartKoin Quickstart
Koin Quickstart
 
iOS overview
iOS overviewiOS overview
iOS overview
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID Principles
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 

Mehr von Cédric Brun

Integrating Xtext and Sirius: Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and PitfallsIntegrating Xtext and Sirius: Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and PitfallsCédric Brun
 
Eclipse Modeling Guided Tour - EMF Compare
Eclipse Modeling Guided Tour - EMF CompareEclipse Modeling Guided Tour - EMF Compare
Eclipse Modeling Guided Tour - EMF CompareCédric Brun
 
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)Cédric Brun
 
Eclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreToolsEclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreToolsCédric Brun
 
EcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleEcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleCédric Brun
 
Integrating Xtext and Sirius: Strategies and Pitfalls
Integrating  Xtext and Sirius:  Strategies and PitfallsIntegrating  Xtext and Sirius:  Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and PitfallsCédric Brun
 
Roadmap - SiriusCon2016
Roadmap - SiriusCon2016Roadmap - SiriusCon2016
Roadmap - SiriusCon2016Cédric Brun
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frCédric Brun
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldCédric Brun
 
15 EMF projects in 25 minutes
15 EMF projects in 25 minutes15 EMF projects in 25 minutes
15 EMF projects in 25 minutesCédric Brun
 
What the heck is Eclipse Modeling and why should you care !
What the heck is Eclipse Modeling and why should you care !What the heck is Eclipse Modeling and why should you care !
What the heck is Eclipse Modeling and why should you care !Cédric Brun
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!Cédric Brun
 
Sirius : origins, present, future
Sirius : origins, present, futureSirius : origins, present, future
Sirius : origins, present, futureCédric Brun
 
Xtext + Sirius = ♥ / EclipseCon Europe 2014
Xtext + Sirius = ♥  / EclipseCon Europe 2014Xtext + Sirius = ♥  / EclipseCon Europe 2014
Xtext + Sirius = ♥ / EclipseCon Europe 2014Cédric Brun
 
Xtext + Sirius = &lt;3
Xtext + Sirius = &lt;3Xtext + Sirius = &lt;3
Xtext + Sirius = &lt;3Cédric Brun
 
Ecore Tools 2.0 : The Luna Revival
Ecore Tools 2.0 : The Luna RevivalEcore Tools 2.0 : The Luna Revival
Ecore Tools 2.0 : The Luna RevivalCédric Brun
 
Sirius Role Playing Game - Build diagram, table and tree editors in 20 minutes
Sirius Role Playing Game  - Build diagram, table and tree editors in 20 minutesSirius Role Playing Game  - Build diagram, table and tree editors in 20 minutes
Sirius Role Playing Game - Build diagram, table and tree editors in 20 minutesCédric Brun
 
From Acceleo.org To Eclipse Modeling
From Acceleo.org To Eclipse ModelingFrom Acceleo.org To Eclipse Modeling
From Acceleo.org To Eclipse ModelingCédric Brun
 
Acceleo Day - Acceleo Mtl Code Generation
Acceleo Day - Acceleo Mtl Code GenerationAcceleo Day - Acceleo Mtl Code Generation
Acceleo Day - Acceleo Mtl Code GenerationCédric Brun
 
Team Work With Models Web
Team Work With Models WebTeam Work With Models Web
Team Work With Models WebCédric Brun
 

Mehr von Cédric Brun (20)

Integrating Xtext and Sirius: Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and PitfallsIntegrating Xtext and Sirius: Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and Pitfalls
 
Eclipse Modeling Guided Tour - EMF Compare
Eclipse Modeling Guided Tour - EMF CompareEclipse Modeling Guided Tour - EMF Compare
Eclipse Modeling Guided Tour - EMF Compare
 
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)
Eclipse Modeling Guided Tour - Acceleo Query Language (AQL)
 
Eclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreToolsEclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreTools
 
EcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleEcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessible
 
Integrating Xtext and Sirius: Strategies and Pitfalls
Integrating  Xtext and Sirius:  Strategies and PitfallsIntegrating  Xtext and Sirius:  Strategies and Pitfalls
Integrating Xtext and Sirius: Strategies and Pitfalls
 
Roadmap - SiriusCon2016
Roadmap - SiriusCon2016Roadmap - SiriusCon2016
Roadmap - SiriusCon2016
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ fr
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the world
 
15 EMF projects in 25 minutes
15 EMF projects in 25 minutes15 EMF projects in 25 minutes
15 EMF projects in 25 minutes
 
What the heck is Eclipse Modeling and why should you care !
What the heck is Eclipse Modeling and why should you care !What the heck is Eclipse Modeling and why should you care !
What the heck is Eclipse Modeling and why should you care !
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
 
Sirius : origins, present, future
Sirius : origins, present, futureSirius : origins, present, future
Sirius : origins, present, future
 
Xtext + Sirius = ♥ / EclipseCon Europe 2014
Xtext + Sirius = ♥  / EclipseCon Europe 2014Xtext + Sirius = ♥  / EclipseCon Europe 2014
Xtext + Sirius = ♥ / EclipseCon Europe 2014
 
Xtext + Sirius = &lt;3
Xtext + Sirius = &lt;3Xtext + Sirius = &lt;3
Xtext + Sirius = &lt;3
 
Ecore Tools 2.0 : The Luna Revival
Ecore Tools 2.0 : The Luna RevivalEcore Tools 2.0 : The Luna Revival
Ecore Tools 2.0 : The Luna Revival
 
Sirius Role Playing Game - Build diagram, table and tree editors in 20 minutes
Sirius Role Playing Game  - Build diagram, table and tree editors in 20 minutesSirius Role Playing Game  - Build diagram, table and tree editors in 20 minutes
Sirius Role Playing Game - Build diagram, table and tree editors in 20 minutes
 
From Acceleo.org To Eclipse Modeling
From Acceleo.org To Eclipse ModelingFrom Acceleo.org To Eclipse Modeling
From Acceleo.org To Eclipse Modeling
 
Acceleo Day - Acceleo Mtl Code Generation
Acceleo Day - Acceleo Mtl Code GenerationAcceleo Day - Acceleo Mtl Code Generation
Acceleo Day - Acceleo Mtl Code Generation
 
Team Work With Models Web
Team Work With Models WebTeam Work With Models Web
Team Work With Models Web
 

Kürzlich hochgeladen

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

What every developer should know about EMF Compare

  • 1. EclipseCon 2011 What every developer EMF Compare ? Cédric Brun Obeo, France copyright 2011 Obeo
  • 2. in action! ● SVN, CVS, GIT ● UML, EMF, DSL's ● History, Compare, Merge
  • 3. Component of EMF ● Graduated ● Stable API ● pure Java JAR ● Extensible
  • 6.
  • 7. Matching Strategies XMI-ID GenericMatchEngine options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.FALSE); MatchModel match = MatchService.doContentMatch(left,right options); ID-Attribute options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.FALSE); MatchModel match = MatchService.doContentMatch(left,right options); defaults are XMI-ID, then ID-attributes and then reflective
  • 8. Your own matching strategy public class AddressBookMatcher extends GenericMatchEngine { /** * {@inheritDoc} */ @Override protected boolean isSimilar(EObject obj1, EObject obj2) throws FactoryException { /* * If we've got a People, only check the name similarity. */ if (obj1 instanceof People || obj2 instanceof People) return nameDistance(obj1, obj2) > 0.8; /* * Contacts are similar if : the associated people is similar + their content is quite the same. */ if (obj1 instanceof Contact && obj2 instanceof Contact) { EObject obj1Parent = obj1.eContainer(); EObject obj2Parent = obj2.eContainer(); if (obj1Parent instanceof People && obj2Parent instanceof People) return isSimilar(obj1Parent, obj2Parent) && contentDistance(obj1, obj2) > 0.5; } /* * If it's something we don't know about, then use the generic behavior. */ return super.isSimilar(obj1, obj2); }
  • 9. Comparing People alice = createAlice(); v1Book.getPeoples().add(alice); v2Book = EcoreUtil.copy(v1Book); People bob = createBob(); v2Book.getPeoples().add(bob); MatchModel match = new AddressBookMatcher().contentMatch(v1Book, v2Book, noOptions()); DiffModel delta = DiffService.doDiff(match); DiffElement addbob = DiffHelper.isAdded(bob, delta); assertNotNull("the addition of Bob has not been detected", addbob);
  • 10. Merging boolean mergeLeftToRight = true; for (DiffElement diff : delta.getDifferences()) { MergeService.merge(diff, mergeLeftToRight); } match = new AddressBookMatcher().contentMatch(v1Book, v2Book, noOptions()); delta = DiffService.doDiff(match); assertEquals("We still have a difference whereas we merged all the diff elements", 0, delta //$NON-NLS-1$ .getDifferences().size());
  • 11. aliceLocal.setBirthday("07/05/84"); aliceRemote.setBirthday("07/07/84"); MatchModel match = new AddressBookMatcher().contentMatch(v2LocalBook, v2RemoteBook, v1Book, noOptions()); DiffModel delta = DiffService.doDiff(match, true); List<DiffElement> conflicts = new ArrayList<DiffElement>(); for (DiffElement diff : delta.getDifferences()) { if (diff.isConflicting()) { conflicts.add(diff); } } assertEquals("We should have a conflict on Alice's birthday", 1, conflicts.size()); }
  • 12. Exporting the delta. Diff is a model => You can use Acceleo to generate code based on a diff e.g : SQL migration scripts based on a entity models comparison
  • 13. Other usages we've heard of ? Non regression Testing Selective assertEquals() on models Transforming a destructive process in an incremental one Using the diff + original version as an input for a process Interactive Model Transformation Leveraging the UI + custom Match and Merge
  • 14. What's cooking ? ● UML dedicated support ● Enhanced generic editor ● GMF and Papyrus Integration
  • 15. References Website : ● ● http://www.eclipse.org/modeling/emf?project=compare ● http://wiki.eclipse.org/index.php/EMF ompare C _ Support : EMF newsgroup and mailling list ● Downloads : ● ● Indigo Update Site ● Eclipse Modeling Package Source Code ● ● git://git.eclipse.org/gitroot/emfcompare/org.eclipse.emf.compare.git