List diseaseExcludedTerms = disease.getNegativeAnnotations();
Set queryancestors = getAncestorTerms(ontology,tid,true);
The implementation is reversed (you don't notice this if the excluded term is the same in deisease and query of course). If a patient as NOT for term t, then if the disease is NOT for that term or NOT for any of the descendents of the term, then there is a NOT-NOT match.
List diseaseExcludedTerms = disease.getNegativeAnnotations();
Set queryancestors = getAncestorTerms(ontology,tid,true);
The implementation is reversed (you don't notice this if the excluded term is the same in deisease and query of course). If a patient as NOT for term t, then if the disease is NOT for that term or NOT for any of the descendents of the term, then there is a NOT-NOT match.