skip to main content
Corticon Studio: Rule Modeling Guide : Writing Rules to access external data : A Scope refresher

Try Corticon Now

A Scope refresher

The concept of scope is key to rule design and execution. Scope in a Rulesheet helps define or constrain which data is included in rule processing, and which data is excluded. If a rule uses the Vocabulary term FlightPlan.cargo.weight, then we know that those FlightPlan entities without associated Cargo entities will be ignored.
We also know that Vocabulary root-level entities – FlightPlan, for example – bring every instance of the entity into scope. This means that a rule using root-level FlightPlan acts on every instance of FlightPlan, including Cargo.flightPlan, Aircraft.flightPlan, or any other role using FlightPlan that may exist in our Vocabulary.
When we add the ability for the Corticon Server and Studio to dynamically retrieve data from a database, rule scope determines which data to retrieve. This is exactly the same concept as Studio determining which data in an Input Ruletest to process and which to ignore based upon a rule’s scope. So if we write rules using root-level FlightPlan, then the Studio will process all FlightPlans present in the Input Ruletest during rule execution.