Program: 9425
Project: 9425
Buggy source:
/** 
 * This method modifies the subsumption hierarchy such that for each class, there is only a single path to reach it via upward and downward refinement respectively.
 */
public void thinOutSubsumptionHierarchy(){
  TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>> hierarchyDownNew=new TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>>();
  TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>> hierarchyUpNew=new TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>>();
  Set<OWLClassExpression> conceptsInSubsumptionHierarchy=new TreeSet<OWLClassExpression>();
  conceptsInSubsumptionHierarchy.addAll(subsumptionHierarchyUp.keySet());
  conceptsInSubsumptionHierarchy.addAll(subsumptionHierarchyDown.keySet());
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    hierarchyDownNew.put(c,new TreeSet<OWLClassExpression>());
    hierarchyUpNew.put(c,new TreeSet<OWLClassExpression>());
  }
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    SortedSet<OWLClassExpression> moreGeneral=subsumptionHierarchyUp.get(c);
    if (moreGeneral != null && moreGeneral.size() != 0) {
      OWLClassExpression chosenParent=moreGeneral.first();
      hierarchyDownNew.get(chosenParent).add(c);
    }
  }
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    SortedSet<OWLClassExpression> moreSpecial=subsumptionHierarchyDown.get(c);
    if (moreSpecial != null && moreSpecial.size() != 0) {
      OWLClassExpression chosenParent=moreSpecial.first();
      hierarchyUpNew.get(chosenParent).add(c);
    }
  }
  subsumptionHierarchyDown=hierarchyDownNew;
  subsumptionHierarchyUp=hierarchyUpNew;
}

Fixed version (ground truth):
/** 
 * This method modifies the subsumption hierarchy such that for each class, there is only a single path to reach it via upward and downward refinement respectively.
 */
public void thinOutSubsumptionHierarchy(){
  TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>> hierarchyDownNew=new TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>>();
  TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>> hierarchyUpNew=new TreeMap<OWLClassExpression,SortedSet<OWLClassExpression>>();
  Set<OWLClassExpression> conceptsInSubsumptionHierarchy=new TreeSet<OWLClassExpression>();
  conceptsInSubsumptionHierarchy.addAll(subsumptionHierarchyUp.keySet());
  conceptsInSubsumptionHierarchy.addAll(subsumptionHierarchyDown.keySet());
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    hierarchyDownNew.put(c,new TreeSet<OWLClassExpression>());
    hierarchyUpNew.put(c,new TreeSet<OWLClassExpression>());
  }
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    SortedSet<OWLClassExpression> moreGeneral=subsumptionHierarchyUp.get(c);
    if (moreGeneral != null && moreGeneral.size() != 0) {
      OWLClassExpression chosenParent=moreGeneral.first();
      hierarchyDownNew.get(chosenParent).add(c);
    }
  }
  for (  OWLClassExpression c : conceptsInSubsumptionHierarchy) {
    SortedSet<OWLClassExpression> moreSpecial=subsumptionHierarchyDown.get(c);
    if (moreSpecial != null && moreSpecial.size() != 0) {
      OWLClassExpression chosenParent=moreSpecial.first();
      hierarchyUpNew.get(chosenParent).add(c);
    }
  }
  hierarchyDownNew.put(df.getOWLThing(),subsumptionHierarchyDown.get(df.getOWLThing()));
  hierarchyUpNew.put(df.getOWLNothing(),subsumptionHierarchyUp.get(df.getOWLNothing()));
  subsumptionHierarchyDown=hierarchyDownNew;
  subsumptionHierarchyUp=hierarchyUpNew;
}