Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Edge Creation Tool(Pb to store a new link in my model using an "Edge Creation Tool" )
Edge Creation Tool [message #1219320] Tue, 03 December 2013 10:38 Go to next message
Guillaume Prêcheur is currently offline Guillaume PrêcheurFriend
Messages: 2
Registered: December 2013
Junior Member
Hello,

I have a simple EMF model :
- My object SCENARIO contains MODULES and FLUX
- FLUX contains a SOURCE attribute (a reference to a MODULE) and a TARGET attribute (a reference to another MODULE)
- the object FLUX modelise a flow data beetwin 2 modules


In my SIRIUS Diagram definition :
- I mapped a the Module object to a simple 'Node Mapping' object and a Flux object to an 'Element Based Edge'
- In my Edge Creation tool, when I try to create a new edge beetwin 2 modules. The current semantic context seems to be one of my linked modules. But the new instanciated flux object's container is Scenario object.

My question : how can I defined that the new mapped object has to be associate to my Scenario ?

Thanks for help


xmi file dump :

<?xml version="1.0" encoding="ASCII"?>
<Scenario xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..." xmlns="simulation" xsi:schemaLocation="Simulation.ecore">
<module ident="ID_MODULE_1" label="MODULE_1" description="Description du MODULE-1"/>
<module ident="ID_MODULE_2" label="MODULE_2" description="Description du MODULE-2"/>
<module ident="ID_MODULE_3" label="MODULE_3" description="Description MODULE_3"/>
<flux source="//@module.0" destination="//@module.1"/>
<flux source="//@module.1" destination="//@module.2"/>
</Scenario>




odesign file dump

<?xml version="1.0" encoding="UTF-8"?>
<description:Group xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..." xmlns:description="..." xmlns:style=".." xmlns:tool="..." name="Scenario" version="6.9.0.201308011200">
<ownedViewpoints name="SIQI_SIMU_SCENARIO_VP" modelFileExtension="">
<ownedRepresentations xsi:type="description:DiagramDescription" name="SIQI_SIMU_SCENARIO_DIAG" domainClass="simulation.Scenario">
<metamodel href="Simulation.ecore#/"/>
<defaultLayer name="SIQI_SIMU_SCENARIO_LAYER">
<nodeMappings name="MODULE_NODE" semanticCandidatesExpression="[module/]" semanticElements="feature:sortie" domainClass="simulation.Module">
<style xsi:type="style:SquareDescription" borderSizeComputationExpression="1" labelExpression="feature:label" tooltipExpression="feature:description" labelPosition="node" resizeKind="NSEW">
<borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
</style>
</nodeMappings>
<edgeMappings name="FLUX_DONNEES_ID" semanticCandidatesExpression="[flux/]" sourceMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']" targetMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']" targetFinderExpression="[destination/]" sourceFinderExpression="[source/]" domainClass="simulation.FluxDonnee" useDomainElement="true">
<style lineStyle="dash" sizeComputationExpression="2" routingStyle="manhattan">
<strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
<centerLabelStyleDescription>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</centerLabelStyleDescription>
</style>
</edgeMappings>
<toolSections>
<ownedTools xsi:type="tool:EdgeCreationDescription" name="CREATE_FLUX" edgeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@edgeMappings[name='FLUX_DONNEES_ID']">
<sourceVariable name="source_ed"/>
<targetVariable name="destination_ed"/>
<sourceViewVariable name="sourceView"/>
<targetViewVariable name="targetView"/>
<initialOperation>
<firstModelOperations xsi:type="tool:CreateInstance" typeName="simulation.FluxDonnee" referenceName="flux">
<subModelOperations xsi:type="tool:SetObject" featureName="destination" object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@targetVariable"/>
<subModelOperations xsi:type="tool:SetObject" featureName="source" object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@sourceVariable"/>
</firstModelOperations>
</initialOperation>
</ownedTools>
<ownedTools xsi:type="tool:NodeCreationDescription" name="CREATE_MODULE" forceRefresh="true" nodeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']">
<variable name="container"/>
<viewVariable name="containerView"/>
<initialOperation>
<firstModelOperations xsi:type="tool:CreateInstance" typeName="simulation.Module" referenceName="module">
<subModelOperations xsi:type="tool:SetValue" featureName="label" valueExpression="new module"/>
</firstModelOperations>
</initialOperation>
</ownedTools>
</toolSections>
</defaultLayer>
</ownedRepresentations>
</ownedViewpoints>
</description:Grou
p>
Re: Edge Creation Tool [message #1219403 is a reply to message #1219320] Tue, 03 December 2013 16:52 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hi,

First of all, thanks for your interest in Sirius.

To create your edge mapping you need to add a "Change Context" with
value "[source.eContainer()/] before your createInstance.
I recommend to always add a "Change Context" in your tools, to ensure
that you are on the right object.

Best regards,

Le 03/12/2013 15:47, Guillaume Prêcheur a écrit :
> Hello,
> I have a simple EMF model :
> - My object SCENARIO contains MODULES and FLUX
> - FLUX contains a SOURCE attribute (a reference to a MODULE) and a
> TARGET attribute (a reference to another MODULE)
> - the object FLUX modelise a flow data beetwin 2 modules
>
>
> In my SIRIUS Diagram definition :
> - I mapped a the Module object to a simple 'Node Mapping' object and a
> Flux object to an 'Element Based Edge'
> - In my Edge Creation tool, when I try to create a new edge beetwin 2
> modules. The current semantic context seems to be one of my linked
> modules. But the new instanciated flux object's container is Scenario
> object.
> My question : how can I defined that the new mapped object has to be
> associate to my Scenario ?
>
> Thanks for help
>
>
> xmi file dump :
> <?xml version="1.0" encoding="ASCII"?>
> <Scenario xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..."
> xmlns="simulation" xsi:schemaLocation="Simulation.ecore">
> <module ident="ID_MODULE_1" label="MODULE_1" description="Description
> du MODULE-1"/>
> <module ident="ID_MODULE_2" label="MODULE_2" description="Description
> du MODULE-2"/>
> <module ident="ID_MODULE_3" label="MODULE_3" description="Description
> MODULE_3"/>
> <flux source="//@module.0" destination="//@module.1"/>
> <flux source="//@module.1" destination="//@module.2"/>
> </Scenario>
>
>
>
> odesign file dump
>
> <?xml version="1.0" encoding="UTF-8"?>
> <description:Group xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..."
> xmlns:description="..." xmlns:style=".." xmlns:tool="..."
> name="Scenario" version="6.9.0.201308011200">
> <ownedViewpoints name="SIQI_SIMU_SCENARIO_VP" modelFileExtension="">
> <ownedRepresentations xsi:type="description:DiagramDescription"
> name="SIQI_SIMU_SCENARIO_DIAG" domainClass="simulation.Scenario">
> <metamodel href="Simulation.ecore#/"/>
> <defaultLayer name="SIQI_SIMU_SCENARIO_LAYER">
> <nodeMappings name="MODULE_NODE"
> semanticCandidatesExpression="[module/]"
> semanticElements="feature:sortie" domainClass="simulation.Module">
> <style xsi:type="style:SquareDescription"
> borderSizeComputationExpression="1" labelExpression="feature:label"
> tooltipExpression="feature:description" labelPosition="node"
> resizeKind="NSEW">
> <borderColor xsi:type="description:SystemColor"
> href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
> <labelColor xsi:type="description:SystemColor"
> href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
> <color xsi:type="description:SystemColor"
> href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
> </style>
> </nodeMappings>
> <edgeMappings name="FLUX_DONNEES_ID"
> semanticCandidatesExpression="[flux/]"
> sourceMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']"
> targetMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']"
> targetFinderExpression="[destination/]"
> sourceFinderExpression="[source/]" domainClass="simulation.FluxDonnee"
> useDomainElement="true">
> <style lineStyle="dash" sizeComputationExpression="2"
> routingStyle="manhattan">
> <strokeColor xsi:type="description:SystemColor"
> href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
> <centerLabelStyleDescription>
> <labelColor xsi:type="description:SystemColor"
> href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
> </centerLabelStyleDescription>
> </style>
> </edgeMappings>
> <toolSections>
> <ownedTools xsi:type="tool:EdgeCreationDescription"
> name="CREATE_FLUX"
> edgeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@edgeMappings[name='FLUX_DONNEES_ID']">
>
> <sourceVariable name="source_ed"/>
> <targetVariable name="destination_ed"/>
> <sourceViewVariable name="sourceView"/>
> <targetViewVariable name="targetView"/>
> <initialOperation>
> <firstModelOperations xsi:type="tool:CreateInstance"
> typeName="simulation.FluxDonnee" referenceName="flux">
> <subModelOperations xsi:type="tool:SetObject"
> featureName="destination"
> object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@targetVariable"/>
>
> <subModelOperations xsi:type="tool:SetObject"
> featureName="source"
> object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@sourceVariable"/>
>
> </firstModelOperations>
> </initialOperation>
> </ownedTools>
> <ownedTools xsi:type="tool:NodeCreationDescription"
> name="CREATE_MODULE" forceRefresh="true"
> nodeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']">
>
> <variable name="container"/>
> <viewVariable name="containerView"/>
> <initialOperation>
> <firstModelOperations xsi:type="tool:CreateInstance"
> typeName="simulation.Module" referenceName="module">
> <subModelOperations xsi:type="tool:SetValue"
> featureName="label" valueExpression="new module"/>
> </firstModelOperations>
> </initialOperation>
> </ownedTools>
> </toolSections>
> </defaultLayer>
> </ownedRepresentations>
> </ownedViewpoints>
> </description:Group>
>
Re: Edge Creation Tool [message #1219410 is a reply to message #1219320] Tue, 03 December 2013 17:10 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
An Another thing,

I recommend you to use "feature:source" instead of [source/] in your
edge mapping because source is an Acceleo3 key word.

Best regards,
Re: Edge Creation Tool [message #1219537 is a reply to message #1219410] Wed, 04 December 2013 13:55 Go to previous messageGo to next message
Guillaume Prêcheur is currently offline Guillaume PrêcheurFriend
Messages: 2
Registered: December 2013
Junior Member
Thanks for the answer.

I'm newby in sirius/Acceleo3 world, so I don't catch exatly why it's better to use the feature:source acceleo définition than the [source/] one ? time interpretation ?

guillaume
Re: Edge Creation Tool [message #1219541 is a reply to message #1219537] Wed, 04 December 2013 14:09 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Le 04/12/2013 14:55, Guillaume Prêcheur a écrit :
> I'm newby in sirius/Acceleo3 world, so I don't catch exatly why it's
> better to use the feature:source acceleo définition than the [source/]
> one ? time interpretation ?

Yes, it's mostly about execution time. Using Acceleo for expressions
allow for possibly very complex queries on your models, but its comes
with some up-front cost (mainly parsing and compilation). "feature:" is
very limited (only direct access to a named attribute or reference), but
has almost no overhead compared to calling eGet(featureName). When you
don't need the full power of a Acceleo and can use feature: instead, it
is always recommended to do so.

The same idea applies to "var:" (for direct access to a variable's
value) and "service:" (to invoke custom Java code). Both things can be
done through Acceleo too, but when your expression does nothing more,
using the special syntax will give you better performance.

See
http://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html, and
especially the section entitled "Using the Specialized interpreters" for
more details.


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:[Request] integration with xcore
Next Topic:Diagram not showing model elements from imported models
Goto Forum:
  


Current Time: Tue Apr 23 17:45:47 GMT 2024

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

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

Back to the top