Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to handle XInclude in existing model instances ?(Sirius evaluation and existing model instances)
How to handle XInclude in existing model instances ? [message #1837858] Mon, 08 February 2021 19:53 Go to next message
Ahmet Bilgin is currently offline Ahmet BilginFriend
Messages: 4
Registered: February 2021
Junior Member
Hi,
my company is evaluating Sirius as dsl-editor tooling.

Metamodels and models
Currently our models are defined in xsd schemata and our model instances are defined in xml. See the attachment for an simplified example and the description of the example at the end.

Sirius Proof of concept
As a proof of concept I converted the xsd schema to an ecore metamodel and for a part of our models I implemented visualization examples with sirius.
In our proof of concept I instanciated new model instances and created elements via the sirius editor. So far so good - everything works fine.

What does not work
I tried to open (*1) our productive model instances in Sirius, but had problems with XIncludes in the xml files.
(*1: First I renamed the file extensions of the existing productive model xml files to the corresponding model file extension).

For exception stacktrace see next post.

What does work
When I replace the XIncludes in the existing xml model instances with the actual content of that include, it works!

Question
- How can I solve this problem without gluing the model instances into one big model?
- Our models are separated into multiple schemata and corresponding model instances.
-- As far as I can see this is just a logical and physical fragmentation of the model into several files, but they are all glued together in one (big) model file again, which xincludes all other models.
- During our evaluation phase of Sirius I wan't to stay compatible to the existing xsd schemata and xml model instances of our productive code. So it would be nice if I could tweak something on the sirius side instead

Information about provided example
- BigModel: includes all other (root) models (A and C); is the one we use at the end
- ModelA: some root model; includes ModelB
- ModelB: provides some more context to ModelA
- ModelC: another root model

[Updated on: Mon, 08 February 2021 20:03]

Report message to a moderator

Re: How to handle XInclude in existing model instances ? [message #1837861 is a reply to message #1837858] Mon, 08 February 2021 20:04 Go to previous messageGo to next message
Ahmet Bilgin is currently offline Ahmet BilginFriend
Messages: 4
Registered: February 2021
Junior Member
Exception Stacktrace

org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'include' not found. (platform:/resource/dsl/BigModel.xml.scenario, x <-- the line with the include , xx)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:2045)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:2009)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1953)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1048)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:720)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1341)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:507)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:867)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:796)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:142)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:644)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:328)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at com.example.grammar.scenario.presentation.ScenarioEditor.createModel(ScenarioEditor.java:1027)
	at com.example.grammar.scenario.presentation.ScenarioEditor.createPages(ScenarioEditor.java:1085)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:334)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:154)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:101)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:362)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:1001)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:966)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:139)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:411)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:333)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:1015)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:675)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:781)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:752)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:746)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:730)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1294)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:75)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:146)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4580)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:652)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:616)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:791)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:404)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1240)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3209)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3114)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3112)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3083)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3074)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:570)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:525)
	at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:103)
	at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:96)
	at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:134)
	at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:307)
	at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:764)
	at org.eclipse.ui.views.navigator.ResourceNavigator$2.open(ResourceNavigator.java:481)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:796)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:793)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1108)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:270)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:310)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3944)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3547)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1441)

[Updated on: Mon, 08 February 2021 20:05]

Report message to a moderator

Re: How to handle XInclude in existing model instances ? [message #1837873 is a reply to message #1837861] Tue, 09 February 2021 11:11 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 564
Registered: July 2009
Senior Member
Hi,

This is more of an EMF question than a Sirius one. In the stack you posted, this is your own ScenarioEditor that loads the model, not Sirius (which does not appear anywhere in the stack). I assume this is the one generated by EMF, maybe with some customizations.

EMF has its own ways to physically split models into seperate files (via controlled resources and inter-resources references using proxy URIs if you want to dig into this), but I am not sure EMF's XSD support handles Xinclude.

One possible approach (completely untested) would be to use EMF's support for passing configuration parameters to the underlying XML parser (see org.eclipse.emf.ecore.xmi.XMLResource.OPTION_PARSER_FEATURES) and enable XInclude by specifying http://apache.org/xml/features/xinclude (see https://xerces.apache.org/xerces2-j/features.html#xinclude). This means you'll need a custom Resource implementation to override the default load/save options to add these parameters.

Regards,


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to handle XInclude in existing model instances ? [message #1837892 is a reply to message #1837873] Tue, 09 February 2021 18:00 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7093
Registered: July 2009
Senior Member
Hi

EMF has been providing powerful support for XMI models for many years. The referencing capabilities of XMI make XInclude unnecessary; at least no one is clamouring for it. At one point I thought XInclude might be useful to allow 'nicknames' for long URIs, but tried an alternative approach using entities and even found that EMF has suitable underlying functionality that strongly suggested it was an original design intent.

Rather than try to mke EMF do what it doesn't I recommend that you see how effective XMI representations are and consequently how well Sirius supports them.

Bottom line; a design approach that sets out to fight EMF nearly always ends in tears.

Regards

Ed Willink
Re: How to handle XInclude in existing model instances ? [message #1837905 is a reply to message #1837873] Wed, 10 February 2021 08:02 Go to previous messageGo to next message
Ahmet Bilgin is currently offline Ahmet BilginFriend
Messages: 4
Registered: February 2021
Junior Member
Thank you for the clarification!
This pointed me to the right direction. I will look into it and ask further questions in the EMF forums.

Regards,
Ahmet Bilgin
Re: How to handle XInclude in existing model instances ? [message #1837930 is a reply to message #1837892] Wed, 10 February 2021 21:55 Go to previous messageGo to next message
Ahmet Bilgin is currently offline Ahmet BilginFriend
Messages: 4
Registered: February 2021
Junior Member
Hi Ed,

if it was up to me we would have migrated to EMF a long time ago. But for now I would like to keep the xsd schemata in tact.

I agree that I shouldn't change the way EMF is intended to use.

In our current system we are parsing the domain models with xerces according to the xsd schema. I could change the parsing on our end.
Do you see an alternative to the xinclude that I could implement, that would be compatible to EMF? Could I change the xincludes to EMF containment references/containment proxy references (*1) and use the EMFs xsd parser (or just the parts that handle resolving these references)?

(*1): I'm referring to this post here.

Thanks!
Ahmet
Re: How to handle XInclude in existing model instances ? [message #1837987 is a reply to message #1837930] Fri, 12 February 2021 07:53 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7093
Registered: July 2009
Senior Member
Hi

If you're happy with Xerces stick with it. Something else will just be irritatingly different.

If you're not happy, move to something else but don't expect something else to be identical to Xerces. Presumably it will on balance be better.

EMF uses XMI for which the href's can be regarded as accesses to remote elements, which is fine for referenced content.

If you need Xinclude to remote a singly contained content, then EMF supports containment references that refer to external Resources.

If you need Xinclude for a multiply shared content then that violates the UML/Ecore single containment principle. You need to think really hard as to whether/why you need it.

Regards

Ed Willink

Previous Topic:Making of basic functional blocks
Next Topic:Showing an image in a diagram
Goto Forum:
  


Current Time: Mon Apr 12 12:14:00 GMT 2021

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

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

Back to the top