| Author |
Mandarax Querying....pls help
|
s mahen perera
Ranch Hand
Joined: Mar 08, 2005
Posts: 101
|
|
Hi all, I have the following Rule-ml. <rulebase> <imp> <_head> <atom> <_opr> <rel>Variation in Claims</rel> </_opr> <ind>true</ind> </atom> </_head> <_body> <and> <atom> <_opr> <rel>Advance Stage in Negotiation</rel> </_opr> <ind>true</ind> </atom> <atom> <_opr> <rel>Reliable Measurement of Claim</rel> </_opr> <ind>true</ind> </atom> </and> </_body> </imp> </rulebase> I imported this Rule-ml fragment in to a Mandarax knowledge base using "RuleML0_8_1Driver.importKnowledgeBase()" and the knowledge base imported was kb. I need to query this rule-ml and see whether the head fact is evaluating to true. For that i did the following.. List list = new ArrayList(); Fact headFact = logicFactory.createFact(new SimplePredicate("Variation in Claims",new Class[]{String.class}),new Term[]{logicFactory.createVariableTerm("result",String.class )}); list.add(headFact); Fact bodyFact = logicFactory.createFact(new SimplePredicate("Advance Stage in Negotiation",new Class[]{String.class}),new Term[]{logicFactory.createConstantTerm(selected,String.class)}); list.add(bodyFact); Fact bodyFact 1= logicFactory.createFact(new SimplePredicate("Reliable Measurement of Claim",new Class[]{String.class}),new Term[]{logicFactory.createConstantTerm(selected,String.class)}); list.add(bodyFact1); Fact[] factArr= (Fact[])list.toArray(new Fact[]{}); Query qry = logicFactory.createQuery(factArr,"a query"); ResultSet results=null; try { results = ie.query(qry, kb, ie.ONE, ie.BUBBLE_EXCEPTIONS); //System.out.println("Result is : " + results); // List w = results.getQueryVariables (); //results. results.next(); // Map m = results.getResults(); //results.g Object obj = results.getResult(String.class,"result"); System.out.println ("result is : " + obj); } catch (InferenceException ex2) { System.out.println("Exception while Querying KB.............."); } But i didnt get the result Pls someone help. Thanks in advance for any feedback Mahen
|
 |
 |
|
|
subject: Mandarax Querying....pls help
|
|
|