Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Edapt ecore migration with XSD/XML
Edapt ecore migration with XSD/XML [message #1495777] Tue, 02 December 2014 14:03 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 48
Registered: December 2014
Member
Hello,

i have an existing xsd file with a xml instance. I generate an ecore by the xsd with the xsd model importer. The ecore Model contains 1 class (Config) with 2 String Attribute. Now i can read the exisiting xml with the generated ResourceFactoryImpl.

After that i add the edapt history file, because i want to add a new class and move 1 of the existing attribute. I add a reference to the root class. And now i can't read the xml instance and nothing is migrated.
What's wrong?
I add the whole project with the example, you have to edit the path to the xml file:

The error is:

org.eclipse.emf.edapt.migration.MigrationException: org.eclipse.emf.edapt.internal.migration.DiagnosticException: Model inconsistent
The 'validFeature' constraint is violated on 'Attribute "typeB" of Instance of type "Config"'

	at org.eclipse.emf.edapt.spi.migration.impl.ModelImpl.checkConformance(ModelImpl.java:451)
	at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.checkConformance(MigrationReconstructor.java:172)
	at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.checkConformanceIfMoreThan(MigrationReconstructor.java:165)
	at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.endRelease(MigrationReconstructor.java:148)
	at org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.endRelease(CompositeReconstructorBase.java:173)
	at org.eclipse.emf.edapt.history.reconstruction.ForwardReconstructorBase.doReconstruct(ForwardReconstructorBase.java:83)
	at org.eclipse.emf.edapt.history.reconstruction.ForwardReconstructorBase.doReconstruct(ForwardReconstructorBase.java:58)
	at org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.reconstruct(CompositeReconstructorBase.java:75)
	at org.eclipse.emf.edapt.migration.execution.Migrator.migrate(Migrator.java:244)
	at org.eclipse.emf.edapt.migration.execution.Migrator.migrateAndLoad(Migrator.java:196)
	at edapt_test.Activator.performMigration(Activator.java:108)
	at edapt_test.Activator.checkMigration(Activator.java:89)
	at edapt_test.Activator.start(Activator.java:59)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)
	at org.eclipse.osgi.container.Module.start(Module.java:439)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: org.eclipse.emf.edapt.internal.migration.DiagnosticException: Model inconsistent
The 'validFeature' constraint is violated on 'Attribute "typeB" of Instance of type "Config"'

	... 29 more
Re: Edapt ecore migration with XSD/XML [message #1497096 is a reply to message #1495777] Wed, 03 December 2014 14:38 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Dennis,

yes, this is a bit confusing, sorry ;).
By only moving the attribute it is unclear to Edapt how it should
migrate the values in attribute B. Edapt can tell you that if you run
the Check Integrity Action (see Screenshot).
You need to use a refactoring operation to make this work:
1. Open the operation browser view, see screenshot
2. Run the Extract Class Operation on the "Config" class to extract a
new class "NewClass" which is contained in a Reference "reference" in
"Config" and which will hold the "typeB" attribute, see Screenshot.
3. The history will then look similar to what you can see in the screenshot.
Now the history also passes the integrity check.
Hope this helps!

Cheers,
Maximilian

--
Maximilian Kögel

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


Am 02.12.2014 15:10, schrieb Dennis Melzer:
> Hello,
>
> i have an existing xsd file with a xml instance. I generate an ecore by the xsd with the xsd model importer. The ecore Model contains 1 class (Config) with 2 String Attribute. Now i can read the exisiting xml with the generated ResourceFactoryImpl.
>
> After that i add the edapt history file, because i want to add a new class and move 1 of the existing attribute. I add a reference to the root class. And now i can't read the xml instance and nothing is migrated.
> What's wrong?
> I add the whole project with the example, you have to edit the path to the xml file:
>
> The error is:
>
>
> org.eclipse.emf.edapt.migration.MigrationException: org.eclipse.emf.edapt.internal.migration.DiagnosticException: Model inconsistent
> The 'validFeature' constraint is violated on 'Attribute "typeB" of Instance of type "Config"'
>
> at org.eclipse.emf.edapt.spi.migration.impl.ModelImpl.checkConformance(ModelImpl.java:451)
> at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.checkConformance(MigrationReconstructor.java:172)
> at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.checkConformanceIfMoreThan(MigrationReconstructor.java:165)
> at org.eclipse.emf.edapt.internal.migration.execution.MigrationReconstructor.endRelease(MigrationReconstructor.java:148)
> at org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.endRelease(CompositeReconstructorBase.java:173)
> at org.eclipse.emf.edapt.history.reconstruction.ForwardReconstructorBase.doReconstruct(ForwardReconstructorBase.java:83)
> at org.eclipse.emf.edapt.history.reconstruction.ForwardReconstructorBase.doReconstruct(ForwardReconstructorBase.java:58)
> at org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.reconstruct(CompositeReconstructorBase.java:75)
> at org.eclipse.emf.edapt.migration.execution.Migrator.migrate(Migrator.java:244)
> at org.eclipse.emf.edapt.migration.execution.Migrator.migrateAndLoad(Migrator.java:196)
> at edapt_test.Activator.performMigration(Activator.java:108)
> at edapt_test.Activator.checkMigration(Activator.java:89)
> at edapt_test.Activator.start(Activator.java:59)
> at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
> at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
> at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
> at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
> at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
> at org.eclipse.osgi.container.Module.doStart(Module.java:571)
> at org.eclipse.osgi.container.Module.start(Module.java:439)
> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
> at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
> at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
> Caused by: org.eclipse.emf.edapt.internal.migration.DiagnosticException: Model inconsistent
> The 'validFeature' constraint is violated on 'Attribute "typeB" of Instance of type "Config"'
>
> ... 29 more
>
Re: Edapt ecore migration with XSD/XML [message #1497149 is a reply to message #1497096] Wed, 03 December 2014 15:27 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 48
Registered: December 2014
Member
Hey Maximilian,

thanks for the quick answer Smile.
With the operation "Extract Class" it works perfectly.
If i use the the 3 steps (create class, create reference, move) without the operation it will not work (same error).
So what's the magic behind the operation? Should i always use operations for editing the ecore modell?

Best regards
Dennis
Re: Edapt ecore migration with XSD/XML [message #1498410 is a reply to message #1497149] Thu, 04 December 2014 11:38 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi,

without applying the operation the values of typeB are not migrated (and
would therefore be lost). The operation expresses your intent to move
the attribute AND any values in existing instances. If you would be OK
with dropping the values you could delete the attribute and recreate it
(instead of moving). With the breaking changes check you can see if
there is changes that will not properly migrate changes.

Cheers,
Maximilian

Am 03.12.2014 16:27, schrieb Dennis Melzer:
> Hey Maximilian,
> thanks for the quick answer :). With the operation "Extract Class" it
> works perfectly. If i use the the 3 steps (create class, create
> reference, move) without the operation it will not work (same error). So
> what's the magic behind the operation? Should i always use operations
> for editing the ecore modell?
>
> Best regards
> Dennis


--
Maximilian Kögel

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: Edapt ecore migration with XSD/XML [message #1498785 is a reply to message #1498410] Thu, 04 December 2014 17:16 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Thanks for the explanation Smile
Previous Topic:Please help! Product export problem with ECP 1.5.0M2
Next Topic:[TEXO] How to access annotated attribute
Goto Forum:
  


Current Time: Tue Apr 23 15:09:15 GMT 2024

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

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

Back to the top