Thanks Wolfgang, this helps a lot! I must have missed the
getConditionalElements in the API. The analysis of the rule's LHS is
working great and it's RHS is more complex but do-able.

Once again, thanks for the advice,
Pete


On Thu, Aug 15, 2013 at 6:51 PM, Wolfgang Laun <wolfgang.l...@gmail.com>wrote:

> Rete has listDefrules and Defrule has getConditionalElements, which
> lets you retrieve its constituents, depending on it being a Pattern or
> Accumulate; if it is a Group you must recurse down... It's like
> walking an AST
>
> RHS is similar. But note that fact modifications are possible in
> functions, so if one of these is called on the RHS, you'll have to
> investigate in depth.
>
> Expect to have some fun ;-)
>
> Cheers
> Wolfgang
>
>
> On 14/08/2013, Przemyslaw Woznowski <p.r.woznow...@cs.cf.ac.uk> wrote:
> > Dear Jess users.
> >
> > What I am trying to do is to dynamically list all the defrules together
> > with their LHS and RHS facts excluding any conditions. Basically what I
> > mean is that, for example, if there are Person and Car facts on the
> rule's
> > LHS and the rule asserts an Owner fact, deletes the Car fact and modifies
> > the Person fact. I would like to create a data structure that would, for
> > each rule, carry it's name and the facts it needs to fire (excluding any
> > conditions just deftemplate's name) and any deftemplates that appear on
> the
> > rule's RHS. So for the example above, something like:
> > Rule_1
> >  needs: Person, Car
> >  asserts: Owner
> >  modifies: Person
> >  deletes: Car
> >
> > I can get a list of all defrules via the listDefrules() method called on
> > the Rete object but then it gets tricky. The listNodes() method called on
> > the HasLHS object gives a textual description of the rule's LHS but I
> > cannot find a method that would simply return name of facts on the LHS.
> > Some text processing would solve the rule's LHS problem as I can look for
> > occurrences of "::" to find facts. However, the rule's RHS is more
> > problematic as I cannot find a method that would give me what I want.
> >
> > I would appreciate your help with this one.
> >
> > Best regards,
> > Pete
> >
> > --
> > Przemyslaw (Pete) Woznowski, PhD candidate & RA
> > Email: p.r.woznow...@cs.cardiff.ac.uk
> > Room C/2.06, Desk 8
> > Cardiff School of Computer Science & Informatics,
> > Cardiff University,
> > Queen's Buildings,
> > 5 The Parade, Roath,
> > Cardiff, CF24 3AA, UK
> > & School of Healthcare Studies,
> > Cardiff University
> > Cardigan House
> > Heath Park Campus
> > Cardiff, CF14 4XN, UK
> >
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
> --------------------------------------------------------------------
>
>


-- 
Przemyslaw (Pete) Woznowski, PhD candidate & RA
Email: p.r.woznow...@cs.cardiff.ac.uk
Room C/2.06, Desk 8
Cardiff School of Computer Science & Informatics,
Cardiff University,
Queen's Buildings,
5 The Parade, Roath,
Cardiff, CF24 3AA, UK
& School of Healthcare Studies,
Cardiff University
Cardigan House
Heath Park Campus
Cardiff, CF14 4XN, UK

Reply via email to