Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Relation-based Edge Sources
Relation-based Edge Sources [message #1611883] Wed, 11 February 2015 17:22 Go to next message
Robbie Simpson is currently offline Robbie SimpsonFriend
Messages: 7
Registered: February 2015
Junior Member
Hi all,

I am working on a relatively simple Sirius project. I have several different types of nodes, linked by some M-N cardinality Relation-Based Edges which are Bi-Directional. I have implemented a simple boolean enabled flag on the nodes, and want to use conditional styles on the edges to indicate which edges are linked to disabled nodes.

For the targets of the edges, this is easy - I can just do [self.enabled=false/], because self on the edges resolves to the actual semantic element. However, I can see no way to determine if the source of the edge is disabled. There does not seem to be anyway to identify the edge using Acceleo, and so I can't determine which source node corresponds to the current edge.

Is their some clever trick I am missing, or are Relation-Based Edges not really intended for bi-directional relationships ? (perhaps I should convert my bi-directional edges to element edges instead?)

Cheers,
Robbie

Re: Relation-based Edge Sources [message #1614445 is a reply to message #1611883] Fri, 13 February 2015 08:45 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
> Hi all,

Hi Robbie,

See my comments below.
>
> I am working on a relatively simple Sirius project. I have several
> different types of nodes, linked by some M-N cardinality Relation-Based
> Edges which are Bi-Directional. I have implemented a simple boolean
> enabled flag on the nodes, and want to use conditional styles on the
> edges to indicate which edges are linked to disabled nodes.
>
> For the targets of the edges, this is easy - I can just do
> [self.enabled=false/], because self on the edges resolves to the actual
> semantic element. However, I can see no way to determine if the source
> of the edge is disabled. There does not seem to be anyway to identify
> the edge using Acceleo, and so I can't determine which source node
> corresponds to the current edge.

The target is accessible by following the relation on which the edge is
based. The Relation Based Edge context is the semantic source on which
the edge Source Mapping is defined.

For instance, if I define an edge based on the "eSuperTypes" relation
(between two EClass), the Target Finder Expression is "[eSuperTypes/]".
If I decide to have a particular edge style if the source is "abstract"
(such as your "enabled" flag), the Conditional Style Predicate
Expression will be "[abstract/]" because the context is the source.


>
> Is their some clever trick I am missing, or are Relation-Based Edges not
> really intended for bi-directional relationships ? (perhaps I should
> convert my bi-directional edges to element edges instead?)
>
> Cheers,
> Robbie
>
>

Regards,

--
Florian - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Relation-based Edge Sources [message #1614786 is a reply to message #1611883] Fri, 13 February 2015 13:52 Go to previous messageGo to next message
Robbie Simpson is currently offline Robbie SimpsonFriend
Messages: 7
Registered: February 2015
Junior Member
Thanks - I had confused myself by having edge arrows that point the `wrong` way, so I got my targets and sources reversed.

However, I still have problems due to the many-to-many nature of my relationships. My Target Finder Expression evaluates to a list, which contains all elements linked to the source by that relationship, not just the one associated with the current edge.

For example, in my case I have operations that require resources, and so the edge is operation -> resource. On my edge, I can do [requiredResources], but this will give me a list of two or more resources and so I cannot tell which resource corresponds to the current edge.

Thanks again,
Robbie
Re: Relation-based Edge Sources [message #1619510 is a reply to message #1614786] Mon, 16 February 2015 16:32 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi,

Le 13/02/2015 14:52, Robbie Simpson a écrit :
> Thanks - I had confused myself by having edge arrows that point the
> `wrong` way, so I got my targets and sources reversed.
>
> However, I still have problems due to the many-to-many nature of my
> relationships. My Target Finder Expression evaluates to a list, which
> contains all elements linked to the source by that relationship, not
> just the one associated with the current edge.

Sirius will create one edge per found element. But for relation based
edge, the semantic element of those edges will be their source element.
(so with your m-n cardinality, you will have the same issue if you
"revert" the mapping, which would have been a clever trick with a 1-n
cardinality)


> For example, in my case I have operations that require resources, and so
> the edge is operation -> resource. On my edge, I can do
> [requiredResources], but this will give me a list of two or more
> resources and so I cannot tell which resource corresponds to the current
> edge.

Yes, you can: you edge is a DEdge (Sirius internal metamodel), and has a
sourceNode/getSourceNode() and a targetNode/getTargetNode() (metadel
reference / corresponding java method) which will be a
DSemanticDecorator with a semantic target/getTarget().

So from your current DEdge, in a mtl request or a java service you can
retrieve the sourceNode and targetNode semantic element and identify
which Operation/Resource couple is represented by an edge.

Then you will have to use different variables available in interpreted
expression of mapping/style/tools.

> Thanks again,
> Robbie

Regards,

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Unrecognized variables in .odesign
Next Topic:Display feature in Edition Table representation
Goto Forum:
  


Current Time: Thu Apr 25 15:16:19 GMT 2024

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

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

Back to the top