Interfaces in rules
Refine rules use interfaces to import external data to the rule engine. For example, you can create an interface and use it as an interface instance to return data to the Refine rule.
Interfaces are maintained in the .baroc file in installationDirectory\pw\server\etc\ CellName\kb\classes on Windows platforms and in installationDirectory/pw/server/etc/CellName /kb/classes on UNIX platforms.
Slots defined in an interface follow the same syntax as used in a class definition, as shown in the following example:
DEFINES {
<SlotName>: <DataType>, <Facet>, <Facet>;
<SlotName>: <DataType>;
...
};
END
In the following example, the interface is designed to retrieve additional data about a system that is potentially down:
DEFINES {
site: STRING;
phone: STRING;
};
END
Interface instances
The pieces of data collected by the external program or script are assigned to the slots of the interface, creating an interface instance. The life of an interface instance is limited, because only the calling Refine rule can use it. To access the data in the future, the slot values must be stored in a global record or an event.
The syntax for an interface instance is as follows:
<SlotName> = <Value> ;
<SlotName> = <Value> ;
END
After the external information exists in an interface instance, a Refine rule assigns it to slots or uses it in another manner, such as normalizing an event message.
In conjunction with the interface instance defined in the figure2, the interface instance in the following figure provides values for the system location and phone number for the responsible party.
During rule processing, you can use the following functions or primitives to execute an external script or program: execute, get_external, or confirm_external. The external script or program that you reference in a rule must be located in the correct bin subdirectory, or it will not run. The platform for the host computer that you use determines where the script or program resides. For more information about the bin directory, see Knowledge-Base-directory-structure.
Interface instance example
site = B3R123 '
phone = 555-555-5555 ;
END