Home > bossam, manual > Explanations in Bossam

Explanations in Bossam

January 23, 2007 Leave a comment Go to comments

As of 0.9b40, Bossam comes with a small explanation feature. You can easily utilize the explanation feature in Bossam shell. The command is simple as follows:

explain fact-id;

fact-id is the ID of the fact for which an explanation is requested.

Suppose we assert a set of knowledge and run a reasoning session in the Bossam shell as follows:

> assert fact f1 is hasParent(a,b);
> assert fact f2 is hasParent(b,c);
> assert fact f3 is hasParent(c,d);
> assert rule r2 is if hasParent(?x,?y) 
  then hasAncestor(?x,?y);
> run;
Running.....
Reasoning Completed.
fact def:Fact2 is def:hasAncestor(def:c,def:d);
fact def:Fact1 is def:hasAncestor(def:b,def:c);
fact def:Fact0 is def:hasAncestor(def:a,def:b);

With explanation, it’s possible to see which set of facts contributed to the derivation of a specific fact. For example, we can see the explanation for the Fact2 as follows:

> explain def:Fact2;
Fact2: def:hasAncestor(def:c,def:d) [from r2]
 f3: def:hasParent(def:c,def:d) [Given]

We can see that the Fact2 is derived by the rule r2 with the support of the fact f3 which is given. As such, we can track the derivation path of conclusions. For a slightly more complex example, we add one more rule and request an explanation as follows.

> assert rule r2 is if hasAncestor(?x,?y) and hasParent(?y,?z) 
  then hasAncestor(?x,?z);
Asserted.
> run;
Running.....
Reasoning Completed.
fact def:Fact5 is def:hasAncestor(def:a,def:d);
fact def:Fact3 is def:hasAncestor(def:b,def:d);
fact def:Fact4 is def:hasAncestor(def:a,def:c);
> explain def:Fact5;
Fact5: def:hasAncestor(def:a,def:d) [from r2]
 Fact4: def:hasAncestor(def:a,def:c) [from r2]
  Fact0: def:hasAncestor(def:a,def:b) [from r2]
   f1: def:hasParent(def:a,def:b) [Given]
  f2: def:hasParent(def:b,def:c) [Given]
 f3: def:hasParent(def:c,def:d) [Given]
>

We see an embedded hierarchy of derivation relations. Fact5 is derived by the rule r2 with the support of the facts Fact4 and f3. Fact4 is derived again by r2 with the support of Fact0 and f2, and Fact0 is soley supported by the given fact f1.

Currently, Bossam does not provide a data structure for explanations. The bossam.app.IReasoner interface provides a method getProof() that accepts a fact ID and returns an explanation string.

I’m considering a number of ways to provide an object model or an XML markup for the explanations. Any suggestions?

Advertisements
Categories: bossam, manual
  1. josue
    January 20, 2010 at 12:00 am

    Hi,

    I’m trying to use the explanation utility of Bossam from its Java API, but I can’t.

    I try with several “fact IDs” but everyone returns “null”:

    reasoner.getProof(“http://bossam.com/default#Fact9”);
    reasoner.getProof(“#Fact9”);
    reasoner.getProof(“Fact9”);
    reasoner.getProof(“9”);

    What am I doing wrong?

    Thank you!
    Josué

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: