Program: 9388
Project: 9388
Buggy source:
@SuppressWarnings({"String_Node_Str"}) public Set<OWLClassExpression> refine(OWLClassExpression description,int maxLength,List<OWLClassExpression> knownRefinements,OWLClassExpression currDomain){
  if (!currDomain.isOWLThing() && !topARefinementsLength.containsKey(currDomain)) {
    topARefinementsLength.put(currDomain,0);
  }
  Set<OWLClassExpression> refinements=new TreeSet<OWLClassExpression>();
  Set<OWLClassExpression> tmp=new HashSet<OWLClassExpression>();
  if (description.isOWLThing()) {
    if (currDomain.isOWLThing()) {
      if (maxLength > topRefinementsLength)       computeTopRefinements(maxLength);
      refinements=(TreeSet<OWLClassExpression>)topRefinementsCumulative.get(maxLength).clone();
    }
 else {
      if (maxLength > topARefinementsLength.get(currDomain)) {
        computeTopRefinements(maxLength,currDomain);
      }
      refinements=(TreeSet<OWLClassExpression>)topARefinementsCumulative.get(currDomain).get(maxLength).clone();
    }
  }
 else   if (description.isOWLNothing()) {
  }
 else   if (!description.isAnonymous()) {
    refinements.addAll(subHierarchy.getSubClasses(description));
    refinements.remove(df.getOWLNothing());
  }
 else   if (description instanceof OWLObjectComplementOf) {
    OWLClassExpression operand=((OWLObjectComplementOf)description).getOperand();
    if (!operand.isAnonymous()) {
      tmp=subHierarchy.getSuperClasses(operand);
      for (      OWLClassExpression c : tmp) {
        if (!c.isOWLThing()) {
          refinements.add(df.getOWLObjectComplementOf(c));
        }
      }
    }
  }
 else   if (description instanceof OWLObjectIntersectionOf) {
    List<OWLClassExpression> operands=((OWLObjectIntersectionOf)description).getOperandsAsList();
    for (    OWLClassExpression child : operands) {
      tmp=refine(child,maxLength - OWLClassExpressionUtils.getLength(description) + OWLClassExpressionUtils.getLength(child),null,currDomain);
      for (      OWLClassExpression c : tmp) {
        List<OWLClassExpression> newChildren=new ArrayList<OWLClassExpression>(operands);
        newChildren.add(c);
        newChildren.remove(child);
        Collections.sort(newChildren);
        OWLClassExpression mc=new OWLObjectIntersectionOfImplExt(newChildren);
        mc=ConceptTransformation.cleanConceptNonRecursive(mc);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc);
        if (checkIntersection((OWLObjectIntersectionOf)mc))         refinements.add(mc);
      }
    }
  }
 else   if (description instanceof OWLObjectUnionOf) {
    List<OWLClassExpression> operands=((OWLObjectUnionOf)description).getOperandsAsList();
    for (    OWLClassExpression child : operands) {
      tmp=refine(child,maxLength - OWLClassExpressionUtils.getLength(description) + OWLClassExpressionUtils.getLength(child),null,currDomain);
      for (      OWLClassExpression c : tmp) {
        List<OWLClassExpression> newChildren=new ArrayList<OWLClassExpression>(operands);
        newChildren.remove(child);
        newChildren.add(c);
        Collections.sort(newChildren);
        OWLObjectUnionOf md=new OWLObjectUnionOfImplExt(newChildren);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(md);
        refinements.add(md);
      }
    }
    if (dropDisjuncts) {
      if (operands.size() == 2) {
        refinements.add(operands.get(0));
        refinements.add(operands.get(1));
      }
 else {
        for (int i=0; i < operands.size(); i++) {
          List<OWLClassExpression> newChildren=new LinkedList<OWLClassExpression>(operands);
          newChildren.remove(i);
          OWLObjectUnionOf md=new OWLObjectUnionOfImplExt(newChildren);
          refinements.add(md);
        }
      }
    }
  }
 else   if (description instanceof OWLObjectSomeValuesFrom) {
    OWLObjectPropertyExpression role=((OWLObjectSomeValuesFrom)description).getProperty();
    OWLClassExpression filler=((OWLObjectSomeValuesFrom)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    tmp=refine(filler,maxLength - 2,null,range);
    for (    OWLClassExpression c : tmp) {
      refinements.add(df.getOWLObjectSomeValuesFrom(role,c));
    }
    if (!role.isAnonymous()) {
      Set<OWLObjectProperty> moreSpecialRoles=reasoner.getSubProperties(role.asOWLObjectProperty());
      for (      OWLObjectProperty moreSpecialRole : moreSpecialRoles) {
        refinements.add(df.getOWLObjectSomeValuesFrom(moreSpecialRole,filler));
      }
    }
    if (useCardinalityRestrictions) {
      if (maxLength > OWLClassExpressionUtils.getLength(description) && maxNrOfFillers.get(role) > 1) {
        OWLObjectMinCardinality min=df.getOWLObjectMinCardinality(2,role,filler);
        refinements.add(min);
      }
    }
    if (useHasValueConstructor && filler.isOWLThing()) {
      Set<OWLIndividual> frequentInds=frequentValues.get(role);
      if (frequentInds != null) {
        for (        OWLIndividual ind : frequentInds) {
          OWLObjectHasValue ovr=df.getOWLObjectHasValue(role,ind);
          refinements.add(ovr);
          if (useObjectValueNegation) {
            refinements.add(df.getOWLObjectComplementOf(ovr));
          }
        }
      }
    }
  }
 else   if (description instanceof OWLObjectAllValuesFrom) {
    OWLObjectPropertyExpression role=((OWLObjectAllValuesFrom)description).getProperty();
    OWLClassExpression filler=((OWLObjectAllValuesFrom)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    tmp=refine(filler,maxLength - 2,null,range);
    for (    OWLClassExpression c : tmp) {
      refinements.add(df.getOWLObjectAllValuesFrom(role,c));
    }
    if (!filler.isOWLNothing() && !filler.isAnonymous() && tmp.size() == 0) {
      refinements.add(df.getOWLObjectAllValuesFrom(role,df.getOWLNothing()));
    }
    if (!role.isAnonymous()) {
      Set<OWLObjectProperty> subProperties=reasoner.getSubProperties(role.asOWLObjectProperty());
      for (      OWLObjectProperty subProperty : subProperties) {
        refinements.add(df.getOWLObjectAllValuesFrom(subProperty,filler));
      }
    }
  }
 else   if (description instanceof OWLObjectCardinalityRestriction) {
    OWLObjectPropertyExpression role=((OWLObjectCardinalityRestriction)description).getProperty();
    OWLClassExpression filler=((OWLObjectCardinalityRestriction)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    int cardinality=((OWLObjectCardinalityRestriction)description).getCardinality();
    if (description instanceof OWLObjectMaxCardinality) {
      if (useNegation || cardinality > 0) {
        tmp=refine(filler,maxLength - 3,null,range);
        for (        OWLClassExpression d : tmp) {
          refinements.add(df.getOWLObjectMaxCardinality(cardinality,role,d));
        }
      }
      if ((useNegation && cardinality > 1) || (!useNegation && cardinality > 2)) {
        refinements.add(df.getOWLObjectMaxCardinality(cardinality - 1,role,filler));
      }
    }
 else     if (description instanceof OWLObjectMinCardinality) {
      tmp=refine(filler,maxLength - 3,null,range);
      for (      OWLClassExpression d : tmp) {
        refinements.add(df.getOWLObjectMinCardinality(cardinality,role,d));
      }
      if (cardinality < maxNrOfFillers.get(role)) {
        refinements.add(df.getOWLObjectMinCardinality(cardinality + 1,role,filler));
      }
    }
  }
 else   if (description instanceof OWLDataSomeValuesFrom) {
    OWLDataPropertyExpression dp=((OWLDataSomeValuesFrom)description).getProperty();
    OWLDataRange dr=((OWLDataSomeValuesFrom)description).getFiller();
    if (dr instanceof OWLDatatypeRestriction) {
      OWLDatatype datatype=((OWLDatatypeRestriction)dr).getDatatype();
      Set<OWLFacetRestriction> facetRestrictions=((OWLDatatypeRestriction)dr).getFacetRestrictions();
      OWLDatatypeRestriction newDatatypeRestriction=null;
      if (datatype.isDouble()) {
        for (        OWLFacetRestriction facetRestriction : facetRestrictions) {
          OWLFacet facet=facetRestriction.getFacet();
          double value=facetRestriction.getFacetValue().parseDouble();
          if (facet == OWLFacet.MAX_INCLUSIVE) {
            int splitIndex=splits.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex - 1;
            if (newSplitIndex >= 0) {
              double newValue=splits.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMaxInclusiveRestriction(newValue);
            }
          }
 else           if (facet == OWLFacet.MIN_INCLUSIVE) {
            int splitIndex=splits.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex + 1;
            if (newSplitIndex < splits.get(dp).size()) {
              double newValue=splits.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMinInclusiveRestriction(newValue);
            }
          }
        }
      }
 else       if (datatype.isInteger()) {
        for (        OWLFacetRestriction facetRestriction : facetRestrictions) {
          OWLFacet facet=facetRestriction.getFacet();
          int value=facetRestriction.getFacetValue().parseInteger();
          if (facet == OWLFacet.MAX_INCLUSIVE) {
            int splitIndex=splitsInt.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex - 1;
            if (newSplitIndex >= 0) {
              int newValue=splitsInt.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMaxInclusiveRestriction(newValue);
            }
          }
 else           if (facet == OWLFacet.MIN_INCLUSIVE) {
            int splitIndex=splitsInt.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex + 1;
            if (newSplitIndex < splitsInt.get(dp).size()) {
              int newValue=splitsInt.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMinInclusiveRestriction(newValue);
            }
          }
        }
      }
      if (newDatatypeRestriction != null) {
        refinements.add(df.getOWLDataSomeValuesFrom(dp,newDatatypeRestriction));
      }
    }
  }
 else   if (description instanceof OWLDataHasValue) {
    OWLDataPropertyExpression dp=((OWLDataHasValue)description).getProperty();
    OWLLiteral value=((OWLDataHasValue)description).getValue();
    if (!dp.isAnonymous()) {
      Set<OWLDataProperty> subDPs=reasoner.getSubProperties(dp.asOWLDataProperty());
      for (      OWLDataProperty subDP : subDPs) {
        refinements.add(df.getOWLDataHasValue(subDP,value));
      }
    }
  }
  if (!description.isOWLThing() && !description.isOWLNothing() && !(description instanceof OWLObjectAllValuesFrom && ((OWLObjectAllValuesFrom)description).getFiller().isOWLNothing())) {
    int topRefLength=maxLength - OWLClassExpressionUtils.getLength(description) - 1;
    if (currDomain.isOWLThing()) {
      if (topRefLength > topRefinementsLength)       computeTopRefinements(topRefLength);
    }
 else     if (topRefLength > topARefinementsLength.get(currDomain))     computeTopRefinements(topRefLength,currDomain);
    if (topRefLength > 0) {
      Set<OWLClassExpression> topRefs;
      if (currDomain.isOWLThing())       topRefs=topRefinementsCumulative.get(topRefLength);
 else       topRefs=topARefinementsCumulative.get(currDomain).get(topRefLength);
      for (      OWLClassExpression c : topRefs) {
        boolean skip=false;
        if (applyAllFilter) {
          if (c instanceof OWLObjectAllValuesFrom) {
            if (description instanceof OWLNaryBooleanClassExpression) {
              for (              OWLClassExpression child : ((OWLNaryBooleanClassExpression)description).getOperands()) {
                if (child instanceof OWLObjectAllValuesFrom) {
                  OWLObjectPropertyExpression r1=((OWLObjectAllValuesFrom)c).getProperty();
                  OWLObjectPropertyExpression r2=((OWLObjectAllValuesFrom)child).getProperty();
                  if (r1.equals(r2)) {
                    skip=true;
                    break;
                  }
                }
              }
            }
          }
        }
        if (disjointChecks && !c.isAnonymous() && !description.isAnonymous()&& isDisjoint(description,c)) {
          skip=true;
        }
        if (!skip) {
          List<OWLClassExpression> operands=Lists.newArrayList(description,c);
          Collections.sort(operands);
          OWLObjectIntersectionOf mc=new OWLObjectIntersectionOfImplExt(operands);
          mc=(OWLObjectIntersectionOf)ConceptTransformation.cleanConceptNonRecursive(mc);
          ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc);
          if (checkIntersection(mc))           refinements.add(mc);
        }
      }
    }
  }
  return refinements;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) public Set<OWLClassExpression> refine(OWLClassExpression description,int maxLength,List<OWLClassExpression> knownRefinements,OWLClassExpression currDomain){
  if (!currDomain.isOWLThing() && !topARefinementsLength.containsKey(currDomain)) {
    topARefinementsLength.put(currDomain,0);
  }
  Set<OWLClassExpression> refinements=new TreeSet<OWLClassExpression>();
  Set<OWLClassExpression> tmp=new HashSet<OWLClassExpression>();
  if (description.isOWLThing()) {
    if (currDomain.isOWLThing()) {
      if (maxLength > topRefinementsLength)       computeTopRefinements(maxLength);
      refinements=(TreeSet<OWLClassExpression>)topRefinementsCumulative.get(maxLength).clone();
    }
 else {
      if (maxLength > topARefinementsLength.get(currDomain)) {
        computeTopRefinements(maxLength,currDomain);
      }
      refinements=(TreeSet<OWLClassExpression>)topARefinementsCumulative.get(currDomain).get(maxLength).clone();
    }
  }
 else   if (description.isOWLNothing()) {
  }
 else   if (!description.isAnonymous()) {
    refinements.addAll(subHierarchy.getSubClasses(description,true));
    refinements.remove(df.getOWLNothing());
  }
 else   if (description instanceof OWLObjectComplementOf) {
    OWLClassExpression operand=((OWLObjectComplementOf)description).getOperand();
    if (!operand.isAnonymous()) {
      tmp=subHierarchy.getSuperClasses(operand,true);
      for (      OWLClassExpression c : tmp) {
        if (!c.isOWLThing()) {
          refinements.add(df.getOWLObjectComplementOf(c));
        }
      }
    }
  }
 else   if (description instanceof OWLObjectIntersectionOf) {
    List<OWLClassExpression> operands=((OWLObjectIntersectionOf)description).getOperandsAsList();
    for (    OWLClassExpression child : operands) {
      tmp=refine(child,maxLength - OWLClassExpressionUtils.getLength(description) + OWLClassExpressionUtils.getLength(child),null,currDomain);
      for (      OWLClassExpression c : tmp) {
        List<OWLClassExpression> newChildren=new ArrayList<OWLClassExpression>(operands);
        newChildren.add(c);
        newChildren.remove(child);
        Collections.sort(newChildren);
        OWLClassExpression mc=new OWLObjectIntersectionOfImplExt(newChildren);
        mc=ConceptTransformation.cleanConceptNonRecursive(mc);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc);
        if (checkIntersection((OWLObjectIntersectionOf)mc))         refinements.add(mc);
      }
    }
  }
 else   if (description instanceof OWLObjectUnionOf) {
    List<OWLClassExpression> operands=((OWLObjectUnionOf)description).getOperandsAsList();
    for (    OWLClassExpression child : operands) {
      tmp=refine(child,maxLength - OWLClassExpressionUtils.getLength(description) + OWLClassExpressionUtils.getLength(child),null,currDomain);
      for (      OWLClassExpression c : tmp) {
        List<OWLClassExpression> newChildren=new ArrayList<OWLClassExpression>(operands);
        newChildren.remove(child);
        newChildren.add(c);
        Collections.sort(newChildren);
        OWLObjectUnionOf md=new OWLObjectUnionOfImplExt(newChildren);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(md);
        refinements.add(md);
      }
    }
    if (dropDisjuncts) {
      if (operands.size() == 2) {
        refinements.add(operands.get(0));
        refinements.add(operands.get(1));
      }
 else {
        for (int i=0; i < operands.size(); i++) {
          List<OWLClassExpression> newChildren=new LinkedList<OWLClassExpression>(operands);
          newChildren.remove(i);
          OWLObjectUnionOf md=new OWLObjectUnionOfImplExt(newChildren);
          refinements.add(md);
        }
      }
    }
  }
 else   if (description instanceof OWLObjectSomeValuesFrom) {
    OWLObjectPropertyExpression role=((OWLObjectSomeValuesFrom)description).getProperty();
    OWLClassExpression filler=((OWLObjectSomeValuesFrom)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    tmp=refine(filler,maxLength - 2,null,range);
    for (    OWLClassExpression c : tmp) {
      refinements.add(df.getOWLObjectSomeValuesFrom(role,c));
    }
    if (!role.isAnonymous()) {
      Set<OWLObjectProperty> moreSpecialRoles=reasoner.getSubProperties(role.asOWLObjectProperty());
      for (      OWLObjectProperty moreSpecialRole : moreSpecialRoles) {
        refinements.add(df.getOWLObjectSomeValuesFrom(moreSpecialRole,filler));
      }
    }
    if (useCardinalityRestrictions) {
      if (maxLength > OWLClassExpressionUtils.getLength(description) && maxNrOfFillers.get(role) > 1) {
        OWLObjectMinCardinality min=df.getOWLObjectMinCardinality(2,role,filler);
        refinements.add(min);
      }
    }
    if (useHasValueConstructor && filler.isOWLThing()) {
      Set<OWLIndividual> frequentInds=frequentValues.get(role);
      if (frequentInds != null) {
        for (        OWLIndividual ind : frequentInds) {
          OWLObjectHasValue ovr=df.getOWLObjectHasValue(role,ind);
          refinements.add(ovr);
          if (useObjectValueNegation) {
            refinements.add(df.getOWLObjectComplementOf(ovr));
          }
        }
      }
    }
  }
 else   if (description instanceof OWLObjectAllValuesFrom) {
    OWLObjectPropertyExpression role=((OWLObjectAllValuesFrom)description).getProperty();
    OWLClassExpression filler=((OWLObjectAllValuesFrom)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    tmp=refine(filler,maxLength - 2,null,range);
    for (    OWLClassExpression c : tmp) {
      refinements.add(df.getOWLObjectAllValuesFrom(role,c));
    }
    if (!filler.isOWLNothing() && !filler.isAnonymous() && tmp.size() == 0) {
      refinements.add(df.getOWLObjectAllValuesFrom(role,df.getOWLNothing()));
    }
    if (!role.isAnonymous()) {
      Set<OWLObjectProperty> subProperties=reasoner.getSubProperties(role.asOWLObjectProperty());
      for (      OWLObjectProperty subProperty : subProperties) {
        refinements.add(df.getOWLObjectAllValuesFrom(subProperty,filler));
      }
    }
  }
 else   if (description instanceof OWLObjectCardinalityRestriction) {
    OWLObjectPropertyExpression role=((OWLObjectCardinalityRestriction)description).getProperty();
    OWLClassExpression filler=((OWLObjectCardinalityRestriction)description).getFiller();
    OWLClassExpression range=opRanges.get(role);
    int cardinality=((OWLObjectCardinalityRestriction)description).getCardinality();
    if (description instanceof OWLObjectMaxCardinality) {
      if (useNegation || cardinality > 0) {
        tmp=refine(filler,maxLength - 3,null,range);
        for (        OWLClassExpression d : tmp) {
          refinements.add(df.getOWLObjectMaxCardinality(cardinality,role,d));
        }
      }
      if ((useNegation && cardinality > 1) || (!useNegation && cardinality > 2)) {
        refinements.add(df.getOWLObjectMaxCardinality(cardinality - 1,role,filler));
      }
    }
 else     if (description instanceof OWLObjectMinCardinality) {
      tmp=refine(filler,maxLength - 3,null,range);
      for (      OWLClassExpression d : tmp) {
        refinements.add(df.getOWLObjectMinCardinality(cardinality,role,d));
      }
      if (cardinality < maxNrOfFillers.get(role)) {
        refinements.add(df.getOWLObjectMinCardinality(cardinality + 1,role,filler));
      }
    }
  }
 else   if (description instanceof OWLDataSomeValuesFrom) {
    OWLDataPropertyExpression dp=((OWLDataSomeValuesFrom)description).getProperty();
    OWLDataRange dr=((OWLDataSomeValuesFrom)description).getFiller();
    if (dr instanceof OWLDatatypeRestriction) {
      OWLDatatype datatype=((OWLDatatypeRestriction)dr).getDatatype();
      Set<OWLFacetRestriction> facetRestrictions=((OWLDatatypeRestriction)dr).getFacetRestrictions();
      OWLDatatypeRestriction newDatatypeRestriction=null;
      if (datatype.isDouble()) {
        for (        OWLFacetRestriction facetRestriction : facetRestrictions) {
          OWLFacet facet=facetRestriction.getFacet();
          double value=facetRestriction.getFacetValue().parseDouble();
          if (facet == OWLFacet.MAX_INCLUSIVE) {
            int splitIndex=splits.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex - 1;
            if (newSplitIndex >= 0) {
              double newValue=splits.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMaxInclusiveRestriction(newValue);
            }
          }
 else           if (facet == OWLFacet.MIN_INCLUSIVE) {
            int splitIndex=splits.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex + 1;
            if (newSplitIndex < splits.get(dp).size()) {
              double newValue=splits.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMinInclusiveRestriction(newValue);
            }
          }
        }
      }
 else       if (datatype.isInteger()) {
        for (        OWLFacetRestriction facetRestriction : facetRestrictions) {
          OWLFacet facet=facetRestriction.getFacet();
          int value=facetRestriction.getFacetValue().parseInteger();
          if (facet == OWLFacet.MAX_INCLUSIVE) {
            int splitIndex=splitsInt.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex - 1;
            if (newSplitIndex >= 0) {
              int newValue=splitsInt.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMaxInclusiveRestriction(newValue);
            }
          }
 else           if (facet == OWLFacet.MIN_INCLUSIVE) {
            int splitIndex=splitsInt.get(dp).lastIndexOf(value);
            if (splitIndex == -1)             throw new Error("String_Node_Str");
            int newSplitIndex=splitIndex + 1;
            if (newSplitIndex < splitsInt.get(dp).size()) {
              int newValue=splitsInt.get(dp).get(newSplitIndex);
              newDatatypeRestriction=df.getOWLDatatypeMinInclusiveRestriction(newValue);
            }
          }
        }
      }
      if (newDatatypeRestriction != null) {
        refinements.add(df.getOWLDataSomeValuesFrom(dp,newDatatypeRestriction));
      }
    }
  }
 else   if (description instanceof OWLDataHasValue) {
    OWLDataPropertyExpression dp=((OWLDataHasValue)description).getProperty();
    OWLLiteral value=((OWLDataHasValue)description).getValue();
    if (!dp.isAnonymous()) {
      Set<OWLDataProperty> subDPs=reasoner.getSubProperties(dp.asOWLDataProperty());
      for (      OWLDataProperty subDP : subDPs) {
        refinements.add(df.getOWLDataHasValue(subDP,value));
      }
    }
  }
  if (!description.isOWLThing() && !description.isOWLNothing() && !(description instanceof OWLObjectAllValuesFrom && ((OWLObjectAllValuesFrom)description).getFiller().isOWLNothing())) {
    int topRefLength=maxLength - OWLClassExpressionUtils.getLength(description) - 1;
    if (currDomain.isOWLThing()) {
      if (topRefLength > topRefinementsLength)       computeTopRefinements(topRefLength);
    }
 else     if (topRefLength > topARefinementsLength.get(currDomain))     computeTopRefinements(topRefLength,currDomain);
    if (topRefLength > 0) {
      Set<OWLClassExpression> topRefs;
      if (currDomain.isOWLThing())       topRefs=topRefinementsCumulative.get(topRefLength);
 else       topRefs=topARefinementsCumulative.get(currDomain).get(topRefLength);
      for (      OWLClassExpression c : topRefs) {
        boolean skip=false;
        if (applyAllFilter) {
          if (c instanceof OWLObjectAllValuesFrom) {
            if (description instanceof OWLNaryBooleanClassExpression) {
              for (              OWLClassExpression child : ((OWLNaryBooleanClassExpression)description).getOperands()) {
                if (child instanceof OWLObjectAllValuesFrom) {
                  OWLObjectPropertyExpression r1=((OWLObjectAllValuesFrom)c).getProperty();
                  OWLObjectPropertyExpression r2=((OWLObjectAllValuesFrom)child).getProperty();
                  if (r1.equals(r2)) {
                    skip=true;
                    break;
                  }
                }
              }
            }
          }
        }
        if (disjointChecks && !c.isAnonymous() && !description.isAnonymous()&& isDisjoint(description,c)) {
          skip=true;
        }
        if (!skip) {
          List<OWLClassExpression> operands=Lists.newArrayList(description,c);
          Collections.sort(operands);
          OWLObjectIntersectionOf mc=new OWLObjectIntersectionOfImplExt(operands);
          mc=(OWLObjectIntersectionOf)ConceptTransformation.cleanConceptNonRecursive(mc);
          ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc);
          if (checkIntersection(mc))           refinements.add(mc);
        }
      }
    }
  }
  return refinements;
}