I think John wrote: > It is fascinating as well as frustrating as solving problem bring forth new > ones.
Frustrating, indeed. There are two quite different sets of terminology and concepts all smushed together in this thread (Jess and Protege) and although I can guess at what's being discussed at times, I'm never quite sure. One of these days I'm going to have to make a study of Protege and JessTab so I can contribute to this kind of discussion. As it is, there are but a few places where I can contribute something, so I'll give it a try. > > Q2. What is the difference between defglobal and bind? > > I understand defglobal is global and reset doesnt affect it. But I see funny > things. In the project I gave in my last mail, jus change > (defglobal ?*res* = ... > to > (bind ?res ... > I get funny results. (change the variable in defrule also) > A defglobal is sort of like a Java static variable, whereas a variable created by "bind' at the command prompt is like a local variable, available only at the command prompt. If you define a rule and use a variable of the same name, the fact that the local variable at the command prompt exists is completely irrelevant -- it will be utterly ignored. So while using the name of a defglobal on the left side of a rule means to match a slot to the value of a defglobal, using the name of a local variable defined at the prompt is just like using any other variable name -- the variable is bound to whatever value is in that slot, and matching continues. To repeat: any value bound to a local variable at the prompt is completely irrelevant in the definition or behavior of any rules. > Q3. Can rules can be nested? No. Not sure what that would even mean. > > Finally, Dona, my problem of matching multifield to multifield instance slot > is still unsolved. > > find-all-instances provides a list of matching fields. However, inside the > rule, the matching occurs only to the head instance of the list. > > Why is the below code not firing any rules > > (defrule simple-multi-multi-match > > ?rem <- (object(is-a Hello) (Resource\ ID $?before 111 $?after)) > ?behavior <- (object(is-a Node\ Spoof) (Resource\ sequence $?before > ?rem $?after)) > => > (printout t "Behavior ID\: " (slot-get ?behavior Behavior\ ID) crlf)) > > I understand ?rem is an object, Specifically, it's a jess.Fact object. Perhaps the Java instance you're interested in is held in a slot named "OBJECT", which is how normal Jess definstances work. Have you tried that? > then how do I get the multi-slot value from > it, to use in second statement.(without defglobals) I think part of the difficulty here is that we're using different terms to describe the same things, and as a result, we're not communicating. A FACT has slots. The thing that you're matching with a PATTERN like "(object..." is a FACT. A FACT has SLOTS. The things that you're matching like "(is-a..." and "(Resource\ sequence" are SLOTS. Some SLOTs are "single slots", which can hold only a single value. Other slots are MULTISLOTS, which hold a list of zero or more values of any kind. Every SLOT has a name. One thing about Jess multislots (and Jess lists in general) is that they are *flat*. If you try to construct a list which contains nested lists, they all get flattened to a single one-dimensional list. A list (or multislot) can, however, contain arbitrary Java objects, including other jess.Fact objects (which themselves have slots of their own) or Protege instances. So *WHICH* multislot(s) is/are of interest? And what exactly are the types of the values that they hold? I'm sure that the questions you're asking have straightforward answers. But without clear answers to *my* questions, I can't be of any help to you at all. --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- 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] --------------------------------------------------------------------