thanks....
I have always the same error:
"COM.hugin.HAPI.ExceptionUsage: An API function was called with an invalid argument (e.g., a NULL object was passed to a function that expects a non-NULL argument).
at COM.hugin.HAPI.ExceptionHugin.throwException(ExceptionHugin.java:115)
at COM.hugin.HAPI.Domain.learnStructure(Domain.java:1451)
at Prova.main(Test.java:80)"
In my code:
1 - in the while loop I pass the value of record of my database to the states of nodes
2 - I use Domain.saveCases(java.lang.String fileName, NodeList nodes, int[] cases, boolean caseCounts, java.lang.String separator, java.lang.String missingData) to save the cases in a file "cases.dat"
3 - I use Domain.parseCases(java.lang.String fileName, ParseListener parseListener) to pass the cases stored in "cases.dat" and enters the cases into this Domain.
4 - I use Domain.leanStructure for PC-algorithm
5 - I use Domain.compile()
6 - I use Domain.learnTables()
This is a part of my new code:
...........................
int cases[]=new int[30];
int p=0;
int z=0;
boolean caseCount=true;
int statenode = 0;
NodeList nodes = new NodeList();
nodes.add(one);
nodes.add(two);
Resulset rset = stmt.executeQuery("SELECT one FROM table;");
Resulset rset2 = stmt2.executeQuery("SELECT two FROM table;");
while(rset.next()&&rset2.next()){
p=myDomain.newCase();
cases[z]=p;
one.setCaseState(p,statenode);
two.setCaseState(p,statenode);
a = rset.getString("one");
b = rset2.getString("two");
one.setStateLabel(statenode,a);
two.setStateLabel(statenode,b);
statenode++;
z++
}
two.addParent(one);
myDomain.saveCases("cases.dat",nodes,cases,caseCount," "," ");
myDomain.parseCases("cases.dat",new DefaultClassParseListener());
myDomain.learnStructure();
myDomain.compile();
myDomain.learnTables();
........................