Query View
🔥 This feature is currently considered experimental. Try it out and give feedback by reporting bugs and suggesting new features. It’s not recommended for production use.
👥 This feature is available to all users.
A view named Query is available in Sirius Web, allowing users to query the models.
This view allows to write AQL queries (see AQL documentation for more details) and get the results of the queries written.
|
It will be improved release after release, with new variables and services, but it is experimental for now. |
Three variables are accessible for now, helping to write queries:
-
selfwhich represents the selected element in the Explorer and/or any open diagram. It always returns one element. -
selectionwhich represents the selected elements in the Explorer and/or any open diagram. It always returns a collection of elements (one or several). -
editingContextwhich represent the current project.
From the editing context, you can use the following services:
-
Collection<Object> allContents(): allows to retrieve all contents recursively (documents, and each element of all models) present in your editing context. Please use this service very carefully as it can retrieve thousands elements very easily and may also lead to performance issues. -
Collection<Object> contents(): allows to retrieve all contents (documents) present in your editing context. -
Object getObjectById(String id): from its ID, allows to retrieve an object (a document or a model Element) present in your editing context.
|
The use of this Query view requires knowledge of AQL and also a good knowledge of the language (attributes, references, operations). |
Here are some examples of AQL queries applied on a simple project:
-
The following example uses the
selfvariable, corresponding to the Package 1 element (which has been selected in the Explorer view), and asking for its name:
The result is visible in the Evaluation result part of the Query view (Package 1).
-
The following example uses the
selectionvariable, corresponding to the part1 and part2 elements (which have been selected in the General View diagram), and asking for the number of selected elements:
The result is visible in the Evaluation result part of the Query view (2).
-
The following example uses the
getObjectByIdservice with an ID as parameter, corresponding to the Package 1 element:
The result is visible in the Evaluation result part of the Query view (Package 1).