On Wed, Feb 24, 2010 at 4:51 AM, Ernest Friedman-Hill <[email protected]>wrote:

>
> On Feb 23, 2010, at 11:38 PM, Manolis Mavrikis wrote:
>
>  Bad assumption; the rules are written for the situation where all of the
>> VirtualSite and InetModem objects are added to working memory using (add) or
>> (definstance).
>>
>>
>> Thanks. Isn't that a bit redundant and rigid?
>>
>
> ???
>

Apologies I probably had my use case in mind. I meant that I don't see the
reason one would add both the object as a fact and then have to add what it
consists of as well.  But fair as you say below there may be a reason for
that.

>
> Sure there is, you didn't ask about that. The rules we're talking about,
> though, have as their very purpose finding the InetModem address that goes
> with a given VirtualSite; it's like doing a join across two tables in a
> database.
>
>
So, in my case the fact (the equivalent of the VirtualSite) is quite complex
as it contains a HashMap but lets start with something simple as I haven't
touched JESS code for a while, so I am doing something wrong.

So let's say I would like to write a rule that check whether the value of
MockVerifier is true (but for other reasons I don't want to add MockVerifier
as a fact). So I have a fact like this

 ==> f-4 (MAIN::analysisResultUpdater (class <Java-Object:java.lang.Class>)
 (testMe TRUE)
 (verifier <Java-Object:uk.ac.lkl.migen.system.AI.analysis.MockVerifier>)
 (OBJECT
<Java-Object:uk.ac.lkl.migen.system.AI.reasoning.AnalysisResultUpdater>))

The MockVerifier is a class that returns a value with the getValue method
(so I even made it a proper bean thinking that that was my problem but I am
still struggling).

My latest attempt is something like

(defrule MOCK_VERIFIER_TRUE
  (analysisResultUpdater (verifier ?aru1))
  (MockVerifier (value ?value) (OBJECT ?aru1))
  ;;and here I was thinking that maybe I should use test but
=>
...

Not sure what I am doing wrong. Obviously the pattern cannot match since the
fact is not there but any previous attempt on describing it with the
MockVerifier as a slot of the analysisResultUpdater was failing.

Any ideas?

Thanks again !
Manolis

Reply via email to