Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Predicate expression in Conditional Edge Style Description(Cannot access [self.target/] in Predicate expression)
Predicate expression in Conditional Edge Style Description [message #1239465] Tue, 04 February 2014 09:07 Go to next message
Martin Gröger is currently offline Martin GrögerFriend
Messages: 3
Registered: February 2014
Junior Member
Hello,

I tried to color an edge depending on data of the model element.
With the Model Request Interpreter I can use the term: [self.target.toString().contains('xxx')/],
but when I try to use this term as a predicate expression, then I get the message

!ENTRY org.eclipse.acceleo.parser 4 0 2014-02-04 09:58:41.441
!MESSAGE Compilation error for expression [self.target.toString().contains('xxx')/] : Unrecognized variable: (target)

So how is it possible to access the model content for this purpose?

Thanks, Martin
Re: Predicate expression in Conditional Edge Style Description [message #1239578 is a reply to message #1239465] Tue, 04 February 2014 14:18 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 116
Registered: May 2011
Senior Member
Hello,

Is the active editor, when you wrote the expression [self.target.toString().contains('xxx')/] on the Model Request Interpreter, a diagramme with a selected edge? In that case, the selected element is not your semantic element but the graphical element (DEdge). In that case, your expression works because "target" is the reference to the semantic element (See DSemanticDecorator.target in the metamodel). Therefore, if you want to use your expression on a semantic element, or in your Viewpoint Specification Model (odesign), you should remove the "target" reference.

Regards,
Steve
Re: Predicate expression in Conditional Edge Style Description [message #1239586 is a reply to message #1239578] Tue, 04 February 2014 14:37 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 116
Registered: May 2011
Senior Member
By the way, are you sure you want to use the toString() method in your expression? It might be better (even in performance) to write your expression based on a "name" feature for example.

Regards,
Steve
Re: Predicate expression in Conditional Edge Style Description [message #1239595 is a reply to message #1239586] Tue, 04 February 2014 15:02 Go to previous messageGo to next message
Martin Gröger is currently offline Martin GrögerFriend
Messages: 3
Registered: February 2014
Junior Member
Seems like the semantic of [self/] is in this case the model obejct itself, not the object of the representation.
The toString() method was only a workaround as long as I didn't get aceess to the attributes of the object itself.

Anyway thanks for the help,
Martin

Re: Predicate expression in Conditional Edge Style Description [message #1693109 is a reply to message #1239595] Tue, 21 April 2015 19:11 Go to previous messageGo to next message
Maxence Lafon is currently offline Maxence LafonFriend
Messages: 2
Registered: April 2015
Junior Member
Hello,

I have a similar problem.
I want to add in my Viewpoint Specification Model (.odesign) a conditional style to a Node claimed that this Node is connected or not (i.e. if its outgoingEdges and incomingEdges are empty or not).
But "outgoingEdges" and "incomingEdges" refer to the diagram element (DNode) : I can access them by typing [thisEObject.incomingEdges/] when I'm working directly onto the diagram but I can't access them from the .odesign file (though diagram elements are defined in this file !).

So my question is : how is it possible to access to the diagram element features in the Viewpoint Specification Model ?

Thanks,
Maxence
Re: Predicate expression in Conditional Edge Style Description [message #1693158 is a reply to message #1693109] Wed, 22 April 2015 07:14 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 171
Registered: July 2009
Senior Member
Le 21/04/2015 21:26, Maxence Lafon a écrit :
> Hello,

Hi.

> I have a similar problem.
> I want to add in my Viewpoint Specification Model (.odesign) a
> conditional style to a Node claimed that this Node is connected or not
> (i.e. if its outgoingEdges and incomingEdges are empty or not). But
> "outgoingEdges" and "incomingEdges" refer to the diagram element (DNode)
> : I can access them by typing [thisEObject.incomingEdges/] when I'm
> working directly onto the diagram but I can't access them from the
> .odesign file (though diagram elements are defined in this file !).

I assume the when you say "working directly onto the diagram" you mean
using the "Interpreter" view? The input element which serves as context
("self" or "thisEObject") in this view is indeed the Sirius-specific
graphical model element currently selected, i.e. a DNode, DNodeContainer
or DEdge for example.

The expressions in the VSM (.odesign) are usually evaluated relative to
the semantic/domain model element, which does not know about
Sirius-specific graphical elements (its the other way around).

> So my question is : how is it possible to access to the diagram element
> features in the Viewpoint Specification Model ?

In general when it makes sense for an expression in the VSM to have
access to the graphical model (and not just the semantic/domain layer),
Sirius provides it through variables which are automatically available
when the expression is evaluated. They are typically called "view",
"containerView" or something similar. This is the case for conditional
style expression: the variable "view" will be set with the graphical
element whose style is tested.

Regards,

--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Predicate expression in Conditional Edge Style Description [message #1694574 is a reply to message #1693158] Wed, 06 May 2015 12:04 Go to previous message
Maxence Lafon is currently offline Maxence LafonFriend
Messages: 2
Registered: April 2015
Junior Member
Hello,

Thank you very much for your quick answer. I was effectively looking for the "view" variable, and your explanations have been very useful to my work. I'm sorry for this late answer.

Best regards

Maxence
Previous Topic:Validate diagram throws exception
Next Topic:First editor loading : null pointer exception
Goto Forum:
  


Current Time: Sat May 30 05:00:00 GMT 2015

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

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