Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Create edges between siblings
Create edges between siblings [message #1549213] Tue, 06 January 2015 11:40 Go to next message
Maxime Pété is currently offline Maxime PétéFriend
Messages: 4
Registered: January 2015
Junior Member
Hi there !

I recently got into Sirius in order to create a specific XML editor and I am having troubles with edge creation.

The part of my XML files I want to represent and edit looks like this :

<flow>
<action name="action1" />
<action name="action2" />
<action name="action3" />
<action name="action4" />
</flow>


I want to draw edges between contiguous <action> nodes, that is I want 3 edges which go from "action1" to "action2", from "action2" to "action3" and from "action3" to "action4". I was able to draw edges between all nodes using a target query like [thisEObject.siblings() /] but not to select only the next one.

Of course when I will be editing the edges I want the nodes to be put in the right order in the XML file.

The XML Schema which defines the files I have to edit is normalized and therefore I cannot change it if I want to remain compliant.

I am not sure if there is a solution to my problem but if yes I would be very happy if you could share it.

Thanks in advance,

Maxime
Re: Create edges between siblings [message #1549565 is a reply to message #1549213] Tue, 06 January 2015 16:03 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Maxime,

This is an interesting use case, to do that I think of a element based
edge mapping with :

- Action as domain class
- All Actions as semantic candidates expression
- [precedingSiblings()->last() /] as source finder expression
- [followingSiblings()->first() /] as target finder expression
- [not precedingSiblings()->isEmpty() and not
followingSiblings()->isEmpty() /] as precondition

Best Regards.

Le 06/01/2015 14:55, Maxime Pété a écrit :
> Hi there !
>
> I recently got into Sirius in order to create a specific XML editor and
> I am having troubles with edge creation.
>
> The part of my XML files I want to represent and edit looks like this :
>
>
> <flow>
> <action name="action1" />
> <action name="action2" />
> <action name="action3" />
> <action name="action4" />
> </flow>
>
>
> I want to draw edges between contiguous <action> nodes, that is I want 3
> edges which go from "action1" to "action2", from "action2" to "action3"
> and from "action3" to "action4". I was able to draw edges between all
> nodes using a target query like [thisEObject.siblings() /] but not to
> select only the next one.
>
> Of course when I will be editing the edges I want the nodes to be put in
> the right order in the XML file.
>
> The XML Schema which defines the files I have to edit is normalized and
> therefore I cannot change it if I want to remain compliant.
>
> I am not sure if there is a solution to my problem but if yes I would be
> very happy if you could share it.
>
> Thanks in advance,
>
> Maxime



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Create edges between siblings [message #1552694 is a reply to message #1549565] Thu, 08 January 2015 09:04 Go to previous messageGo to next message
Maxime Pété is currently offline Maxime PétéFriend
Messages: 4
Registered: January 2015
Junior Member
Hi Esteban !

Thanks a lot for your answer, it gave me the hints to do what I want.

Eventually my solution looks likre this :
- Action as domain class
- All Actions as semantic candidates expression
- [self /] as source finder expression
- [followingSiblings()->first() /] as target finder expression
- [not followingSiblings()->isEmpty() /] as precondition

Now I want to reconnect the edges and I am not sure what kind of Model Operation I should use.

My initial model looks like this :

<flow>
<action name="action1" />
<action name="action2" />
<action name="action3" />
<action name="action4" />
</flow>


When I reconnect the edge between "action1" and "action2" to go from "action1" to "action4" I'd like the model to look like this :

<flow>
<action name="action1" />
<action name="action4" />
<action name="action2" />
<action name="action3" />
</flow>


I tried with a Reconnect Edge Operation and a command like
[action->insertAt(action->indexOf(target), target) /] but it doesn't work.

Any solutions ?

Regards,

Maxime
Re: Create edges between siblings [message #1553003 is a reply to message #1552694] Thu, 08 January 2015 12:46 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Maxime,

Good to know.
About your reconnection issue, you can try actions reordering through a
java service, like that you can debug reordering with the java debugger.

Best Regards.

Le 08/01/2015 10:04, Maxime Pété a écrit :
> Hi Esteban !
>
> Thanks a lot for your answer, it gave me the hints to do what I want.
>
> Eventually my solution looks likre this :
> - Action as domain class
> - All Actions as semantic candidates expression
> - [self /] as source finder expression
> - [followingSiblings()->first() /] as target finder expression
> - [not followingSiblings()->isEmpty() /] as precondition
>
> Now I want to reconnect the edges and I am not sure what kind of Model
> Operation I should use.
>
> My initial model looks like this :
>
>
> <flow>
> <action name="action1" />
> <action name="action2" />
> <action name="action3" />
> <action name="action4" />
> </flow>
>
>
> When I reconnect the edge between "action1" and "action2" to go from
> "action1" to "action4" I'd like the model to look like this :
>
>
> <flow>
> <action name="action1" />
> <action name="action4" />
> <action name="action2" />
> <action name="action3" />
> </flow>
>
>
> I tried with a Reconnect Edge Operation and a command like
> [action->insertAt(action->indexOf(target), target) /] but it doesn't work.
>
> Any solutions ?
>
> Regards,
>
> Maxime



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Create edges between siblings [message #1563632 is a reply to message #1553003] Wed, 14 January 2015 10:04 Go to previous messageGo to next message
Maxime Pété is currently offline Maxime PétéFriend
Messages: 4
Registered: January 2015
Junior Member
Hello again !

I am still trying to reconnect those edges bt I am facing an issue I can't seem to correct.

I have created a sample Java class to test the connections between the service and my Sirius model. The class looks like this :

public class ContainerModificationServices {
	public String printFlow1(Flow flow) {
		return "Flow";
	}

 	public String printFlow2(Flow flow, Integer index) {
		return "Flow";
	}
	
	public Flow insertAction(Flow flow, Integer sourceIndex, Integer targetIndex) {
		return flow;
	}
}


I wanted to stay simple to understand what's happening so I only used these to write the labels on my Flow containers. When I invoke those methods I get the following results :


    - [self.printFlow1() /] works
    - [self.printFlow2(0) /] doesn't work and I get a message in the console which says "!MESSAGE Compilation error for expression [self.printFlow2(0)/] : Cannot find operation (printFlow2(Integer)) for the type (Flow)"
    - [self.insertAction(1, 3).printFlow1() /] doesn't work and I get a message in the console which says "!MESSAGE Compilation error for expression [self.insertAction(1, 3).printFlow1()/] : Cannot find operation (insertAction(Integer, Integer)) for the type (Flow)"


I guess I'm doing something wrong when I pass my Integer parameters but I didn't figure out what...

Best regards,

Maxime
Re: Create edges between siblings [message #1565350 is a reply to message #1563632] Thu, 15 January 2015 08:16 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Maxime,

This is a known limitation of Java service with Acceleo, see warning at
the end of Sirius specifier manual [1].

[1]
https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html

Best Regards.

Le 14/01/2015 11:04, Maxime Pété a écrit :
> Hello again !
>
> I am still trying to reconnect those edges bt I am facing an issue I
> can't seem to correct.
>
> I have created a sample Java class to test the connections between the
> service and my Sirius model. The class looks like this :
>
> public class ContainerModificationServices {
> public String printFlow1(Flow flow) {
> return "Flow";
> }
>
> public String printFlow2(Flow flow, Integer index) {
> return "Flow";
> }
>
> public Flow insertAction(Flow flow, Integer sourceIndex, Integer
> targetIndex) {
> return flow;
> }
> }
>
>
> I wanted to stay simple to understand what's happening so I only used
> these to write the labels on my Flow containers. When I invoke those
> methods I get the following results :
>
>
> - [self.printFlow1() /] works
> - [self.printFlow2(0) /] doesn't work and I get a message in the console
> which says "!MESSAGE Compilation error for expression
> [self.printFlow2(0)/] : Cannot find operation (printFlow2(Integer)) for
> the type (Flow)"
> - [self.insertAction(1, 3).printFlow1() /] doesn't work and I get a
> message in the console which says "!MESSAGE Compilation error for
> expression [self.insertAction(1, 3).printFlow1()/] : Cannot find
> operation (insertAction(Integer, Integer)) for the type (Flow)"
>
>
> I guess I'm doing something wrong when I pass my Integer parameters but
> I didn't figure out what...
>
> Best regards,
>
> Maxime



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Create edges between siblings [message #1565394 is a reply to message #1565350] Thu, 15 January 2015 08:52 Go to previous message
Maxime Pété is currently offline Maxime PétéFriend
Messages: 4
Registered: January 2015
Junior Member
Hi Esteban

I had read about this limitation before and I think I am using the Integer type the whole way long... Anyway, I changed the signature of my method so that it takes a String instead of an Integer (and then parsing the String in order to get an int in the Java code) but I still get this warning that my method is not found. It seems that the system somehow doesn't work when there is more than one parameter in the Java method.

Regards,

Maxime
Previous Topic:Interaction with tree and table views
Next Topic:[solved] EMF ItemProvider customization in Sirius property editor?
Goto Forum:
  


Current Time: Tue Apr 23 15:50:38 GMT 2024

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

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

Back to the top