Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EuGENia]
[EuGENia] [message #498724] Wed, 18 November 2009 11:55 Go to next message
Eclipse UserFriend
Originally posted by: arendt.mathematik.uni-marburg.de

Hi,

Using EuGENia two questions arose when specifying source and target of a
link:
1. How can I specify elements in an EList?
2. How can I navigate to other related EClasses?

Consider the following example:

class Classifier{}

@gmf.node
class Class extends Classifier{}

class Property extends Classifier{
ref Classifier type;
}

If I want to specify Associations like in UML, I think of this solution:

@gmf.link(source=X, target=Y)
class Association {
val Property[2] ownedEnds;
}

where X had to be set to "ownedEnds.get(0).getType()" or something like
this. Who can help to specify X and Y???

Regards,
Thorsten
Re: [EuGENia] [message #498725 is a reply to message #498724] Wed, 18 November 2009 12:14 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Thorsten,

It seems that setting both the source and target to "ownedEnds" doesn't
work. I'd recommend trying to create two derived features and setting
them as the source and target of the link respectively:

@gmf.link(source="source", target="target", label="name")
class Association {
ref Property[2] ownedEnds;
derived ref Property source;
derived ref Property target;
}

You'll then need to implement the logic in which the features are
derived from ownedEnds by customizing the generated EMF code - don't
forget to set @generated NOT in the methods you change. I must admit I
haven't tried it but it should work. Please let me know if it doesn't
and I'll have a closer look.

Cheers,
Dimitris

Thorsten Arendt wrote:
> Hi,
>
> Using EuGENia two questions arose when specifying source and target of a
> link:
> 1. How can I specify elements in an EList?
> 2. How can I navigate to other related EClasses?
>
> Consider the following example:
>
> class Classifier{}
>
> @gmf.node
> class Class extends Classifier{}
>
> class Property extends Classifier{
> ref Classifier type;
> }
>
> If I want to specify Associations like in UML, I think of this solution:
>
> @gmf.link(source=X, target=Y)
> class Association {
> val Property[2] ownedEnds;
> }
>
> where X had to be set to "ownedEnds.get(0).getType()" or something like
> this. Who can help to specify X and Y???
>
> Regards,
> Thorsten


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: [EuGENia] [message #498733 is a reply to message #498725] Wed, 18 November 2009 12:54 Go to previous message
Eclipse UserFriend
Originally posted by: arendt.mathematik.uni-marburg.de

Hi Dimitris,

Thanks a lot, it works!
I specified in the model:

@gmf.link(source="source", target="target")
class Association {
val Property[2] ownedEnds;
derived ref Classifier source;
derived ref Classifier target;
}

.... and implemented in AssociationImpl.java:

public Classifier getSource(){
return getOwnedEnd().get(0).getType();
}

public Classifier getTarget(){
return getOwnedEnd().get(1).getType();
}

Best regards,
Thorsten



Dimitris Kolovos schrieb:
> Hi Thorsten,
>
> It seems that setting both the source and target to "ownedEnds" doesn't
> work. I'd recommend trying to create two derived features and setting
> them as the source and target of the link respectively:
>
> @gmf.link(source="source", target="target", label="name")
> class Association {
> ref Property[2] ownedEnds;
> derived ref Property source;
> derived ref Property target;
> }
>
> You'll then need to implement the logic in which the features are
> derived from ownedEnds by customizing the generated EMF code - don't
> forget to set @generated NOT in the methods you change. I must admit I
> haven't tried it but it should work. Please let me know if it doesn't
> and I'll have a closer look.
>
> Cheers,
> Dimitris
>
> Thorsten Arendt wrote:
>> Hi,
>>
>> Using EuGENia two questions arose when specifying source and target of a
>> link:
>> 1. How can I specify elements in an EList?
>> 2. How can I navigate to other related EClasses?
>>
>> Consider the following example:
>>
>> class Classifier{}
>>
>> @gmf.node
>> class Class extends Classifier{}
>>
>> class Property extends Classifier{
>> ref Classifier type;
>> }
>>
>> If I want to specify Associations like in UML, I think of this solution:
>>
>> @gmf.link(source=X, target=Y)
>> class Association {
>> val Property[2] ownedEnds;
>> }
>>
>> where X had to be set to "ownedEnds.get(0).getType()" or something like
>> this. Who can help to specify X and Y???
>>
>> Regards,
>> Thorsten
>
>
Re: [EuGENia] [message #582980 is a reply to message #498724] Wed, 18 November 2009 12:14 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Thorsten,

It seems that setting both the source and target to "ownedEnds" doesn't
work. I'd recommend trying to create two derived features and setting
them as the source and target of the link respectively:

@gmf.link(source="source", target="target", label="name")
class Association {
ref Property[2] ownedEnds;
derived ref Property source;
derived ref Property target;
}

You'll then need to implement the logic in which the features are
derived from ownedEnds by customizing the generated EMF code - don't
forget to set @generated NOT in the methods you change. I must admit I
haven't tried it but it should work. Please let me know if it doesn't
and I'll have a closer look.

Cheers,
Dimitris

Thorsten Arendt wrote:
> Hi,
>
> Using EuGENia two questions arose when specifying source and target of a
> link:
> 1. How can I specify elements in an EList?
> 2. How can I navigate to other related EClasses?
>
> Consider the following example:
>
> class Classifier{}
>
> @gmf.node
> class Class extends Classifier{}
>
> class Property extends Classifier{
> ref Classifier type;
> }
>
> If I want to specify Associations like in UML, I think of this solution:
>
> @gmf.link(source=X, target=Y)
> class Association {
> val Property[2] ownedEnds;
> }
>
> where X had to be set to "ownedEnds.get(0).getType()" or something like
> this. Who can help to specify X and Y???
>
> Regards,
> Thorsten


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: [EuGENia] [message #582998 is a reply to message #498725] Wed, 18 November 2009 12:54 Go to previous message
Eclipse UserFriend
Originally posted by: arendt.mathematik.uni-marburg.de

Hi Dimitris,

Thanks a lot, it works!
I specified in the model:

@gmf.link(source="source", target="target")
class Association {
val Property[2] ownedEnds;
derived ref Classifier source;
derived ref Classifier target;
}

.... and implemented in AssociationImpl.java:

public Classifier getSource(){
return getOwnedEnd().get(0).getType();
}

public Classifier getTarget(){
return getOwnedEnd().get(1).getType();
}

Best regards,
Thorsten



Dimitris Kolovos schrieb:
> Hi Thorsten,
>
> It seems that setting both the source and target to "ownedEnds" doesn't
> work. I'd recommend trying to create two derived features and setting
> them as the source and target of the link respectively:
>
> @gmf.link(source="source", target="target", label="name")
> class Association {
> ref Property[2] ownedEnds;
> derived ref Property source;
> derived ref Property target;
> }
>
> You'll then need to implement the logic in which the features are
> derived from ownedEnds by customizing the generated EMF code - don't
> forget to set @generated NOT in the methods you change. I must admit I
> haven't tried it but it should work. Please let me know if it doesn't
> and I'll have a closer look.
>
> Cheers,
> Dimitris
>
> Thorsten Arendt wrote:
>> Hi,
>>
>> Using EuGENia two questions arose when specifying source and target of a
>> link:
>> 1. How can I specify elements in an EList?
>> 2. How can I navigate to other related EClasses?
>>
>> Consider the following example:
>>
>> class Classifier{}
>>
>> @gmf.node
>> class Class extends Classifier{}
>>
>> class Property extends Classifier{
>> ref Classifier type;
>> }
>>
>> If I want to specify Associations like in UML, I think of this solution:
>>
>> @gmf.link(source=X, target=Y)
>> class Association {
>> val Property[2] ownedEnds;
>> }
>>
>> where X had to be set to "ownedEnds.get(0).getType()" or something like
>> this. Who can help to specify X and Y???
>>
>> Regards,
>> Thorsten
>
>
Previous Topic:[EuGENia]
Next Topic:EVL validation is working, EMF is not
Goto Forum:
  


Current Time: Fri Apr 26 08:32:47 GMT 2024

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

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

Back to the top