Program: 9759
Project: 9759
Buggy source:
@Override public void init() throws ComponentInitException {
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().clone();
  classHierarchy.thinOutSubsumptionHierarchy();
  minimizer=new DescriptionMinimizer(reasoner);
  startClass=Thing.instance;
  singleSuggestionMode=configurator.getSingleSuggestionMode();
  operator=new RhoDRDown(reasoner,classHierarchy,startClass,configurator);
  baseURI=reasoner.getBaseURI();
  prefixes=reasoner.getPrefixes();
  bestEvaluatedDescriptions=new EvaluatedDescriptionSet(configurator.getMaxNrOfResults());
  isClassLearningProblem=(learningProblem instanceof ClassLearningProblem);
  noise=configurator.getNoisePercentage() / 100d;
  maxDepth=configurator.getMaxDepth();
  filterFollowsFromKB=configurator.getFilterDescriptionsFollowingFromKB() && isClassLearningProblem;
  if (isClassLearningProblem) {
    ClassLearningProblem problem=(ClassLearningProblem)learningProblem;
    classToDescribe=problem.getClassToDescribe();
    isEquivalenceProblem=problem.isEquivalenceProblem();
    examples=reasoner.getIndividuals(classToDescribe);
    if (isEquivalenceProblem) {
      Set<Description> existingDefinitions=reasoner.getAssertedDefinitions(classToDescribe);
      if (configurator.getReuseExistingDescription() && (existingDefinitions.size() > 0)) {
        Description existingDefinition=null;
        int highestLength=0;
        for (        Description exDef : existingDefinitions) {
          if (exDef.getLength() > highestLength) {
            existingDefinition=exDef;
            highestLength=exDef.getLength();
          }
        }
        LinkedList<Description> startClassCandidates=new LinkedList<Description>();
        startClassCandidates.add(existingDefinition);
        ((RhoDRDown)operator).setDropDisjuncts(true);
        RefinementOperator upwardOperator=new OperatorInverter(operator);
        boolean startClassFound=false;
        Description candidate;
        do {
          candidate=startClassCandidates.pollFirst();
          if (((ClassLearningProblem)learningProblem).getRecall(candidate) < 1.0) {
            Set<Description> refinements=upwardOperator.refine(candidate,candidate.getLength());
            LinkedList<Description> refinementList=new LinkedList<Description>(refinements);
            startClassCandidates.addAll(refinementList);
          }
 else {
            startClassFound=true;
          }
        }
 while (!startClassFound);
        startClass=candidate;
        if (startClass.equals(existingDefinition)) {
          logger.info("String_Node_Str" + startClass.toManchesterSyntaxString(baseURI,prefixes) + "String_Node_Str");
        }
 else {
          logger.info("String_Node_Str" + existingDefinition.toManchesterSyntaxString(baseURI,prefixes) + "String_Node_Str"+ startClass.toManchesterSyntaxString(baseURI,prefixes)+ "String_Node_Str");
        }
        ((RhoDRDown)operator).setDropDisjuncts(false);
      }
 else {
        Set<Description> superClasses=reasoner.getClassHierarchy().getSuperClasses(classToDescribe);
        if (superClasses.size() > 1) {
          startClass=new Intersection(new LinkedList<Description>(superClasses));
        }
 else         if (superClasses.size() == 1) {
          startClass=(Description)superClasses.toArray()[0];
        }
 else {
          startClass=Thing.instance;
          logger.warn(classToDescribe + "String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
 else   if (learningProblem instanceof PosOnlyLP) {
    examples=((PosOnlyLP)learningProblem).getPositiveExamples();
  }
 else   if (learningProblem instanceof PosNegLP) {
    examples=Helper.union(((PosNegLP)learningProblem).getPositiveExamples(),((PosNegLP)learningProblem).getNegativeExamples());
  }
}

Fixed version (ground truth):
@Override public void init() throws ComponentInitException {
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().clone();
  classHierarchy.thinOutSubsumptionHierarchy();
  minimizer=new DescriptionMinimizer(reasoner);
  startClass=Thing.instance;
  singleSuggestionMode=configurator.getSingleSuggestionMode();
  operator=new RhoDRDown(reasoner,classHierarchy,startClass,configurator);
  baseURI=reasoner.getBaseURI();
  prefixes=reasoner.getPrefixes();
  if (configurator.getWriteSearchTree()) {
    Files.clearFile(new File(configurator.getSearchTreeFile()));
  }
  bestEvaluatedDescriptions=new EvaluatedDescriptionSet(configurator.getMaxNrOfResults());
  isClassLearningProblem=(learningProblem instanceof ClassLearningProblem);
  noise=configurator.getNoisePercentage() / 100d;
  maxDepth=configurator.getMaxDepth();
  filterFollowsFromKB=configurator.getFilterDescriptionsFollowingFromKB() && isClassLearningProblem;
  if (isClassLearningProblem) {
    ClassLearningProblem problem=(ClassLearningProblem)learningProblem;
    classToDescribe=problem.getClassToDescribe();
    isEquivalenceProblem=problem.isEquivalenceProblem();
    examples=reasoner.getIndividuals(classToDescribe);
    if (isEquivalenceProblem) {
      Set<Description> existingDefinitions=reasoner.getAssertedDefinitions(classToDescribe);
      if (configurator.getReuseExistingDescription() && (existingDefinitions.size() > 0)) {
        Description existingDefinition=null;
        int highestLength=0;
        for (        Description exDef : existingDefinitions) {
          if (exDef.getLength() > highestLength) {
            existingDefinition=exDef;
            highestLength=exDef.getLength();
          }
        }
        LinkedList<Description> startClassCandidates=new LinkedList<Description>();
        startClassCandidates.add(existingDefinition);
        ((RhoDRDown)operator).setDropDisjuncts(true);
        RefinementOperator upwardOperator=new OperatorInverter(operator);
        boolean startClassFound=false;
        Description candidate;
        do {
          candidate=startClassCandidates.pollFirst();
          if (((ClassLearningProblem)learningProblem).getRecall(candidate) < 1.0) {
            Set<Description> refinements=upwardOperator.refine(candidate,candidate.getLength());
            LinkedList<Description> refinementList=new LinkedList<Description>(refinements);
            startClassCandidates.addAll(refinementList);
          }
 else {
            startClassFound=true;
          }
        }
 while (!startClassFound);
        startClass=candidate;
        if (startClass.equals(existingDefinition)) {
          logger.info("String_Node_Str" + startClass.toManchesterSyntaxString(baseURI,prefixes) + "String_Node_Str");
        }
 else {
          logger.info("String_Node_Str" + existingDefinition.toManchesterSyntaxString(baseURI,prefixes) + "String_Node_Str"+ startClass.toManchesterSyntaxString(baseURI,prefixes)+ "String_Node_Str");
        }
        ((RhoDRDown)operator).setDropDisjuncts(false);
      }
 else {
        Set<Description> superClasses=reasoner.getClassHierarchy().getSuperClasses(classToDescribe);
        if (superClasses.size() > 1) {
          startClass=new Intersection(new LinkedList<Description>(superClasses));
        }
 else         if (superClasses.size() == 1) {
          startClass=(Description)superClasses.toArray()[0];
        }
 else {
          startClass=Thing.instance;
          logger.warn(classToDescribe + "String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
 else   if (learningProblem instanceof PosOnlyLP) {
    examples=((PosOnlyLP)learningProblem).getPositiveExamples();
  }
 else   if (learningProblem instanceof PosNegLP) {
    examples=Helper.union(((PosNegLP)learningProblem).getPositiveExamples(),((PosNegLP)learningProblem).getNegativeExamples());
  }
}