Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » bi Directional Cross-Document Reference
bi Directional Cross-Document Reference [message #1067339] Mon, 08 July 2013 06:57 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

is it possible biDirectional cross-document referance ?

I m searching but cant find any sample.

Regards

[Updated on: Mon, 08 July 2013 07:00]

Report message to a moderator

Re: bidirectional Cross-Document Reference [message #1067343 is a reply to message #1067339] Mon, 08 July 2013 07:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Yes, it's possible. Just try it.

On 08/07/2013 12:57 PM, serhat gezgin wrote:
> Hi all,
>
> is it possible biDirectional cross-document referance ?
>
> I m searching but cant find any sample.
>
> Regards
Re: bidirectional Cross-Document Reference [message #1067346 is a reply to message #1067343] Mon, 08 July 2013 07:31 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
But i have a.ecore on project A and

b.ecore on project B so if i done cross Document Referance java projects give me a error like ;

"A cycle was detected in the built path......" reference plug-in error.

So i cant use each metamodels Model codes. How can i solve this (i make dsl for each ecore files. so project must be seperate (XTEXT))

Regards

[Updated on: Mon, 08 July 2013 07:32]

Report message to a moderator

Re: bidirectional Cross-Document Reference [message #1067363 is a reply to message #1067346] Mon, 08 July 2013 08:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Serhat,

Comments below.

On 08/07/2013 1:31 PM, serhat gezgin wrote:
> But i have a.ecore on project A and
>
> b.ecore on project B so if i done cross Document Referance java
> projects give me a error like ;
>
> "A cycle was detected in the built path......" reference plug-in error.
>
> How can i solve this (i make dsl for each ecore files. so project must
> be seperate (XTEXT))
They can't be in separate projects if those projects need to be mutually
dependent; dependencies must form a DAG. That's true even for Java
code you write yourself.
>
> Regards
Re: bidirectional Cross-Document Reference [message #1067376 is a reply to message #1067346] Mon, 08 July 2013 09:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

You can break the cycle by making the looped reference to a common
abstract type.

Regards

Ed Willink

On 08/07/2013 12:31, serhat gezgin wrote:
> But i have a.ecore on project A and
>
> b.ecore on project B so if i done cross Document Referance java
> projects give me a error like ;
>
> "A cycle was detected in the built path......" reference plug-in error.
>
> How can i solve this (i make dsl for each ecore files. so project must
> be seperate (XTEXT))
>
> Regards
Re: bidirectional Cross-Document Reference [message #1067381 is a reply to message #1067376] Mon, 08 July 2013 09:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Then the types of the references would be of some unhelpful type and
there would be all the overhead of a third model. Of course all this
begs the question of why there are two models when they're
interdependent anyway...


On 08/07/2013 3:06 PM, Ed Willink wrote:
> Hi
>
> You can break the cycle by making the looped reference to a common
> abstract type.
>
> Regards
>
> Ed Willink
>
> On 08/07/2013 12:31, serhat gezgin wrote:
>> But i have a.ecore on project A and
>>
>> b.ecore on project B so if i done cross Document Referance java
>> projects give me a error like ;
>>
>> "A cycle was detected in the built path......" reference plug-in error.
>>
>> How can i solve this (i make dsl for each ecore files. so project
>> must be seperate (XTEXT))
>>
>> Regards
>
Re: bidirectional Cross-Document Reference [message #1067400 is a reply to message #1067381] Mon, 08 July 2013 10:13 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
Hi,

i dont undestand. How can i break the cycle by making the looped reference to a common

abstract type ?

Re: bidirectional Cross-Document Reference [message #1067411 is a reply to message #1067400] Mon, 08 July 2013 10:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
I assume he means that you could define another model with classes A and
B with a bidirectional reference between them and then you've you second
and third model respective classes inherit from A and B. It seems like
an ugly solution and in the end, the references are no longer typed
according to the types in the two models you already have. So the
questions remains: 1) why do you need two separate models? 2) and if
you really do, why aren't they truly separate but rather mutually dependant?

On 08/07/2013 4:13 PM, serhat gezgin wrote:
> Hi,
>
> i dont undestand. How can i break the cycle by making the looped
> reference to a common
> abstract type ?
>
>
Re: bidirectional Cross-Document Reference [message #1067446 is a reply to message #1067411] Mon, 08 July 2013 14:22 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
Hi,

i need 2 dsl for my meta-model because i have 2 veawpoint of my metamodel. If i don't seperate this metamodel to viewPoints my dsl(xtext) became useless because dsl program file become not readable cause of being too long.

and i think on a xtext project i can only generate one dsl.

so i am confused

[Updated on: Mon, 08 July 2013 14:26]

Report message to a moderator

Re: bidirectional Cross-Document Reference [message #1067455 is a reply to message #1067446] Mon, 08 July 2013 15:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Serhat,

Best you asked clear direct questions on the Xtext newsgroup. E.g., can
I have more than one grammar for just one Ecore model? My impression is
that you can define any number of grammars for a single model, but only
if you don't expect Xtext to generate the model from the grammar, but
best you ask direct questions like that where the questions below.


On 08/07/2013 8:22 PM, serhat gezgin wrote:
> Hi,
>
> i need 2 dsl for my meta-model because i have 2 veawpoint of my
> metamodel if i dont seperate this viewPoints my dsl(xtext) became
> useless because dsl program file become not readable cause of being
> too long
>
> and i think on xtext project i can only generate one dsl.
>
> so i am confused
>
>
Re: bidirectional Cross-Document Reference [message #1078567 is a reply to message #1067455] Sat, 03 August 2013 03:04 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad Adavani
Messages: 100
Registered: July 2013
Location: Bangalore
Senior Member
Hi,
I am using .xcore file as meta model for my grammar, which looks something like this,

class Sample{
Integer bit
....
.....
....
}

And my grammar:
Sample:
'Sample'....
....

('BIT' | 'BYTE') bit=INT

This "bit=INT" I am referring from my xcore model.
MY PROBLEM IS THAT I WANT TO EITHER TYPE "BIT AND THEN BIT VALUE" OR "BYTE AND THEN BYTE VALUE" IN MY LANGUAGE.
BUT WHEN I WRITE "BYTE AND BYTE VALUE" , I AM CONVERTING BITS INTO BYTES AND THEN STORING IT IN SAME METAMODEL FIELD "bit".
SO LATER WHEN I READ THE "RESOURCE" I WILL GET THE BIT VALUE BUT I AM UNAWARE WHETHER IT IS "BIT OR BYTE"...
"I DON'T WANT TO STORE ONE MORE VARIABLE FOR BYTE IN XCORE".
CAN ANYONE HELP ME OUT WITH THIS PROBLEM ? OR ANY BETTER SUGGESTIONS FOR THIS ??
Thanks in advance ! Smile


Arshad
Re: bidirectional Cross-Document Reference [message #1078611 is a reply to message #1078567] Sat, 03 August 2013 04:34 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Arshad,

Comments below.

On 03/08/2013 9:04 AM, Arshad Adavani wrote:
> Hi,
> I am using .xcore file as meta model for my grammar, which looks
> something like this,
>
> class Sample{
> Integer bit
> ...
> ....
> ...
> }
>
> And my grammar:
> Sample:
> 'Sample'....
> ...
>
> ('BIT' | 'BYTE') bit=INT
> This "bit=INT" I am referring from my xcore model.
> MY PROBLEM IS THAT I WANT TO EITHER TYPE "BIT AND THEN BIT VALUE" OR
> "BYTE AND THEN BYTE VALUE" IN MY LANGUAGE.
> BUT WHEN I WRITE "BYTE AND BYTE VALUE" , I AM CONVERTING BITS INTO
> BYTES AND THEN STORING IT IN SAME METAMODEL FIELD "bit".
> SO LATER WHEN I READ THE "RESOURCE" I WILL GET THE BIT VALUE BUT I AM
> UNAWARE WHETHER IT IS "BIT OR BYTE"...
> "I DON'T WANT TO STORE ONE MORE VARIABLE FOR BYTE IN XCORE".
> CAN ANYONE HELP ME OUT WITH THIS PROBLEM ? OR ANY BETTER SUGGESTIONS
> FOR THIS ??
If I understand correctly, your model has no way to record or to know
whether you've represented the value in the grammar as bit or byte. So,
given just an instance of a Sample with a field of type Integer (why not
use int?) you'd have no way to know how that should be serialized
according to your grammar as either a BIT or a BYTE. You need something
else in your model to record such information, e.g., a boolean field or
an enum field for recording the BIT verses BYTE keyword.
> Thanks in advance ! :)
Previous Topic:TENEO COLUMN NAME GENERATION
Next Topic:Ecore Tools and Xcore Problem and Synchronization
Goto Forum:
  


Current Time: Wed Jul 23 22:26:01 EDT 2014

Powered by FUDForum. Page generated in 0.01887 seconds