Multiple inheritance in EMF -> XSD [message #58474] |
Thu, 10 March 2005 10:32  |
Eclipse User |
|
|
|
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 #58483 is a reply to message #58479] |
Fri, 11 March 2005 06:32  |
Eclipse User |
|
|
|
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 12:31  |
Eclipse User |
|
|
|
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 06:32  |
Eclipse User |
|
|
|
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
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03886 seconds