Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Element Based Edge Creation Tool
Element Based Edge Creation Tool [message #1737783] Tue, 12 July 2016 20:38 Go to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

I am new to Sirius. I have looked through all the tutorials, examples and forums posts, but have not been able to solve my problem: Is there any detailed tutorial, that describes step by step how to make the creation tool for element based edges? All the tutorials only look at relation based edges.

What do I do wrong, when I have/do the following:

My model:
- classes: NodeSource, NodeTarget (each with variables: incomingArcs (type Arc), outgoingArcs (type Arc), name (type String))
- class: Arc (with variables: source (type NodeSource), target (type NodeTarget), name (type String) )

Now in detail, how I tried to model with Diagram Description in the Diagram.odesign file the relation:

1) New Diagram Element > Element Based Relation
Id: edge_arc
Label: Arc
Domain Class: Arc
Source: NodeSource
Source Finder Expression: feature:source
Target: NodeTarget
Targe Finder Expression: feature:target

2) New Element Creation > Edge Creation
Id: creation_arc
Edge Mapping: Arc
Begin > Change Context var:container > create Instance diagram.Arc > set source feature:source > set target feature:target

I am thinking, that I will have to set the source's outgoingArcs and the target's incomingArcs to the just created new Arc instance.

I hope, I explained it clear enough. I hope you can help me. Thank you in advance!


Re: Element Based Edge Creation Tool [message #1737799 is a reply to message #1737783] Wed, 13 July 2016 06:31 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Le 12/07/2016 à 22:38, Xi Ng a écrit :
> Hello,
>
> I am new to Sirius. I have looked through all the tutorials, examples
> and forums posts, but have not been able to solve my problem: Is there
> any detailed tutorial, that describes step by step how to make the
> creation tool for element based edges? All the tutorials only look at
> relation based edges.

There is a sample of EdgeCreatationTool in the advanced tutorial:
https://wiki.eclipse.org/Sirius/Tutorials/AdvancedTutorial#Edge_Creation_Tool

It is a relation based edge, so the tool just have to set the
corresponding relation between both clicked elements. For the eleemnt
based case, it is sligtly different as you have to create the element
and store it in the model and then you need to set the references
between this element and its "source" and "target".
>
> What do I do wrong, when I have/do the following:
> My model: - classes: NodeSource, NodeTarget (each with variables:
> incomingArcs (type Arc), outgoingArcs (type Arc), name (type String))
> - class: Arc (with variables: source (type NodeSource), target (type
> NodeTarget), name (type String) )
>
> Now in detail, how I tried to model with Diagram Description in the
> Diagram.odesign file the relation:
>
> 1) New Diagram Element > Element Based Relation
> Id: edge_arc
> Label: Arc
> Domain Class: Arc
> Source: NodeSource
> Source Finder Expression: feature:source
> Target: NodeTarget
> Targe Finder Expression: feature:target

Do not forget to put a semantic candidates expression to indicate how to
look for Arc from the semantic element of the diagram. It will improve
performances on big modeles: if the semantic candidates is empty, Sirius
will iterate over all semantic models of the current resource set to
look for Arc elements.

>
> 2) New Element Creation > Edge Creation
> Id: creation_arc
> Edge Mapping: Arc
> Begin > Change Context var:container > create Instance diagram.Arc > set
> source feature:source > set target feature:target

Here you use feature:source and feature:target, so Sirius will look for
the value of the corresponding EReference on the current context, if
your setValue model operations are children of the createInstance task,
yout Arc has just been created and you are setting the current value
(null) to both references.

In the advanced tutorial, you might have missed that we use
var:source/var:target and not feature:, the var: interpreter allows us
to have access to variable set by Sirius, for the edge creation tool,
source and target correspond to the clicked semantic elements.

I think you just have to replace feature: by var: in your tool

>
> I am thinking, that I will have to set the source's outgoingArcs and the
> target's incomingArcs to the just created new Arc instance.

Are the source/outgoingArcs and target/incomingArcs set as eOpposite
EReferences in your metamodel ? If yes, EMF will do it for you.



> I hope, I explained it clear enough. I hope you can help me. Thank you
> in advance!
>
>
>

Regards

--
Maxime - Obeo

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


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Element Based Edge Creation Tool [message #1742868 is a reply to message #1737799] Thu, 08 September 2016 10:14 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello Maxime,

thank you very much for your help. I appreciate it. I have tried to implement your advice. But I am still struggling. I replaced feature: with var: so far and I have tried out various other things. But I can't solve the problem.

I attached the relevant part of my "net.ecore_diagram" and the relevant parts of my "net.odesign" file.

1. Is this what I modelled eOpposite EReferences, e.g. the two arrows from each Arc to each Element?
2. Is there a good overview, what exactly to write in the "semantic candidates expression"?
3. What do you mean exactly by "you need to set the references between this element and its "source" and "target""?

Thank you in advance.
Kind regards
Xing


[Updated on: Wed, 14 September 2016 05:07]

Report message to a moderator

Re: Element Based Edge Creation Tool [message #1742982 is a reply to message #1742868] Fri, 09 September 2016 04:06 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

sorry, attachement 02_net_odesign.jpg is wrong.
Please find attached the correct file.
Thank you in advance

Regards
Xing
Re: Element Based Edge Creation Tool [message #1743287 is a reply to message #1742982] Wed, 14 September 2016 05:06 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

I have fixed the problem, I edited "Change Context" to [source.eContainer()/]
eOpposites are set.

Kind regards

[Updated on: Sat, 17 September 2016 08:33]

Report message to a moderator

Re: Element Based Edge Creation Tool [message #1826744 is a reply to message #1743287] Wed, 29 April 2020 19:11 Go to previous messageGo to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi Xing,

I am having the same problem that you did here. Can you tell me what you edited in the context or how you did it?

Regards,
Thomas
Re: Element Based Edge Creation Tool [message #1826769 is a reply to message #1826744] Thu, 30 April 2020 08:46 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

I am not sure that Xing will reply...as this post is four years old :) . Have you followed the recommandations in Maxime's answer?
If you still have an issue, can you present how you created your Edge mapping and Edge creation tool?

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Element Based Edge Creation Tool [message #1826826 is a reply to message #1826769] Fri, 01 May 2020 16:28 Go to previous messageGo to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi Steve,

Attached is my metamodel that I am using.

This is how I set up my edges in sirius:
index.php/fa/38018/0/

And this is how I'm trying to set up the edge creation tool in my editor. I've tried everything that was previously mentioned in this post too.
index.php/fa/38019/0/

Any ideas?

Thomas

[Updated on: Fri, 01 May 2020 16:30]

Report message to a moderator

Re: Element Based Edge Creation Tool [message #1833018 is a reply to message #1826769] Wed, 30 September 2020 16:54 Go to previous message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi Steve,

Since my last message I have tried to avoid using element based edges as much as possible however it seems there is no avoiding it. Would it be possible to have a step by step tutorial on how to create an element-based edge tool? I have one set up in my new editor that works just fine with the tree editor but I can't get the tool creation to work no matter what configuration I do. Any help would be greatly appreciated.
Previous Topic:References not showing from horizontal stack containers
Next Topic:Reconnect Edge Tool - What is the Variable for "the previous target"?
Goto Forum:
  


Current Time: Thu Mar 28 14:16:39 GMT 2024

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

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

Back to the top