Normally the OCL expressions are executed in memory – but it is a common need to query large quantities of data in the database. Normally SQL is used in databases. To avoid having multiple query languages in MDriven we provide a subset of the OCL language that we can translate to SQL. We call this subset for OCLps – where ps stands for Persistent Storage.
We use OCLps in MDriven here:
- SearchExpressions Nestings in ViewModels
- All ViewModel Columns starting with PSExpression_
OCLps is a subset of OCL. No side effects, and you cannot use your methods even if they are marked with IsQuery. The collect, groupby and other operators that return tuples are not supported. The reason is that the main use of OCLps is to return a list of identities based some criteria’s from select or difference or the like. Once MDriven has the set of identities we will load the corresponding objects – then you can take over with normal OCL.
In MDriven all the 3 types of OCL ( OCL, EAL, OCLps) are dynamically typed checked whenever the model is loaded, saved or if you initiate a model check manually by clicking the mode check:
Running the ModelCheck also cross-reference you model so that you can see where things are used: