Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Set: The AQL query for enumeration
Set: The AQL query for enumeration [message #1796164] Sun, 07 October 2018 16:22 Go to next message
ham dovstry is currently offline ham dovstryFriend
Messages: 2
Registered: October 2018
Junior Member
Hello,

I am a beginner. It is the first time using Sirius and I am still in the process of learning AQL.

I have a node called 'Activity' in which a person should select its location (either 'In' or 'Out') as it is shown in the image.


index.php/fa/34009/0/

When I create an instance of Activity, the value of the Location keeps on going back to default literal ('In') of the Location enumeration.

I add a set (see image). But there I have tried quite a number of AQL queries and not a single one works.

index.php/fa/34010/0/

I appreciate any kind of help.

Best regards,
Dovstry
  • Attachment: Capture1.PNG
    (Size: 10.16KB, Downloaded 805 times)
  • Attachment: Capture2.PNG
    (Size: 15.27KB, Downloaded 728 times)
Re: Set: The AQL query for enumeration [message #1796223 is a reply to message #1796164] Mon, 08 October 2018 13:40 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Dovstry,

It seems you need to set an attribute typed by an enum defined in your metamodel.

Your issue is complementary to this thread how to test an enumerated value with AQL.

You can find the AQL documentation about literals in https://www.eclipse.org/acceleo/documentation/aql.html#EnumerationliteralschildrenEPackages

I think you should try aql:EPackageName::Location::OUT where EPackageName should be replaced by your EPackage real name of course. You will also have to look into your ecore to check the literal values of the Location EEnum (not their label).

Regards


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Set: The AQL query for enumeration [message #1796242 is a reply to message #1796223] Mon, 08 October 2018 18:13 Go to previous messageGo to next message
ham dovstry is currently offline ham dovstryFriend
Messages: 2
Registered: October 2018
Junior Member
Hello,

Thank you for replying.

Quote:
I think you should try aql:EPackageName::Location::OUT


Actually, I have already tried that query. the Sirius interpreter indicated 'Out' in the Evaluation result.
But it still it did not work.

Therefore, I am still trying to find the problem.

If I may additionally ask, how does the AQL query change in case we have more than two literal value in an enumeration ?.

Best Regards,
Dovstry
Re: Set: The AQL query for enumeration [message #1796250 is a reply to message #1796242] Tue, 09 October 2018 08:10 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi:
Quote:
the Sirius interpreter indicated 'Out' in the Evaluation result.


Yes it indicate Out, but it show the label of the literal, not its name. Do you have access to the ecore model or to the generated implementation: it should look for Location.java et see value and name of your enum literals. As Out does not work, you should check what is the expected value in the definition of the metamodel.

You can find some exemples of an enumeration with more than two values here:
- http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.tests.sample.migration/src-gen/org/eclipse/sirius/tests/sample/migration/migrationmodeler/RoutingStyle.java
- https://git.polarsys.org/c/capella/capella.git/tree/core/plugins/org.polarsys.capella.core.data.gen/generated/org/polarsys/capella/core/data/information/AggregationKind.java

The query will not change if there are more than two different literals.

You can also find an example in UML Designer:
Quote:
<featureCustomizations xsi:type="description:EAttributeCustomization" attributeName="labelFormat" value="aql:viewpoint::FontFormat::underline"/>

See https://github.com/ObeoNetwork/UML-Designer/blob/master/plugins/org.obeonetwork.dsl.uml2.core.design/description/uml2core.odesign
It is a style customization, which when it is active change the labelFormat of an element to underline.
This enumeration is defined here: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/FontFormat.java
and is generated from the core metamodel of Sirius (http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius/model/viewpoint.ecore)

Regard,




Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Lacking field in Sirius Specification for Diagram description
Next Topic:Creating a representation file externally
Goto Forum:
  


Current Time: Sat Apr 20 04:11:46 GMT 2024

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

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

Back to the top