aspose file tools
The moose likes General Computing and the fly likes Mandarax Querying....pls help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » General Computing
Reply Bookmark "Mandarax Querying....pls help" Watch "Mandarax Querying....pls help" New topic
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Mandarax Querying....pls help
 
Similar Threads
what is the answer
rules engine decision table book or web page
Mandarax
What is JBoss Drools?
How to retrieve the collection of conditions using Drools ?