Hi everyone,

The following function is typical of the sort of code I'm writing in Jess:

----------------------------------------------------------------------------------
(defglobal ?*similar_result_array* = (new ArrayList 0) )
(deffunction dynamic-similar-search (?p1 ?p2 ?p3 ?p4)
    (bind ?s1 (str-cat "(defrule similar_rule ("?p1" ("?p2" \""?p3"\") ("?p4" ?qwerty)) => (call ?*similar_result_array* add ?qwerty)  )"))
    (build ?s1)
    (return ?*similar_result_array*)
    )
----------------------------------------------------------------------------------

It basically just asserts a rule dynamically using some paraemters I supply it. It also stores results in an ArrayList and then returns this object.
My question is about concurrency, in particular:

- the use of the global variable
- the name of the rule
- the variable ?s1
- and the arrya it returns

I potentially need to run this function, and other function like it, in a single Rete engine many times concurrently. Is the solution to somehow use a counter or other unique mechanism to create variable and object names?

How would I do this, and any other ideas? Is this a problem other people have encountered?

Thanks,
Matt





--
Matthew Hutchinson
Ph.D. Candidate
Department of Spatial Sciences
Curtin University of Technology
GPO Box U1987
Perth, Western Australia 6845

Visiting Scholar
Department of Geography and Planning
University of Akron
Akron, Ohio USA

Reply via email to