How do I change the default varbalization of a system class in ODM 8.9.1?

367 views Asked by At

I would like to modify the verbalization of a built-in method on a build-in class. Such method verbalizations show up in the System portion of the Vocabulary view. For example, the date class has a method verbalized as {a date} is after {a date}. Of course, I can define my own methods on my own class with the vocabulary I want to see, but I also want to get rid of the existing vocabulary so that it does not cause confusion when writing the rules. Is there some way to change these pre-defined verbalizations or delete them altogether?

2

There are 2 answers

1
Greg Hadaller On BEST ANSWER

This turns out to be easy to implement, but tricky to understand. It appears that ODM is substituting the ilog.rules.brl.Date BOM class for the java.time.ZonedDateTime BOM class, at least with respect to visibility in the editors.

If you override the built-in BOM class with your own BOM class of the same name, the built-in class and methods are no longer visible in the BOM. Simply define a BOM class ilog.rules.brl.Date in any BOM Entry in any Rule Project and verbalize that class as 'date'. Like magic, the date class and all of its method disappear from the System portion of the Vocabulary view, and these methods will no longer be presented in the Intellirule editor in Rule Designer.

I am using this capability to hide the built-in date-handling methods which are based on java.util.Date. All our code is now using java.time.ZonedDateTime instead and now I can avoid ODM trying to cast my instances of ZonedDateTime into java.util.Date as required by the built-in date-handling methods. I am now free to define my own methods to handle ZonedDateTime instances without them being confused in the editors with the built-in methods.

One tricky aspect is that the ZonedDateTime BOM class I defined cannot be verbalized. Instead, ODM uses the verbalization of my ilog.rules.brl.Date BOM class. Neither can members (actual or virtual) of my ZonedDateTime BOM class be verbalized. When I add virtual BOM members to ilog.rules.brl.Date, I must also specify an Execution Name for that Date class -- ZonedDateTime seems to work fine and {this} behaves intuitively in those member verbalizations.

1
Emmanuel B. On

In the ODM distrib samples, you'll find a file called boot.bom in studio\samples\authoring\bomextensions\rules\resources.

This file contains the standard information for "boot"(initial) vocabulary.

You can change the date area vocabulary and then use that bom in your project.