Thanks for the great help.
On Wed, Feb 24, 2010 at 12:19 PM, Ernest Friedman-Hill <[email protected]>wrote:
> To continue the database analogy: not adding the MockVerifiers to working
> memory is like not having a MockVerifiers table, but instead having some
> structured text in a column named "MockVerifiers" in the
> AnalysisResultUpdater table. So to ask this sort of question in that
> database, you'd select AnalysisResultUpdaters, then use a LIKE clause or
> some kind of text functions to match the MockVerifier column. I like the
> database analogy because it makes it clear that you should expect this to be
> less elegant and less performant than having a separate table.
Thanks for the code, it worked for my example.
I like as well your database analogy. In fact it is pertinent to my case.
Perhaps I could add the MockVerifiers explicitly but I can only think of
doing it with HashMaps.
In fact, it is very similar to what I have noe. The analysisResultUpdater
doesn't actually contain just one verifier but a HashMap with many of them
to which I can refer with their string id. So I am trying to decide whether
the values of the HashMaps are the actual objects or some representative
value that I want to query in JESS.
In the second case things are easier and seem to work so with your help I
can now do
(analysisResultUpdater (verifierOutputMap ?verifier&:(eq (?verifier get
"MockVerifier") TRUE)))
and I get the appropriate Boolean value from the hashmap.
Note that I have to made the analysisResultUpdater a Bean and every time
one of the verifiers change I also fire
pcs.firePropertyChange("verifierOutputMap", verifierOutputMap,
newVerifierOutputMap);
which I don't like that much but maybe there is no other way round it.
Unless anyone has any better ideas.
I was hoping I can return the actual object in the hashmap and do something
like that:
(analysisResultUpdater (verifierOutputMap ?verifier&:((?verifier get
"MockVerifier") getValue)))
hoping that only only the verifiers would be Beans.
But although the rule fires the first time further updates don't occur.
Does this makes sense?
Thanks again this is really useful and I hope others will find this
discussion interesting one day
Manolis