[rules-users] Question about getObjects() on workspace with defeasible belief system

Davide Sottara dsotty at gmail.com
Mon Jul 21 16:24:32 EDT 2014


Thanks for the feedback! The defeasible subsystem is still very
experimental,
and it's good to know that people are using it.

This said, as for your question. It is possible, but takes a little
effort since we
don't have a public API for that. You can do:

// get the handle for the object
InternalFactHandle handle = (InternalFactHandle) session.getFactHandle(
myObject );
// lookup the belief set, where all justifiers (pos and neg) are stored
and linked
DefeasibleBeliefSet dbs = (DefeasibleBeliefSet)
posHandle.getEqualityKey().getBeliefSet();
DefeasibilityStatus status = dbs.getStatus();

status now has 4 values:
DEFINITELY (strict), DEFEASIBLY, DEFEATEDLY (defeated), UNDECIDEDLY
(unresolved conflict)

Notice that "negatively" asserted facts end up in a "negative" entry
point, so you have to look them
up explicitly:
InternalFactHandle negHandle = (InternalFactHandle)
session.getEntryPoint( "neg" ).getFactHandle( myNegatedObject );

Again, we are currently working on this specific system even now, so
things may change in 6.2,
but this should work in 6.1.
Please report any issue that you might find.
Best
Davide

On 07/21/2014 08:57 PM, Borris wrote:
> I am trying the Defeasible belief system (it ties in pretty well with 
> some of how I want
> to structure my project).
>
> After fixing many typos, the rule behaviour seems to be what it should 
> for a defeasible
> rule being correctly defeated (my clash spotter doesn't fire, which it 
> does if any
> part of the defeasible chain is broken). Which is all jolly fun and good 
> and exciting.
>
> But, my question.
>
> I have a simple workspace dump based upon getting all objects (via 
> ksession.getObjects() )
> and then doing my own tidy presentation. This still shows the defeated 
> fact as present.
>
> So I know there is still record somewhere of the defeated fact, because 
> if the workspace
> changed such that my defeater was retracted, then it needs to make the 
> fact visible again.
>
> But I wasn't expecting to see it via getObjects(). Is that the intended 
> behaviour? If so,
> is there a way to enquire whether a fact is in the "defeated state" or 
> not that I could
> add to my tidy workspace dumper?
>
> Thanks!
>
> Borris
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list