Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » xsd annotation to specify external interface?
xsd annotation to specify external interface? [message #415086] Thu, 29 November 2007 08:55 Go to next message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Hi,

Is there an "ecore:.." annotation I can use in an XML schema to indicate
that the generated interface should extend a non-generated, external
interface? That is, is there an analog to "@extends" annotation in
Javadoc comment?

Thanks, chris
Re: xsd annotation to specify external interface? [message #415087 is a reply to message #415086] Thu, 29 November 2007 09:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31158
Registered: July 2009
Senior Member
Chris,

You can define a complex type and specify ecore:instanceClass on it to
specify the external interface it represents. You can also use
ecore:implements to specify multiple inheritance (additional
eSuperTypes) which could of course refer to another complex type with
the ecore:instanceClass that specifies some external type. This isn't
really an analog for @extends since that's purely a feature to drive
JMerge so that one can avoid having the information about the
inheritance in the model yet still have it in the generated code.


Chris Giblin wrote:
> Hi,
>
> Is there an "ecore:.." annotation I can use in an XML schema to
> indicate that the generated interface should extend a non-generated,
> external interface? That is, is there an analog to "@extends"
> annotation in Javadoc comment?
>
> Thanks, chris
Re: xsd annotation to specify external interface? [message #415088 is a reply to message #415087] Thu, 29 November 2007 09:23 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Thanks Ed!
Is "ecore:implements" sounds like just what I need. Is it documented and
I overlooked it?
Thanks, chris


Ed Merks wrote:
> Chris,
>
> You can define a complex type and specify ecore:instanceClass on it to
> specify the external interface it represents. You can also use
> ecore:implements to specify multiple inheritance (additional
> eSuperTypes) which could of course refer to another complex type with
> the ecore:instanceClass that specifies some external type. This isn't
> really an analog for @extends since that's purely a feature to drive
> JMerge so that one can avoid having the information about the
> inheritance in the model yet still have it in the generated code.
>
>
> Chris Giblin wrote:
>> Hi,
>>
>> Is there an "ecore:.." annotation I can use in an XML schema to
>> indicate that the generated interface should extend a non-generated,
>> external interface? That is, is there an analog to "@extends"
>> annotation in Javadoc comment?
>>
>> Thanks, chris
Re: xsd annotation to specify external interface? [message #415089 is a reply to message #415088] Thu, 29 November 2007 09:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31158
Registered: July 2009
Senior Member
Chris,

No, I've not kept the mapping document up to date. It's in the book
chapter for the next version of the book and we're asking the publishers
to allow us to make some of these reference chapters available on the
website.


Chris Giblin wrote:
> Thanks Ed!
> Is "ecore:implements" sounds like just what I need. Is it documented
> and I overlooked it?
> Thanks, chris
>
>
> Ed Merks wrote:
>> Chris,
>>
>> You can define a complex type and specify ecore:instanceClass on it
>> to specify the external interface it represents. You can also use
>> ecore:implements to specify multiple inheritance (additional
>> eSuperTypes) which could of course refer to another complex type with
>> the ecore:instanceClass that specifies some external type. This
>> isn't really an analog for @extends since that's purely a feature to
>> drive JMerge so that one can avoid having the information about the
>> inheritance in the model yet still have it in the generated code.
>>
>>
>> Chris Giblin wrote:
>>> Hi,
>>>
>>> Is there an "ecore:.." annotation I can use in an XML schema to
>>> indicate that the generated interface should extend a non-generated,
>>> external interface? That is, is there an analog to "@extends"
>>> annotation in Javadoc comment?
>>>
>>> Thanks, chris
Re: xsd annotation to specify external interface? [message #415091 is a reply to message #415089] Thu, 29 November 2007 09:49 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Hi Ed,
Thanks for the info the documentation.

Problem. I added "ecore:implements" to my schema, perform "reload" on
the genmodel and generated. The interface to implement does not appear
in the target code.

Here is how I use the annotation:

<xs:complexType name="SomeIdReferenceType"
ecore:name="SomeIdReference"
ecore:implements="com.abc.SomeElement">
<xs:simpleContent>
<xs:extension base="abc:IdReferenceType"/>
</xs:simpleContent>
</xs:complexType>

I get:
public interface SomeIdReference extends IdReference {

instead of:

public interface SomeIdReference extends IdReference,SomeElement {


Thanks,
-chris
Ed Merks wrote:
> Chris,
>
> No, I've not kept the mapping document up to date. It's in the book
> chapter for the next version of the book and we're asking the publishers
> to allow us to make some of these reference chapters available on the
> website.
>
>
> Chris Giblin wrote:
>> Thanks Ed!
>> Is "ecore:implements" sounds like just what I need. Is it documented
>> and I overlooked it?
>> Thanks, chris
>>
>>
>> Ed Merks wrote:
>>> Chris,
>>>
>>> You can define a complex type and specify ecore:instanceClass on it
>>> to specify the external interface it represents. You can also use
>>> ecore:implements to specify multiple inheritance (additional
>>> eSuperTypes) which could of course refer to another complex type with
>>> the ecore:instanceClass that specifies some external type. This
>>> isn't really an analog for @extends since that's purely a feature to
>>> drive JMerge so that one can avoid having the information about the
>>> inheritance in the model yet still have it in the generated code.
>>>
>>>
>>> Chris Giblin wrote:
>>>> Hi,
>>>>
>>>> Is there an "ecore:.." annotation I can use in an XML schema to
>>>> indicate that the generated interface should extend a non-generated,
>>>> external interface? That is, is there an analog to "@extends"
>>>> annotation in Javadoc comment?
>>>>
>>>> Thanks, chris
Re: xsd annotation to specify external interface? [message #415092 is a reply to message #415091] Thu, 29 November 2007 10:02 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31158
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070006020801010509030408
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Chris,

I guess I didn't describe it so well. :-P The value of the implements
must be a QName just like one that would work in base="...".

<xs:complexType name="SomeElement"
ecore:instanceClass="com.abc.SomeElement"/>
<xs:complexType name="SomeIdReferenceType"
ecore:name="SomeIdReference"
ecore:implements="abc:SomeElement">

The annotations even support generics:

Modeling Generics With XML Schema
< http://ed-merks.blogspot.com/2007/06/modeling-generics-with- xml-schema.html>

And it's even possible to express EOperations directly in the schemas,
including their body annotation. A good way to learn about them is
write a simple Ecore model and use the correspond GenModel to export to
an XML Schema. I've tried to ensure that Ecore -> XML Schema -> Ecore
is a round trip...


Chris Giblin wrote:
> Hi Ed,
> Thanks for the info the documentation.
>
> Problem. I added "ecore:implements" to my schema, perform "reload" on
> the genmodel and generated. The interface to implement does not appear
> in the target code.
>
> Here is how I use the annotation:
>
> <xs:complexType name="SomeIdReferenceType"
> ecore:name="SomeIdReference"
> ecore:implements="com.abc.SomeElement">
> <xs:simpleContent>
> <xs:extension base="abc:IdReferenceType"/>
> </xs:simpleContent>
> </xs:complexType>
>
> I get:
> public interface SomeIdReference extends IdReference {
>
> instead of:
>
> public interface SomeIdReference extends IdReference,SomeElement {
>
>
> Thanks,
> -chris
> Ed Merks wrote:
>> Chris,
>>
>> No, I've not kept the mapping document up to date. It's in the book
>> chapter for the next version of the book and we're asking the
>> publishers to allow us to make some of these reference chapters
>> available on the website.
>>
>>
>> Chris Giblin wrote:
>>> Thanks Ed!
>>> Is "ecore:implements" sounds like just what I need. Is it documented
>>> and I overlooked it?
>>> Thanks, chris
>>>
>>>
>>> Ed Merks wrote:
>>>> Chris,
>>>>
>>>> You can define a complex type and specify ecore:instanceClass on it
>>>> to specify the external interface it represents. You can also use
>>>> ecore:implements to specify multiple inheritance (additional
>>>> eSuperTypes) which could of course refer to another complex type
>>>> with the ecore:instanceClass that specifies some external type.
>>>> This isn't really an analog for @extends since that's purely a
>>>> feature to drive JMerge so that one can avoid having the
>>>> information about the inheritance in the model yet still have it in
>>>> the generated code.
>>>>
>>>>
>>>> Chris Giblin wrote:
>>>>> Hi,
>>>>>
>>>>> Is there an "ecore:.." annotation I can use in an XML schema to
>>>>> indicate that the generated interface should extend a
>>>>> non-generated, external interface? That is, is there an analog to
>>>>> "@extends" annotation in Javadoc comment?
>>>>>
>>>>> Thanks, chris


--------------070006020801010509030408
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Chris,<br>
<br>
I guess I didn't describe it so well.&nbsp; :-P&nbsp; The value of the implements
must be a QName just like one that would work in base="...".<br>
<blockquote>&lt;xs:complexType name="SomeElement"&nbsp;
ecore:instanceClass="com.abc.SomeElement"/&gt;<br>
&lt;xs:complexType name="SomeIdReferenceType"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; ecore:name="SomeIdReference"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; ecore:implements="abc:SomeElement"&gt;
<br>
</blockquote>
The annotations even support generics:<br>
<blockquote><a
href=" http://ed-merks.blogspot.com/2007/06/modeling-generics-with- xml-schema.html">Modeling
Generics With XML Schema</a><br>
</blockquote>
And it's even possible to express EOperations directly in the schemas,
including their body annotation.&nbsp; A good way to learn about them is
write a simple Ecore model and use the correspond GenModel to export to
an XML Schema.&nbsp; I've tried to ensure that Ecore -&gt; XML Schema -&gt;
Ecore is a round trip...<br>
<br>
<br>
Chris Giblin wrote:
<blockquote cite="mid:fim1v3$hh$1@build.eclipse.org" type="cite">Hi Ed,
<br>
Thanks for the info the documentation.
<br>
<br>
Problem. I added "ecore:implements" to my schema, perform "reload" on
the genmodel and generated. The interface to implement does not appear
in the target code.
<br>
<br>
Here is how I use the annotation:
<br>
<br>
&lt;xs:complexType name="SomeIdReferenceType"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; ecore:name="SomeIdReference"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; ecore:implements="com.abc.SomeElement"&gt;
<br>
&nbsp;&lt;xs:simpleContent&gt;
<br>
&nbsp; &lt;xs:extension base="abc:IdReferenceType"/&gt;
<br>
&nbsp;&lt;/xs:simpleContent&gt;
<br>
&lt;/xs:complexType&gt;
<br>
<br>
I get:
<br>
&nbsp;public interface SomeIdReference extends IdReference {
<br>
<br>
instead of:
<br>
<br>
&nbsp;public interface SomeIdReference extends IdReference,SomeElement {
<br>
<br>
<br>
Thanks,
<br>
-chris
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Chris,
<br>
<br>
No, I've not kept the mapping document up to date.&nbsp; It's in the book
chapter for the next version of the book and we're asking the
publishers to allow us to make some of these reference chapters
available on the website.
<br>
<br>
<br>
Chris Giblin wrote:
<br>
<blockquote type="cite">Thanks Ed!
<br>
Is "ecore:implements" sounds like just what I need. Is it documented
and I overlooked it?
<br>
Thanks, chris
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Chris,
<br>
<br>
You can define a complex type and specify ecore:instanceClass on it to
specify the external interface it represents.&nbsp; You can also use
ecore:implements to specify multiple inheritance (additional
eSuperTypes) which could of course refer to another complex type with
the ecore:instanceClass that specifies some external type.&nbsp; This isn't
really an analog for @extends since that's purely a feature to drive
JMerge so that one can avoid having the information about the
inheritance in the model yet still have it in the generated code.
<br>
<br>
<br>
Chris Giblin wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
Is there an "ecore:.." annotation I can use in an XML schema to
indicate that the generated interface should extend a non-generated,
external interface? That is, is there an analog to "@extends"
annotation in Javadoc comment?
<br>
<br>
Thanks, chris
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------070006020801010509030408--
Previous Topic:Databinding Controls
Next Topic:Change of Focus when element is deleted from EMF editor
Goto Forum:
  


Current Time: Sat May 30 06:33:07 GMT 2020

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

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

Back to the top