Search code examples
clipsexpert-system

Using find fact in CLIPS


I have a fact

(is-started TRUE)

I want to find if the fact exists with

(any-factp ((?is (is-started TRUE))) TRUE)

but this gives me Missing function declaration for is-started.

How can i determine if this fact exists with any-factp?


Solution

  • The fields of an implied deftemplate fact can be accessed using the implicitly defined multifield slot named implied:

    CLIPS> (assert (is-started TRUE))
    <Fact-1>
    CLIPS> (any-factp ((?f is-started)) TRUE)
    TRUE
    CLIPS> (any-factp ((?f is-started)) (eq ?f:implied (create$ TRUE)))
    TRUE
    CLIPS> (any-factp ((?f is-started)) (eq ?f:implied (create$)))
    FALSE
    CLIPS>