Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Loading ecore and XMI: Class is not found or is abstract(Loading ecore and XMI: Class is not found or is abstract)
Loading ecore and XMI: Class is not found or is abstract [message #1815881] Mon, 14 October 2019 11:30 Go to next message
Chiaramello Marco is currently offline Chiaramello MarcoFriend
Messages: 1
Registered: October 2019
Junior Member
Dear all,
I'm new in using EMF. I'm trying to validate and XMI againts an ecore model. In eclipse interface I succeed to import them and validate. I'm trying to do the same calling the validation via java.

To load my XMI and ecore file I'm doing:

private static ResourceSet rs = new ResourceSetImpl();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xml", new XMLResourceFactoryImpl());
EcorePackage ecorePackage = EcorePackage.eINSTANCE;
URI my_file = createFileURI(my_ecore.getAbsolutePath());
Resource r = rs.getResource(my_file, true);
if(eObject instanceof EPackage){
EPackage p = (EPackage) eObject;
EPackage.Registry.INSTANCE.put(p.getNsURI(),p);
rs.getPackageRegistry().put(p.getNsURI(),p);
}

URI uri = createFileURI(my_xmi.getAbsolutePath());
Resource resource;
resource = Resource.Factory.Registry.INSTANCE.getFactory(uri).createResource(uri);
resource.load(null);

When I'm loading the xmi I have something like:

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Class 'DataSet' is not found or is abstract.

Any idea?
Thank you
Best Regards
Marco

Re: Loading ecore and XMI: Class is not found or is abstract [message #1815985 is a reply to message #1815881] Wed, 16 October 2019 13:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30692
Registered: July 2009
Senior Member
What file extension does your resource use, xmi I assume? What does the start of the XML/XMI look like? Don't you have a generated model? If you do, try Generate Test Code and look for the XyzExample.java to see how to load your model.
Previous Topic:XSD -> ecore -> Xtext: How to deal with anyType in Xtext Grammar?
Next Topic:Development of a UI with EMF forms without a data model
Goto Forum:
  


Current Time: Sat Dec 14 07:17:12 GMT 2019

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

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

Back to the top