ILOG JRules User Guide > Customizing JRules > Concepts > Rule Model > Rule Model API > Rule Model API for Rule Studio

The rule model API for Rule Studio (ilog.rules.studio.model.* packages) is the data model of Rule Studio. It allows you to access and manipulate rule model elements (rules, packages, ruleflows, decision tables, and so on), and manage their mapping to files in the Eclipse workspace. The rule model API provides notification and services over rule artifacts (search and queries for example).

Rule Model and Eclipse Workspace

The class IlrStudioModelPlugin is the main entry point for the Rule Model API. It contains static methods to access the main model classes (getWorkspace, getResourceManager, getRuleModel). The interface IlrResourceManager manages the mapping between the rule model and the Eclipse workspace. In this interface, the method getElementFromResource lets you map a workspace resource to a rule model element, and the method saveElement lets you save a rule model element as a workspace resource. If a file is modified in the workspace on the disk, changes are automatically transferred to the rule model.

The interface IlrResourceElement is the superclass of all rule model elements that have a corresponding resource in the workspace. In this interface, the method getResouce lets you retrieve the resource corresponding to a rule model element.

Rule Model API for Rule Studio

Rule Model Services

The rule model API allows you to:

IlrRuleModel ruleModel = IlrStudioModelPlugin.getRuleModel();
IlrRuleProject ruleProject = ruleModel.getRuleProject("balsample");
IlrRulePackage pkg = ruleProject.getRulePackage("toto.titi");
IlrRule rule = pkg.getRule("myrule");
IlrResourceManager resourceMgr = IlrStudioModelPlugin.getResourceManager();
IlrRuleArtefact rule = resourceMgr.getElementFromResource(file);
rule.setDocumentation("updated doc");
resourceMgr.saveElement(rule);

Services on top of the rule model API allow you to:

IlrQueryService queryService =
                  IlrRuleProject.getService(IlrQueryService.SERVICE_ID);

Rule Model Structure

The Rule Studio model plug-ins are modular: ilog.rules.studio.model is the generic plug-in, and all of its subplug-ins are specific. When you create a plug-in that references one of the Rule Studio model plug-ins, a good practice is to reference them all, although you may not need some of the specific ones.

Related Concepts

Rule Model

Related Tasks

Automating Queries with the Rule Studio API

Related Reference

IlrStudioModelPlugin
IlrResourceManager
IlrResourceElement
IlrRuleProject
IlrRulePackage
IlrRuleArtifact
IlrRuleModel
IlrRulesetArchiveExporter
ilog.rules.studio.model.businessCheckers extension point

Related Samples and Tutorials

Rule Studio Business Rule Management Extensions