Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 159700 - Metamodel implementation for XSD
Summary: Metamodel implementation for XSD
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: gmt (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL: http://www.openarchitectureware.org/f...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 05:17 EDT by Karsten Thoms CLA
Modified: 2017-04-11 15:12 EDT (History)
3 users (show)

See Also:


Attachments
Dynamic EMF Example with XSD (9.43 KB, application/octet-stream)
2007-10-22 09:46 EDT, Moritz Eysholdt CLA
no flags Details
XMLReader workflow component (6.23 KB, application/octet-stream)
2007-11-23 11:36 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev99 (663.66 KB, application/octet-stream)
2008-01-26 13:56 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev102 (665.15 KB, application/octet-stream)
2008-01-27 14:57 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080217 (870.08 KB, application/octet-stream)
2008-02-17 12:53 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080219 (884.28 KB, application/octet-stream)
2008-02-19 13:20 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080220 (884.70 KB, application/octet-stream)
2008-02-20 09:06 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080222 (885.46 KB, application/octet-stream)
2008-02-22 16:41 EST, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080406 (969.69 KB, application/octet-stream)
2008-04-06 17:27 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080422 (1.01 MB, application/octet-stream)
2008-04-22 07:13 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080519 (1.15 MB, application/zip)
2008-05-19 11:19 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080521 (1.16 MB, application/zip)
2008-05-21 10:56 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080523 (1.17 MB, application/zip)
2008-05-23 11:13 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080627 (1.24 MB, application/zip)
2008-06-27 10:59 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080630 (1.24 MB, application/zip)
2008-06-30 09:19 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter rev20080702 (1.27 MB, application/zip)
2008-07-02 10:41 EDT, Moritz Eysholdt CLA
no flags Details
oAW XSD Adapter latest (119 bytes, text/plain)
2008-08-29 11:28 EDT, Moritz Eysholdt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2006-10-04 05:17:04 EDT
For processing of XML files it would be nice to have a metamodel implementation based on XSD schema files. For XML files that apply to the schema this metamodel an instantiator is needed.
Comment 1 Bernd Kolb CLA 2006-10-04 06:17:08 EDT
Ecore has this feature. 
So from my point of view, this is invalid
Comment 2 Karsten Thoms CLA 2006-10-04 07:03:43 EDT
Bernd, you are thinking about the XSD2Ecore facility?

Yes, that's a way to transfer the XSD to Ecore and then work upon the generated Ecore metamodel. Reason for this feature request is
a) the generation of the resulting .ecore metamodel is an additional step and has to be done each time the .xsd changes
b) the importer is not documented well. I searched and tried a while and finally manged to get it working. OK, we could provide the links to the docs and explain the process in an additional article to make this task easier for those searching for it.
c) How are then XML documents read and instantiated into this Ecore metamodel? I haven't found it, please help.
d) It would be nice if the editors will reflect directly the schema.
Comment 3 Bernd Kolb CLA 2007-05-23 16:52:02 EDT
Why not just convert the xsd to ecore? 

Karsten, please close if this has been solved.
Comment 4 Moritz Eysholdt CLA 2007-10-22 09:46:16 EDT
Created attachment 80873 [details]
Dynamic EMF Example with XSD

I've created a small example that shows how a .ecore metamodel can be instantiated in memory based on an XSD Schema. Afterwards, a XML file that is valid to the schema is used to instantiate a dynamic emf model. It contains german documentation though. If somebody wants it in english, let me know.
Comment 5 Moritz Eysholdt CLA 2007-11-23 11:36:51 EST
Created attachment 83656 [details]
XMLReader workflow component

This is an early version of oAW workflow comonent that takes a XML file and one or more XML Schemas and transforms them into dynamic Ecore Packages.

The file contains an example project, too.

This is not a complete solution to the problem yet as the actual oAW metamodel implementation is still missing.

It is possible to generate code with Xpand already, but typenames are not converted correctly and the Eclipse Xpand editor is not metamodelaware for XML Schema metamodels.

/**
 * This workflow component loads an XML file into a dynamic Ecore model.
 * 
 * The XML format has to be specified via one or more XML Schemas. They are
 * transformed into dynamic eEore packages which are then uses as metamodels.
 * 
 * Example: <code>
 * <component class="org.eclipse.mwe.xsd.XMLReader">
 *		<modelSlot value="model" />
 *		<uri value="src/model/wash.xml" />
 *		<xmlSchema value="src/model/loadcurve.xsd" />
 *		<xmlSchema value="src/model/device.xsd" />
 *		<useSingleGlobalResourceSet value="true" />
 * </component>
 * </code>
 * 
 * @author moritz@eysholdt.de
 * 
 */
Comment 6 Moritz Eysholdt CLA 2008-01-26 13:56:24 EST
Created attachment 87946 [details]
oAW XSD Adapter rev99

My implementation of the oAW XSD Adapter made quite some progress. 

It allows to use XSDs as meta models without having do deal with EMF/Ecore. This works within workflows and the xpand editor (meta model aware code completion)

The archive contains:
- the feature and plugins, ready to be copied to an Eclipse installation.
- the source
- demos
- documentation

For more details, see the documentaion inside the archive or at:

http://softeys.de/oaw-xsd-adapter/doc/contents/xsd_tutorial.html

This is still an early version, but ready to be tried out...
Comment 7 Moritz Eysholdt CLA 2008-01-27 14:57:50 EST
Created attachment 87978 [details]
oAW XSD Adapter rev102

now compiled for java5 (rev99 was for java6)
Comment 8 Moritz Eysholdt CLA 2008-02-17 12:53:10 EST
Created attachment 89944 [details]
oAW XSD Adapter rev20080217

Changes:

- fix: if no type mapping is available for sub typs of EDataTypes, a mapping based on the EDatatype's implementation Class is now used. That should work for the vast majority of cases.
- feature: XMLWriter allows to write a modified/created model back to an XML file.
- demo: There is a demo now that how to generate an ecore model from an XSD via genmodel and then use the ecore as meta model for the XMLReader. This way the xsd2ecore transformation can be configured more fine grained.
- demo: Read a XML file that is based on a custom XSD and apply a model 2 model transformation to create a SVG image. The image is then stored to XML via XMLWriter.
- feature: Support for XML mixed content via EMF FeatureMaps. But there is still a bug related to caching mechanism in other parts of oAW, which causes trouble if you want to create new Objects that are supposed to contain mixed content.
Comment 9 Moritz Eysholdt CLA 2008-02-19 13:20:53 EST
Created attachment 90091 [details]
oAW XSD Adapter rev20080219

changes:

- feature: support for type QName
Comment 10 Moritz Eysholdt CLA 2008-02-20 09:06:35 EST
Created attachment 90178 [details]
oAW XSD Adapter rev20080220

changes:

- fix: meta model package names containing dots are now reduced to their last segment.
Comment 11 Moritz Eysholdt CLA 2008-02-22 16:41:10 EST
Created attachment 90521 [details]
oAW XSD Adapter rev20080222

Changes:

- fix: The QName type was not resolved correctly when requested by name
Comment 12 Moritz Eysholdt CLA 2008-04-06 17:27:50 EDT
Created attachment 95009 [details]
oAW XSD Adapter rev20080406

changes:

- Feature: Support for EMaps.
- Feature: Support for creating DocumentRoot Objects using Xtend. This way, custom namespaces, namespaceprefixes and schemalocations can be added to an XML file.
- Fix: Rewritten locater for XSD files. They can be referenced by the workflow file, schemalocations within XML files or imports within other schemas. The lookup is done relative to the referee first, then delegated to the default oAW resource locator. This way the lookup is done in the classpath and in the pluginpath, too.
- Feature: The XMLWriter now supports to write multiple files at once. A oAW Expression can be used to specify a filename for each file.
- Demo: There is a new demo which shows how to generate multiple XSD files from one ecore model, which contains multiple subpackages. The Demo shows how set up custom namespaces in a m2m transformation and how to generate multiple XML files at once.
- A couple of minor bugfixes.
Comment 13 Moritz Eysholdt CLA 2008-04-06 17:31:17 EDT
I forgot to metion that to create DocumentRoot objects you will need the latest nightly build of oAW (http://oawbranch.pluginbuilder.org/latest/) or you will have to wait until oAW 4.3 is released: http://www.peterfriese.de/openarchitectureware-43-to-be-released-in-april-2008/
Comment 14 Moritz Eysholdt CLA 2008-04-22 07:13:09 EDT
Created attachment 96999 [details]
oAW XSD Adapter rev20080422

changes:
- fix: increased the XSDMetaModelContributor's performance a lot
- fix: With many open projects the XSDMetaModelContributor's ProjectAnalyzer sometimes ended up in a deadlock
- fix: If types declared within an XSD changes, the EmfRegistryMetaModel's type-resolving-cache prevented them from being reloaded properly. Now the XSDMetaModel (which is a subtype of EmfRegistryMetaModel) is instantiated new if needed.
Comment 15 Moritz Eysholdt CLA 2008-05-19 11:19:18 EDT
Created attachment 100924 [details]
oAW XSD Adapter rev20080519

changes:
- fix: xsd-include is now supported properly.
Comment 16 Moritz Eysholdt CLA 2008-05-21 10:56:05 EDT
Created attachment 101280 [details]
oAW XSD Adapter rev20080521

changes:
- fix: Names of EPackages that are based on multiple schemas which include each other are calculated correctly now.
Comment 17 Moritz Eysholdt CLA 2008-05-23 11:13:57 EDT
Created attachment 101749 [details]
oAW XSD Adapter rev20080523

changes:
 - feature: Added public Xtend-API to invoke the XMLReader. If one XML file contains references to other ones, then they can be loaded dynamically from within Xtend/Xpand now.
Comment 18 Moritz Eysholdt CLA 2008-06-27 10:59:58 EDT
Created attachment 106015 [details]
oAW XSD Adapter rev20080627

changes:
- fix: when schemas change, are removed or moved within a project, they and their dependent schemas are reloaded properly
- fix: when multiple schemas depend on the same second schema, the second schema is only loaded once
- feature: loading schemas and generating EPackages for them is now done by a custom eclipse builder
- feature: added an oAW-type for EFeature
- feature: EClasses now exhibit their EFeatures as constant properties
- feature: made all important operations of EFeatureMaps available -> support for xsd:any and xsd:anyAttribute
- fix: EFeatureMaps and EFeatureMapEntries can now be accessed via name 
- feature: made the XMLResource's options accessible for the XMLReader and XMLWriter
- feature: added option for XMLReader to define a default namespace for XML files
- feature: added option for XMLReader to define namespace mapping

known issues:
- sometimes on startup there is no full build triggered and Xpand/Xtend editors therefore complain about missing types. triggering the build manually helps.
- if projects are closed schemas/EPackages are not unloaded correctly.
- if there are diagnostic issues from the XMLResource or the XSDEcoreBuilder or if there are name conflicts between elements/attributes, they are now printed while running a workflow. this might be verbose, but as long as your workflow finishes with the desired result, don't be scared.
Comment 19 Moritz Eysholdt CLA 2008-06-30 09:19:43 EDT
Created attachment 106106 [details]
oAW XSD Adapter rev20080630

changes:
- fix: on start up there is always a full build triggered now
- fix: if a project is closed, the contained XSDs are unloaded now
Comment 20 Moritz Eysholdt CLA 2008-07-02 10:41:29 EDT
Created attachment 106315 [details]
oAW XSD Adapter rev20080702

changes:
- feature: added a news2xhtml demo. 
- feature: added support for composed simple xsd types.
Comment 21 Moritz Eysholdt CLA 2008-08-29 11:28:18 EDT
Created attachment 111308 [details]
oAW XSD Adapter latest

The XSD Adapter has been integrated into oAW's nightly build, so this bug can be closed. For the latest info about the XSD Adapter see: 
http://www.openarchitectureware.org/staticpages/index.php/xsd_adapter

regards,
  Moritz
Comment 22 Karsten Thoms CLA 2008-12-15 19:46:35 EST
This bug has been moved to www.openArchitectureWare.org/bugzilla. This action is part of a batch process. We apologize if you received many mails due to this action.
After change of the resolution the bugs will be closed.
Comment 23 Karsten Thoms CLA 2008-12-16 00:52:31 EST
This bug has been moved to www.openArchitectureWare.org/bugzilla. This action is part of a batch process. We apologize if you received many mails due to this action.