Forward chaining and reverse chaining in java

What would be the best approach for implementing a chaining chain and a reverse chaining process for reasoning in java?

We are given a knowledge base in the form of a horn, which has many statements.

I tried to search the Internet, but I could not find a description of how to implement this concept of artificial intelligence in coding.

My understanding:

I still thought that I would read every sentence (Horn-Form) and create its object. Each object of the Sentence class will have relationship variables, and when I ask for the knowledge base for the Backward or Forward chain, it will check the array of these objects and build the desired chain.

 public class Sentence{

    private String impliedBy;
    private String implementedVar;

    public Sentence(String sentence){
       String[] relation = sentence.split("=>");
       this.impliedBy = relation[0];
       this.implementedVar = relation[1];
    }
    ...
 }

Challenge the class, saying ...

Sentence s = new Sentence("a&b=>c");

, , , , . , - , ...

!

+5
5

, Drools JESS, .

- Rete, . .

+6

, , ( , ). , Hornsat .

+1

, OPS5, . , , .

, . , .

, . Jekejeke Minlog.

à la Marvin Minsky HornClauses . HornClauses, X HornClauses, X .

  A <- D, X      X <- G
          |      |
          +------+

HornClause AND, HornClauses . , .

Bye

+1
source

Well, that may also help using:

HashMap map = new HashMap (); map.put (impliedBy, impliedVar);

To get var is simple: String value = map.get (impliedBy).

0
source

All Articles