engineer
engineer

Reputation: 11

CLIPS API for programatically creating rules a.k.a defrule

I'm planing to use CLIPS rule engine for my product needs. Expert system is a tiny portion of the overall functionality of my product, hence I want to leverage CLIPS rule engine instead of writing my own. So my primary requirement is the ability to achieve following tasks programmatically a) define facts (entity pattern) using a.k.a CreateFact() API b) define rules - API ??? c) run the rules using a.k.a long int Run(runLimit)

finished reading CLIPS user guide and in the process of completing Basic programming which are seems to be pr-requite for "advance programming guide" which has "Section 4 - Embedding CLIPS". I just glimpse through section 4.6 DEFRULE FUNCTIONS and could not see any API for creating rules (b).
BTW my product is written in "C" language.

So want to know how an embedded application can create rules programmatically ? Or I'm not sure the expectation is store rules in ".clip" file and use load() API .?

Upvotes: 1

Views: 532

Answers (1)

Gary Riley
Gary Riley

Reputation: 10757

Use the EnvBuild function (section 4.1.7 of the 6.24 and 6.3 Advanced Programming Guide). It allows you to dynamically create any CLIPS construct (deftemplate, deffacts, defrule, etc.) just by passing in a string.

Upvotes: 0

Related Questions