Program: 9596
Project: 9596
Buggy source:
@Override public void init() throws ComponentInitException {
  Set<NamedClass> usedConcepts;
  if (allowedConcepts != null) {
    Helper.checkConcepts(reasoner,allowedConcepts);
    usedConcepts=allowedConcepts;
  }
 else   if (ignoredConcepts != null) {
    usedConcepts=Helper.computeConceptsUsingIgnoreList(reasoner,ignoredConcepts);
  }
 else {
    usedConcepts=Helper.computeConcepts(reasoner);
  }
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts);
  classHierarchy.thinOutSubsumptionHierarchy();
  if (heuristic == null) {
    heuristic=new OEHeuristicRuntime();
  }
  minimizer=new DescriptionMinimizer(reasoner);
  startClass=Thing.instance;
  if (operator == null) {
    operator=new RhoDRDown();
    ((RhoDRDown)operator).setStartClass(startClass);
    ((RhoDRDown)operator).setSubHierarchy(classHierarchy);
    ((RhoDRDown)operator).setReasoner(reasoner);
    ((RhoDRDown)operator).init();
  }
  baseURI=reasoner.getBaseURI();
  prefixes=reasoner.getPrefixes();
  if (writeSearchTree) {
    File f=new File(searchTreeFile);
    Files.clearFile(f);
  }
  bestEvaluatedDescriptions=new EvaluatedDescriptionSet(maxNrOfResults);
  isClassLearningProblem=(learningProblem instanceof ClassLearningProblem);
  noise=noisePercentage / 100d;
  filterFollowsFromKB=filterDescriptionsFollowingFromKB && 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 (reuseExistingDescription && (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 {
  Set<NamedClass> usedConcepts;
  if (allowedConcepts != null) {
    Helper.checkConcepts(reasoner,allowedConcepts);
    usedConcepts=allowedConcepts;
  }
 else   if (ignoredConcepts != null) {
    usedConcepts=Helper.computeConceptsUsingIgnoreList(reasoner,ignoredConcepts);
  }
 else {
    usedConcepts=Helper.computeConcepts(reasoner);
  }
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts);
  classHierarchy.thinOutSubsumptionHierarchy();
  if (heuristic == null) {
    heuristic=new OEHeuristicRuntime();
  }
  minimizer=new DescriptionMinimizer(reasoner);
  startClass=Thing.instance;
  if (operator == null) {
    operator=new RhoDRDown();
    ((RhoDRDown)operator).setStartClass(startClass);
    ((RhoDRDown)operator).setSubHierarchy(classHierarchy);
    ((RhoDRDown)operator).setReasoner(reasoner);
    ((RhoDRDown)operator).init();
  }
 else {
    ((RhoDRDown)operator).setSubHierarchy(classHierarchy);
  }
  baseURI=reasoner.getBaseURI();
  prefixes=reasoner.getPrefixes();
  if (writeSearchTree) {
    File f=new File(searchTreeFile);
    Files.clearFile(f);
  }
  bestEvaluatedDescriptions=new EvaluatedDescriptionSet(maxNrOfResults);
  isClassLearningProblem=(learningProblem instanceof ClassLearningProblem);
  noise=noisePercentage / 100d;
  filterFollowsFromKB=filterDescriptionsFollowingFromKB && 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 (reuseExistingDescription && (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());
  }
}