Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to cross reference between models.
How to cross reference between models. [message #425676] Thu, 04 December 2008 14:46 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hello,

I require to reference from one Model (A) to Model (B),
It seems this is possible, and EMF would actually generate an editor for
both models? can someone please point to some documentation on how to do
this with XML Schema?

(I haven't tried, but can I use i.e. anyURI to point to a resource in an
other schema?).

<xsd:element name="author" type="xsd:anyURI"
maxOccurs=="10"
ecore:reference="Writer"/>

Thank You / Christophe Bouhier
Re: How to cross reference between models. [message #425684 is a reply to message #425676] Thu, 04 December 2008 15:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30897
Registered: July 2009
Senior Member
Christophe,

Comments below.

Christophe Bouhier wrote:
> Hello,
>
> I require to reference from one Model (A) to Model (B),
> It seems this is possible, and EMF would actually generate an editor
> for both models?
Yes.
> can someone please point to some documentation on how to do this with
> XML Schema?
Even the Library.xsd from the tutorial supports this.
>
> (I haven't tried, but can I use i.e. anyURI to point to a resource in
> an other schema?).
>
> <xsd:element name="author" type="xsd:anyURI"
> maxOccurs=="10"
> ecore:reference="Writer"/>
Exactly. So you can actually create two library files, one with a book
the other with a writer, then use Load Resource... to load either
resource in the other resource's editor. Once you do that, you can
create a reference between the book and the writer the same was if if
they were in the same file and when you save, you'll see how the
references between the resources are stored.
>
> Thank You / Christophe Bouhier
>
>
Re: How to cross reference between models. [message #425700 is a reply to message #425684] Fri, 05 December 2008 10:46 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Ed,
Is this the extended model (Library) tutorial?
This I think is what I need, but how do I do this with two .xsd files?
(The example is for rational rose model).

Thx Christophe


Ed Merks wrote:
> Christophe,
>
> Comments below.
>
> Christophe Bouhier wrote:
>> Hello,
>>
>> I require to reference from one Model (A) to Model (B),
>> It seems this is possible, and EMF would actually generate an editor
>> for both models?
> Yes.
>> can someone please point to some documentation on how to do this with
>> XML Schema?
> Even the Library.xsd from the tutorial supports this.
>>
>> (I haven't tried, but can I use i.e. anyURI to point to a resource in
>> an other schema?).
>>
>> <xsd:element name="author" type="xsd:anyURI"
>> maxOccurs=="10"
>> ecore:reference="Writer"/>
> Exactly. So you can actually create two library files, one with a book
> the other with a writer, then use Load Resource... to load either
> resource in the other resource's editor. Once you do that, you can
> create a reference between the book and the writer the same was if if
> they were in the same file and when you save, you'll see how the
> references between the resources are stored.
>>
>> Thank You / Christophe Bouhier
>>
>>
Re: How to cross reference between models. [message #425709 is a reply to message #425700] Fri, 05 December 2008 11:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30897
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040808000600090105000300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christophe,

The schema in this tutorial supports what I described

Tutorial: Generating an EMF Model using XML Schema
< http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html>

The same approach works with any number of XSD files. Just use
xsd:anyURI along with ecore:reference and you'll end up with a
non-containment EReference that supports cross file references.


Christophe Bouhier wrote:
> Hi Ed,
> Is this the extended model (Library) tutorial?
> This I think is what I need, but how do I do this with two .xsd files?
> (The example is for rational rose model).
>
> Thx Christophe
>
>
> Ed Merks wrote:
>> Christophe,
>>
>> Comments below.
>>
>> Christophe Bouhier wrote:
>>> Hello,
>>>
>>> I require to reference from one Model (A) to Model (B),
>>> It seems this is possible, and EMF would actually generate an editor
>>> for both models?
>> Yes.
>>> can someone please point to some documentation on how to do this
>>> with XML Schema?
>> Even the Library.xsd from the tutorial supports this.
>>>
>>> (I haven't tried, but can I use i.e. anyURI to point to a resource
>>> in an other schema?).
>>>
>>> <xsd:element name="author" type="xsd:anyURI"
>>> maxOccurs=="10"
>>> ecore:reference="Writer"/>
>> Exactly. So you can actually create two library files, one with a
>> book the other with a writer, then use Load Resource... to load
>> either resource in the other resource's editor. Once you do that,
>> you can create a reference between the book and the writer the same
>> was if if they were in the same file and when you save, you'll see
>> how the references between the resources are stored.
>>>
>>> Thank You / Christophe Bouhier
>>>
>>>

--------------040808000600090105000300
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">
Christophe,<br>
<br>
The schema in this tutorial supports what I described<br>
<blockquote><a
href=" http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html">Tutorial:
Generating an EMF Model using XML Schema</a><br>
</blockquote>
The same approach works with any number of XSD files.&nbsp; Just use
xsd:anyURI along with ecore:reference and you'll end up with a
non-containment EReference that supports cross file references.<br>
<br>
<br>
Christophe Bouhier wrote:
<blockquote cite="mid:4939066A.7050608@gmail.com" type="cite">Hi Ed,
<br>
Is this the extended model (Library) tutorial?
<br>
This I think is what I need, but how do I do this with two .xsd files?
<br>
(The example is for rational rose model).
<br>
<br>
Thx Christophe
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Christophe,
<br>
<br>
Comments below.
<br>
<br>
Christophe Bouhier wrote:
<br>
<blockquote type="cite">Hello,
<br>
<br>
I require to reference from one Model (A) to Model (B),
<br>
It seems this is possible, and EMF would actually generate an editor
for both models?
<br>
</blockquote>
Yes.
<br>
<blockquote type="cite">can someone please point to some
documentation on how to do this with XML Schema?
<br>
</blockquote>
Even the Library.xsd from the tutorial supports this.
<br>
<blockquote type="cite"><br>
(I haven't tried, but can I use i.e. anyURI to point to a resource in
an other schema?).
<br>
<br>
&lt;xsd:element name="author" type="xsd:anyURI"
<br>
maxOccurs=="10"
<br>
ecore:reference="Writer"/&gt;
<br>
</blockquote>
Exactly.&nbsp;&nbsp; So you can actually create two library files, one with a
book the other with a writer, then use Load Resource... to load either
resource in the other resource's editor.&nbsp; Once you do that, you can
create a reference between the book and the writer the same was if if
they were in the same file and when you save, you'll see how the
references between the resources are stored.
<br>
<blockquote type="cite"><br>
Thank You / Christophe Bouhier
<br>
<br>
<br>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>

--------------040808000600090105000300--
Re: How to cross reference between models. [message #425712 is a reply to message #425709] Fri, 05 December 2008 12:51 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Ah thanks, I just noticed the fine prints in the wizard page "Specify
one or more....", christophe

Ok, I now have an editor with two packages. I see two extension
parsers are generated, so this is indeed what I need.
Now, what I haven't figured out yet is, if both packages have an element
named "Car", how do I define a unique reference to either "Car" in
package A or in package B? Is it possible by pre-pending a namespace in
the URI of the ecore:reference?

And if this is possible at all, how does the editor handle a case
whereby a referenced element in another resource is not open in the editor?

Many thanks, Christophe





Ed Merks wrote:
> Christophe,
>
> The schema in this tutorial supports what I described
>
> Tutorial: Generating an EMF Model using XML Schema
> < http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html>
>
> The same approach works with any number of XSD files. Just use
> xsd:anyURI along with ecore:reference and you'll end up with a
> non-containment EReference that supports cross file references.
>
>
> Christophe Bouhier wrote:
>> Hi Ed,
>> Is this the extended model (Library) tutorial?
>> This I think is what I need, but how do I do this with two .xsd files?
>> (The example is for rational rose model).
>>
>> Thx Christophe
>>
>>
>> Ed Merks wrote:
>>> Christophe,
>>>
>>> Comments below.
>>>
>>> Christophe Bouhier wrote:
>>>> Hello,
>>>>
>>>> I require to reference from one Model (A) to Model (B),
>>>> It seems this is possible, and EMF would actually generate an editor
>>>> for both models?
>>> Yes.
>>>> can someone please point to some documentation on how to do this
>>>> with XML Schema?
>>> Even the Library.xsd from the tutorial supports this.
>>>>
>>>> (I haven't tried, but can I use i.e. anyURI to point to a resource
>>>> in an other schema?).
>>>>
>>>> <xsd:element name="author" type="xsd:anyURI"
>>>> maxOccurs=="10"
>>>> ecore:reference="Writer"/>
>>> Exactly. So you can actually create two library files, one with a
>>> book the other with a writer, then use Load Resource... to load
>>> either resource in the other resource's editor. Once you do that,
>>> you can create a reference between the book and the writer the same
>>> was if if they were in the same file and when you save, you'll see
>>> how the references between the resources are stored.
>>>>
>>>> Thank You / Christophe Bouhier
>>>>
>>>>
Re: How to cross reference between models. [message #425713 is a reply to message #425712] Fri, 05 December 2008 12:56 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30897
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080302050007060707000209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christophe,

Comments below.


Christophe Bouhier wrote:
> Ah thanks, I just noticed the fine prints in the wizard page "Specify
> one or more....", christophe
>
> Ok, I now have an editor with two packages. I see two extension
> parsers are generated, so this is indeed what I need.
> Now, what I haven't figured out yet is, if both packages have an
> element named "Car", how do I define a unique reference to either
> "Car" in package A or in package B?
Two definitions of Car doesn't sound so good.
> Is it possible by pre-pending a namespace in the URI of the
> ecore:reference?
The value specified in ecore:reference="..." is processed *exactly *is
it would if it appeared in type="...". I.e., it must be a QName and if
it's in a different namespace, the schema must contain an important
(just as it would if you specified the QName in the type="...")...
>
> And if this is possible at all, how does the editor handle a case
> whereby a referenced element in another resource is not open in the
> editor?
Try it and see. :-P

Cross document references are resolved as they are visited and result in
demand loading additional resources into the resource set. So you'll
end up with an editor that's editing multiple resources.
>
> Many thanks, Christophe
>
>
>
>
>
> Ed Merks wrote:
>> Christophe,
>>
>> The schema in this tutorial supports what I described
>>
>> Tutorial: Generating an EMF Model using XML Schema
>>
>> < http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html>
>>
>>
>> The same approach works with any number of XSD files. Just use
>> xsd:anyURI along with ecore:reference and you'll end up with a
>> non-containment EReference that supports cross file references.
>>
>>
>> Christophe Bouhier wrote:
>>> Hi Ed,
>>> Is this the extended model (Library) tutorial?
>>> This I think is what I need, but how do I do this with two .xsd files?
>>> (The example is for rational rose model).
>>>
>>> Thx Christophe
>>>
>>>
>>> Ed Merks wrote:
>>>> Christophe,
>>>>
>>>> Comments below.
>>>>
>>>> Christophe Bouhier wrote:
>>>>> Hello,
>>>>>
>>>>> I require to reference from one Model (A) to Model (B),
>>>>> It seems this is possible, and EMF would actually generate an
>>>>> editor for both models?
>>>> Yes.
>>>>> can someone please point to some documentation on how to do this
>>>>> with XML Schema?
>>>> Even the Library.xsd from the tutorial supports this.
>>>>>
>>>>> (I haven't tried, but can I use i.e. anyURI to point to a resource
>>>>> in an other schema?).
>>>>>
>>>>> <xsd:element name="author" type="xsd:anyURI"
>>>>> maxOccurs=="10"
>>>>> ecore:reference="Writer"/>
>>>> Exactly. So you can actually create two library files, one with a
>>>> book the other with a writer, then use Load Resource... to load
>>>> either resource in the other resource's editor. Once you do that,
>>>> you can create a reference between the book and the writer the same
>>>> was if if they were in the same file and when you save, you'll see
>>>> how the references between the resources are stored.
>>>>>
>>>>> Thank You / Christophe Bouhier
>>>>>
>>>>>
>

--------------080302050007060707000209
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">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Christophe,<br>
<br>
Comments below.<br>
<br>
<br>
Christophe Bouhier wrote:
<blockquote cite="mid:493923D4.4070309@gmail.com" type="cite">Ah
thanks, I just noticed the fine prints in the wizard page "Specify
<br>
one or more....", christophe
<br>
<br>
Ok, I now have an editor with two packages. I see two extension
<br>
parsers are generated, so this is indeed what I need.
<br>
Now, what I haven't figured out yet is, if both packages have an
element named "Car", how do I define a unique reference to either "Car"
in package A or in package B? </blockquote>
Two definitions of Car doesn't sound so good.<br>
<blockquote cite="mid:493923D4.4070309@gmail.com" type="cite">Is it
possible by pre-pending a namespace in the URI of the ecore:reference?
<br>
</blockquote>
The value specified in ecore:reference="..." is processed <b>exactly </b>is
it would if it appeared in type="...".&nbsp; I.e., it must be a QName and if
it's in a different namespace, the schema must contain an important
(just as it would if you specified the QName in the type="...")...<br>
<blockquote cite="mid:493923D4.4070309@gmail.com" type="cite"><br>
And if this is possible at all, how does the editor handle a case
whereby a referenced element in another resource is not open in the
editor?
<br>
</blockquote>
Try it and see. :-P<br>
<br>
Cross document references are resolved as they are visited and result
in demand loading additional resources into the resource set.&nbsp; So
you'll end up with an editor that's editing multiple resources.<br>
<blockquote cite="mid:493923D4.4070309@gmail.com" type="cite"><br>
Many thanks, Christophe
<br>
<br>
<br>
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Christophe,
<br>
<br>
The schema in this tutorial supports what I described
<br>
<br>
&nbsp;&nbsp;&nbsp; Tutorial: Generating an EMF Model using XML Schema
<br>
&nbsp;&nbsp;&nbsp;
<a class="moz-txt-link-rfc2396E" href=" http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html">&lt; http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/xlibmod/xlibmod.html&gt;</a>
<br>
<br>
The same approach works with any number of XSD files.&nbsp; Just use
xsd:anyURI along with ecore:reference and you'll end up with a
non-containment EReference that supports cross file references.
<br>
<br>
<br>
Christophe Bouhier wrote:
<br>
<blockquote type="cite">Hi Ed,
<br>
Is this the extended model (Library) tutorial?
<br>
This I think is what I need, but how do I do this with two .xsd files?
<br>
(The example is for rational rose model).
<br>
<br>
Thx Christophe
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Christophe,
<br>
<br>
Comments below.
<br>
<br>
Christophe Bouhier wrote:
<br>
<blockquote type="cite">Hello,
<br>
<br>
I require to reference from one Model (A) to Model (B),
<br>
It seems this is possible, and EMF would actually generate an editor
for both models?
<br>
</blockquote>
Yes.
<br>
<blockquote type="cite">can someone please point to some
documentation on how to do this with XML Schema?
<br>
</blockquote>
Even the Library.xsd from the tutorial supports this.
<br>
<blockquote type="cite"><br>
(I haven't tried, but can I use i.e. anyURI to point to a resource in
an other schema?).
<br>
<br>
&lt;xsd:element name="author" type="xsd:anyURI"
<br>
maxOccurs=="10"
<br>
ecore:reference="Writer"/&gt;
<br>
</blockquote>
Exactly.&nbsp;&nbsp; So you can actually create two library files, one with a
book the other with a writer, then use Load Resource... to load either
resource in the other resource's editor.&nbsp; Once you do that, you can
create a reference between the book and the writer the same was if if
they were in the same file and when you save, you'll see how the
references between the resources are stored.
<br>
<blockquote type="cite"><br>
Thank You / Christophe Bouhier
<br>
<br>
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
</body>
</html>

--------------080302050007060707000209--
Previous Topic:Questions about Feature Delegation
Next Topic:Number format exception in genrated editor for feature with ExtendetMetaData
Goto Forum:
  


Current Time: Sun Feb 23 16:29:47 GMT 2020

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

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

Back to the top