1 package examples.ruleset;
3 import com.intendico.data.*;
4 import com.intendico.data.addon.*;
5 import java.util.Vector;
10 static Rule asRule(Vector v) {
11 return new Rule( (Query) v.get( 0 ), (Query) v.get( 1 ) );
17 static public void main(String [] args) {
18 Language logic = Language.getLanguage();
21 // Define the belief structures
22 Vector kb = new Vector();
23 kb.add( new Relation( "P", 1 ) );
26 RuleSet rs = new RuleSet();
27 rs.add( asRule( logic.textToRule( "P($x) => Not P($x)", kb ) ) );
28 rs.add( asRule( logic.textToRule( "Lost P($x) => P($x)", kb ) ) );
31 logic.textToQuery( "P(1)", kb, null, null ).add();
33 // Tell the start state
34 System.out.println( kb );
35 System.out.println( rs );
37 // Run infer as per the theory
41 System.out.println( kb );