Hi Andrew,

I'm not sure how subtle your question actually is, because there may be a major issue with accomplishing what you're after here. The initial value of a defglobal is stored exactly as it appears in the definition of the defglobal; if the initial value is a function call, then that function call itself is stored. This is so that when you call (reset), the function call can be invoked to initialize the defglobal to an appropriate new value at that time.

In any case, the point is that the function call has to be stored as Jess code, so the code that creates the FuzzyVariable itself has to be expressed as a Jess function call no matter what. If you want to express exactly what you've shown here without any Jess code, then I'm afraid you're out of luck!

If, on the other hand, it's OK for the initial value of the defglobal to be one, specific object created in Java, then you could just create the FuzzyVariable in Java (including the "addTerm" calls) and then call something like

FuzzyRete engine = ...
FuzzyVariable var = ...
Defglobal dg = new Defglobal("*v*", new Value(var));
engine.addDefglobal(dg);

On Mar 2, 2010, at 11:09 PM, Andrew Meng wrote:

Hello,

I try to follow a fuzzyJess example. It does something(in Jess only) like:

(defglobal ?*v* = (new FuzzyVariable "value"  0 100 "percentage"))

then
(?*v* addTerm "low", (new TriangleFuzzySet (...))

I am wondering how I could do the same thing totally from Java using Jess API.


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------

Reply via email to