skip to main content
Corticon Studio: Rule Modeling Guide : Writing Rules to access external data : Enabling Database Access for Rules using root-level Entities

Try Corticon Now

Enabling Database Access for Rules using root-level Entities

Once interfaced with EDC, the amount of test data is no longer limited to that contained in a single Input Ruletest – it is limited by the sizes in the connected database. Rules using root-level FlightPlan (or any other root-level entity) will force the Server or Studio to retrieve ALL FlightPlan entities (records) from the database. If the database is very large, then that will mean a large amount of data is retrieved. For this reason, database access for root-level rules is turned off by default. This ensures that you do not accidentally force the Server to perform extremely large and time-consuming data retrievals from the database unless you explicitly require it.
Since database access for rules using root-level terms is disabled by default, we need to know how to enable it for those circumstances when we do want it. We call this extending a root-level entity to the database. To illustrate, we’ll use a simple rule based on the Cargo project's Vocabulary, as follows:
1. In the Corticon Studio, create a new Rulesheet in the Cargo project, and open its advanced view.
2. Drag from the Vocabulary into the Scope as shown, including adding Cargo.weight to the FlightPlan association as shown.
3. Add the aliases in the Scope as shown.
4. Write the rule condition and its values in columns 1 and 2
5. Add the rule statement as shown
6. Save the Rulesheet as CargoLoad.ers
Figure 199. CargoLoad Rulesheet
The Rulesheet shown adds up (sums) the collection (see Collections) of Cargo weights associated with a FlightPlan (load.weight) and compares this to the maxCargoWeight of the root-level Aircraft. Our intention is to perform this comparison for every available Aircraft, so we have used the root-level Aircraft in our Conditional expression. Any Aircraft whose maxCargoWeight is inadequate will be identified with a posted Violation message.
* Testing the Rulesheet with Database Access disabled
* Testing the Rulesheet with Database Access enabled
* Optimizing Aggregations that Extend to Database