Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Multiple inheritance in EMF -> XSD
Multiple inheritance in EMF -> XSD [message #58474] Thu, 10 March 2005 15:32 Go to next message
Eclipse UserFriend
Originally posted by: h.u.com

I have a task of converting an EMF Ecore model into XSD. I've looked into
using the EcoreXMLSchemaBuilder and I see that when it encounters multiple
inheritance in the ecore model, it takes the first superclass and creates an
extension. I have included the code that I found in the processClass method
of this utility.

if (superClasses.size() > 0)
{
xsdComplexTypeDefinition.setDerivationMethod(XSDDerivationMe thod.EXTENSION_LITERAL);
EClass superClass = (EClass)superClasses.get(0);

if (superClass.getEPackage() == ePackage)
{
xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.res olveTypeDefinition(getName(superClass)));
}
else
{
xsdComplexTypeDefinition.setBaseTypeDefinition(typeInOtherSc hema(superClass));
}
}


I understand that there is no formal structure for multiple inheritance in
XSD. Would it be possible to use named model groups for each of the multiple
superclasses, and let the subclass refer to both named groups? Are there any
elegant widely accepted ways to model this type of structure in XSD?

Thanks,
Hayden Marchant
Re: Multiple inheritance in EMF -> XSD [message #58479 is a reply to message #58474] Thu, 10 March 2005 17:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Hayden,

The problem of expressing multiple inheritance in XML Schema is
basically unsolvable. One could generate and use model groups (and
attribute groups) to reduce duplication of features, but xsi:type
substitutability will still be broken. You'd need to be especially
careful about diamond inheritance, i.e, that it doesn't result in
duplication...


Hayden Marchant wrote:

>I have a task of converting an EMF Ecore model into XSD. I've looked into
>using the EcoreXMLSchemaBuilder and I see that when it encounters multiple
>inheritance in the ecore model, it takes the first superclass and creates an
>extension. I have included the code that I found in the processClass method
>of this utility.
>
> if (superClasses.size() > 0)
> {
> xsdComplexTypeDefinition.setDerivationMethod(XSDDerivationMe thod.EXTENSION_LITERAL);
> EClass superClass = (EClass)superClasses.get(0);
>
> if (superClass.getEPackage() == ePackage)
> {
> xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.res olveTypeDefinition(getName(superClass)));
> }
> else
> {
> xsdComplexTypeDefinition.setBaseTypeDefinition(typeInOtherSc hema(superClass));
> }
> }
>
>
> I understand that there is no formal structure for multiple inheritance in
>XSD. Would it be possible to use named model groups for each of the multiple
>superclasses, and let the subclass refer to both named groups? Are there any
>elegant widely accepted ways to model this type of structure in XSD?
>
>Thanks,
>Hayden Marchant
>
>
>
>
Re: Multiple inheritance in EMF -> XSD [message #58483 is a reply to message #58479] Fri, 11 March 2005 11:32 Go to previous message
Eclipse UserFriend
Originally posted by: h.u.com

that what I thought - I was just hoping for a bit of a miracle. OK, I
suppose I'll have set the expectations low for Multiple-inheritance in XSD
then :(

Thanks,
Hayden
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:d0q09f$62o$1@www.eclipse.org...
> Hayden,
>
> The problem of expressing multiple inheritance in XML Schema is basically
> unsolvable. One could generate and use model groups (and attribute
> groups) to reduce duplication of features, but xsi:type substitutability
> will still be broken. You'd need to be especially careful about diamond
> inheritance, i.e, that it doesn't result in duplication...
>
>
> Hayden Marchant wrote:
>
>>I have a task of converting an EMF Ecore model into XSD. I've looked into
>>using the EcoreXMLSchemaBuilder and I see that when it encounters multiple
>>inheritance in the ecore model, it takes the first superclass and creates
>>an extension. I have included the code that I found in the processClass
>>method of this utility.
>>
>> if (superClasses.size() > 0)
>> {
>>
>> xsdComplexTypeDefinition.setDerivationMethod(XSDDerivationMe thod.EXTENSION_LITERAL);
>> EClass superClass = (EClass)superClasses.get(0);
>>
>> if (superClass.getEPackage() == ePackage)
>> {
>>
>> xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.res olveTypeDefinition(getName(superClass)));
>> }
>> else
>> {
>>
>> xsdComplexTypeDefinition.setBaseTypeDefinition(typeInOtherSc hema(superClass));
>> }
>> }
>>
>>
>> I understand that there is no formal structure for multiple inheritance
>> in XSD. Would it be possible to use named model groups for each of the
>> multiple superclasses, and let the subclass refer to both named groups?
>> Are there any elegant widely accepted ways to model this type of
>> structure in XSD?
>>
>>Thanks,
>>Hayden Marchant
>>
>>
Re: Multiple inheritance in EMF -> XSD [message #594436 is a reply to message #58474] Thu, 10 March 2005 17:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Hayden,

The problem of expressing multiple inheritance in XML Schema is
basically unsolvable. One could generate and use model groups (and
attribute groups) to reduce duplication of features, but xsi:type
substitutability will still be broken. You'd need to be especially
careful about diamond inheritance, i.e, that it doesn't result in
duplication...


Hayden Marchant wrote:

>I have a task of converting an EMF Ecore model into XSD. I've looked into
>using the EcoreXMLSchemaBuilder and I see that when it encounters multiple
>inheritance in the ecore model, it takes the first superclass and creates an
>extension. I have included the code that I found in the processClass method
>of this utility.
>
> if (superClasses.size() > 0)
> {
> xsdComplexTypeDefinition.setDerivationMethod(XSDDerivationMe thod.EXTENSION_LITERAL);
> EClass superClass = (EClass)superClasses.get(0);
>
> if (superClass.getEPackage() == ePackage)
> {
> xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.res olveTypeDefinition(getName(superClass)));
> }
> else
> {
> xsdComplexTypeDefinition.setBaseTypeDefinition(typeInOtherSc hema(superClass));
> }
> }
>
>
> I understand that there is no formal structure for multiple inheritance in
>XSD. Would it be possible to use named model groups for each of the multiple
>superclasses, and let the subclass refer to both named groups? Are there any
>elegant widely accepted ways to model this type of structure in XSD?
>
>Thanks,
>Hayden Marchant
>
>
>
>
Re: Multiple inheritance in EMF -> XSD [message #594462 is a reply to message #58479] Fri, 11 March 2005 11:32 Go to previous message
Hayden Marchant is currently offline Hayden MarchantFriend
Messages: 90
Registered: July 2009
Member
that what I thought - I was just hoping for a bit of a miracle. OK, I
suppose I'll have set the expectations low for Multiple-inheritance in XSD
then :(

Thanks,
Hayden
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:d0q09f$62o$1@www.eclipse.org...
> Hayden,
>
> The problem of expressing multiple inheritance in XML Schema is basically
> unsolvable. One could generate and use model groups (and attribute
> groups) to reduce duplication of features, but xsi:type substitutability
> will still be broken. You'd need to be especially careful about diamond
> inheritance, i.e, that it doesn't result in duplication...
>
>
> Hayden Marchant wrote:
>
>>I have a task of converting an EMF Ecore model into XSD. I've looked into
>>using the EcoreXMLSchemaBuilder and I see that when it encounters multiple
>>inheritance in the ecore model, it takes the first superclass and creates
>>an extension. I have included the code that I found in the processClass
>>method of this utility.
>>
>> if (superClasses.size() > 0)
>> {
>>
>> xsdComplexTypeDefinition.setDerivationMethod(XSDDerivationMe thod.EXTENSION_LITERAL);
>> EClass superClass = (EClass)superClasses.get(0);
>>
>> if (superClass.getEPackage() == ePackage)
>> {
>>
>> xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.res olveTypeDefinition(getName(superClass)));
>> }
>> else
>> {
>>
>> xsdComplexTypeDefinition.setBaseTypeDefinition(typeInOtherSc hema(superClass));
>> }
>> }
>>
>>
>> I understand that there is no formal structure for multiple inheritance
>> in XSD. Would it be possible to use named model groups for each of the
>> multiple superclasses, and let the subclass refer to both named groups?
>> Are there any elegant widely accepted ways to model this type of
>> structure in XSD?
>>
>>Thanks,
>>Hayden Marchant
>>
>>
Previous Topic:Preferences: XML Catalog - problem with relative schemaLocation's
Next Topic:Preferences: XML Catalog - problem with relative schemaLocation's
Goto Forum:
  


Current Time: Sat Nov 22 17:05:27 GMT 2014

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

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