Home » Eclipse Projects » Sirius » Element Based Edge Creation Tool
Element Based Edge Creation Tool [message #1737783] |
Tue, 12 July 2016 20:38 |
Xi Ng 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 |
|
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 |
Xi Ng 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
|
|
| | | | | | |
Goto Forum:
Current Time: Thu Mar 28 14:16:39 GMT 2024
Powered by FUDForum. Page generated in 0.25635 seconds
|