AUTOSAR models can grow to be quite complex and finding your way around the model is often not very easy. A simple search within a model is often not sufficient for a complex analysis.
For Artop-based tools, a simple solution based on Xtext's Xbase support is readily available at virtually no cost. It just extends your Eclipse-based product with a few plugins to add powerful scripting capability.
The core is Christian Dietrich's mql project in github.
Let's assume that we have a very simple AUTOSAR model in Artop such as:
Assume that we would like to find all the software components that have a provided port that reference an interface named "if". You could create a .mql file in the workspace with the following content:
import autosar40.swcomponent.components.PPortPrototype import autosar40.swcomponent.components.ApplicationSwComponentType val arModel = SphinxUtil.getAutosarModel("blog") val swCs = arModel.filter(ApplicationSwComponentType).filter[ports .filter(PPortPrototype).exists[providedInterface.shortName == "if"]] swCs.toList
The first two lines are just import statement, the next line retrieves the Autosar model from project 'blog'. After that, the first simple assignment is our actual query:
And the last line prints the result. No Pressing CTRL-Shift-I starts the interpreter (no compiling or building a new application is required!) and opens a Window showing the results of your script:
swCs.toList // ArrayList: [autosar40.swcomponent.components.impl.ApplicationSwComponentTypeImpl@31ab743f (shortName: ac) (shortNamePattern: <unset>)]
This is quite bare-metal, showing the Java objects that come from your query. But in a specific setting (not part of Christian's code, because it applies to the Sphinx framework), we also show the results in the Eclipse Sphinx search view.
And from here you can:
Of course, there is almost no limit about what you can do in the script language. You can:
All in all, it is a gem that provides tremendous help when working with AUTOSAR models.