Program: 10229
Project: 10229
Buggy source:
@Override public boolean instanceCheck(Description description,Individual individual) throws ReasoningMethodUnsupportedException {
  if (description instanceof NamedClass) {
    return classInstancesPos.get((NamedClass)description).contains(individual);
  }
 else   if (description instanceof Negation) {
    Description child=description.getChild(0);
    if (child instanceof NamedClass) {
      return classInstancesNeg.get((NamedClass)child).contains(individual);
    }
 else {
      throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    }
  }
 else   if (description instanceof Thing) {
    return true;
  }
 else   if (description instanceof Nothing) {
    return false;
  }
 else   if (description instanceof Union) {
    List<Description> children=description.getChildren();
    for (    Description child : children) {
      if (instanceCheck(child,individual))       return true;
    }
    return false;
  }
 else   if (description instanceof Intersection) {
    List<Description> children=description.getChildren();
    for (    Description child : children) {
      if (!instanceCheck(child,individual))       return false;
    }
    return true;
  }
 else   if (description instanceof ObjectSomeRestriction) {
    ObjectPropertyExpression ope=((ObjectSomeRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    ;
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return false;
    }
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null)     return false;
    for (    Individual roleFiller : roleFillers) {
      if (instanceCheck(child,roleFiller))       return true;
    }
    return false;
  }
 else   if (description instanceof ObjectAllRestriction) {
    ObjectPropertyExpression ope=((ObjectAllRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    ;
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null)     return true;
    for (    Individual roleFiller : roleFillers) {
      if (!instanceCheck(child,roleFiller))       return false;
    }
    return true;
  }
 else   if (description instanceof ObjectMinCardinalityRestriction) {
    ObjectPropertyExpression ope=((ObjectCardinalityRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    int number=((ObjectCardinalityRestriction)description).getNumber();
    int nrOfFillers=0;
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null || roleFillers.size() < number)     return false;
    int index=0;
    for (    Individual roleFiller : roleFillers) {
      index++;
      if (instanceCheck(child,roleFiller)) {
        nrOfFillers++;
        if (nrOfFillers == number)         return true;
      }
    }
    return false;
  }
 else   if (description instanceof ObjectMaxCardinalityRestriction) {
    ObjectPropertyExpression ope=((ObjectCardinalityRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    int number=((ObjectCardinalityRestriction)description).getNumber();
    int nrOfFillers=0;
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null || roleFillers.size() > number)     return true;
    int index=0;
    for (    Individual roleFiller : roleFillers) {
      index++;
      if (instanceCheck(child,roleFiller)) {
        nrOfFillers++;
        if (nrOfFillers == number)         return false;
      }
    }
    return true;
  }
 else   if (description instanceof BooleanValueRestriction) {
    DatatypeProperty dp=((BooleanValueRestriction)description).getRestrictedPropertyExpresssion();
    boolean value=((BooleanValueRestriction)description).getBooleanValue();
    if (value) {
      return bdPos.get(dp).contains(individual);
    }
 else {
      return bdNeg.get(dp).contains(individual);
    }
  }
 else   if (description instanceof DatatypeSomeRestriction) {
    DatatypeSomeRestriction dsr=(DatatypeSomeRestriction)description;
    DatatypeProperty dp=(DatatypeProperty)dsr.getRestrictedPropertyExpression();
    DataRange dr=dsr.getDataRange();
    SortedSet<Double> values=dd.get(dp).get(individual);
    if (values == null)     return false;
    if (dr instanceof DoubleMaxValue) {
      if (values.first() <= ((DoubleMaxValue)dr).getValue())       return true;
 else       return false;
    }
 else     if (dr instanceof DoubleMinValue) {
      if (values.last() >= ((DoubleMinValue)dr).getValue())       return true;
 else       return false;
    }
  }
  throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
}

Fixed version (ground truth):
@Override public boolean instanceCheck(Description description,Individual individual) throws ReasoningMethodUnsupportedException {
  if (description instanceof NamedClass) {
    return classInstancesPos.get((NamedClass)description).contains(individual);
  }
 else   if (description instanceof Negation) {
    Description child=description.getChild(0);
    if (child instanceof NamedClass) {
      return classInstancesNeg.get((NamedClass)child).contains(individual);
    }
 else {
      throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    }
  }
 else   if (description instanceof Thing) {
    return true;
  }
 else   if (description instanceof Nothing) {
    return false;
  }
 else   if (description instanceof Union) {
    List<Description> children=description.getChildren();
    for (    Description child : children) {
      if (instanceCheck(child,individual))       return true;
    }
    return false;
  }
 else   if (description instanceof Intersection) {
    List<Description> children=description.getChildren();
    for (    Description child : children) {
      if (!instanceCheck(child,individual))       return false;
    }
    return true;
  }
 else   if (description instanceof ObjectSomeRestriction) {
    ObjectPropertyExpression ope=((ObjectSomeRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    ;
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return false;
    }
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null)     return false;
    for (    Individual roleFiller : roleFillers) {
      if (instanceCheck(child,roleFiller))       return true;
    }
    return false;
  }
 else   if (description instanceof ObjectAllRestriction) {
    ObjectPropertyExpression ope=((ObjectAllRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    ;
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null)     return true;
    for (    Individual roleFiller : roleFillers) {
      if (!instanceCheck(child,roleFiller))       return false;
    }
    return true;
  }
 else   if (description instanceof ObjectMinCardinalityRestriction) {
    ObjectPropertyExpression ope=((ObjectCardinalityRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    int number=((ObjectCardinalityRestriction)description).getNumber();
    int nrOfFillers=0;
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null || roleFillers.size() < number)     return false;
    int index=0;
    for (    Individual roleFiller : roleFillers) {
      index++;
      if (instanceCheck(child,roleFiller)) {
        nrOfFillers++;
        if (nrOfFillers == number)         return true;
      }
 else {
        if (roleFillers.size() - index < number)         return false;
      }
    }
    return false;
  }
 else   if (description instanceof ObjectMaxCardinalityRestriction) {
    ObjectPropertyExpression ope=((ObjectCardinalityRestriction)description).getRole();
    if (!(ope instanceof ObjectProperty))     throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
    ObjectProperty op=(ObjectProperty)ope;
    Description child=description.getChild(0);
    Map<Individual,SortedSet<Individual>> mapping=opPos.get(op);
    if (mapping == null) {
      logger.warn("String_Node_Str" + op + "String_Node_Str");
      return true;
    }
    int number=((ObjectCardinalityRestriction)description).getNumber();
    int nrOfFillers=0;
    SortedSet<Individual> roleFillers=opPos.get(op).get(individual);
    if (roleFillers == null || roleFillers.size() > number)     return true;
    int index=0;
    for (    Individual roleFiller : roleFillers) {
      index++;
      if (instanceCheck(child,roleFiller)) {
        nrOfFillers++;
        if (nrOfFillers == number)         return false;
      }
 else {
        if (roleFillers.size() - index <= number)         return true;
      }
    }
    return true;
  }
 else   if (description instanceof BooleanValueRestriction) {
    DatatypeProperty dp=((BooleanValueRestriction)description).getRestrictedPropertyExpresssion();
    boolean value=((BooleanValueRestriction)description).getBooleanValue();
    if (value) {
      return bdPos.get(dp).contains(individual);
    }
 else {
      return bdNeg.get(dp).contains(individual);
    }
  }
 else   if (description instanceof DatatypeSomeRestriction) {
    DatatypeSomeRestriction dsr=(DatatypeSomeRestriction)description;
    DatatypeProperty dp=(DatatypeProperty)dsr.getRestrictedPropertyExpression();
    DataRange dr=dsr.getDataRange();
    SortedSet<Double> values=dd.get(dp).get(individual);
    if (values == null)     return false;
    if (dr instanceof DoubleMaxValue) {
      if (values.first() <= ((DoubleMaxValue)dr).getValue())       return true;
 else       return false;
    }
 else     if (dr instanceof DoubleMinValue) {
      if (values.last() >= ((DoubleMinValue)dr).getValue())       return true;
 else       return false;
    }
  }
  throw new ReasoningMethodUnsupportedException("String_Node_Str" + description + "String_Node_Str");
}