I though using interface worked before. Firslty I though I done a mistake somewhere but I see nothing abnormal and when I use the class instead of the Knowledge interface that build.
My code:
public interface Fact {
public Observation getObservation();
public String getName();
public String getSource();
public void setObservation(final Observation o);
public void setName(final String n);
public void setSource(final String s);
}
public interface Knowledge extends Fact{
public Constraint getConstraint();
public List<Knowledge> subKnowledges();
public Knowledge partOf();
public int getGroup();
public Conclusion getConclusion();
public void setConstraint(final Constraint c );
public void setSubKnowledges(final List<Knowledge> lk);
public void setPartOf(final Knowledge k );
public void setConclusion(final Conclusion c );
public void setGroup(final int g );
public void add(final Knowledge k);
}
basic rules:
rule "Result infer to a knowledge not yet checked"
when
$k: Knowledge( observation == Observation.UNKNOWN )
$r: Result( name == $k.name, observation != Observation.UNKNOWN )
then
$k.observation = $r.observation;
update( $k );
System.out.println($k.name +" "+ $k.observation + " " + $k.conclusion );
System.out.println($r.name +" "+ $r.observation );
//kieSession.getAgenda().getAgendaGroup( "conclusion" )
end
Stack trace:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=fr/cea/ig/labgem/brools/biology/knowledge_reasoner.drl, line=48, column=0
text=Rule Compilation error observation cannot be resolved or is not a field
observation cannot be resolved or is not a field
name cannot be resolved or is not a field
observation cannot be resolved or is not a field
conclusion cannot be resolved or is not a field
name cannot be resolved or is not a field
observation cannot be resolved or is not a field]]
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:365)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:514)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:485)