Program: 9349
Project: 9349
Buggy source:
protected RDFResourceTree computeLGG(RDFResourceTree tree1,RDFResourceTree tree2,boolean learnFilters){
  subCalls++;
  if ((tree1.isResourceNode() || tree1.isLiteralValueNode()) && tree1.getData().equals(tree2.getData())) {
    logger.trace("String_Node_Str",tree1,tree2);
    return tree1;
  }
  if (tree1.isLiteralNode() && tree2.isLiteralNode()) {
    RDFDatatype d1=tree1.getData().getLiteralDatatype();
    RDFDatatype d2=tree2.getData().getLiteralDatatype();
    if (d1 != null && d1.equals(d2)) {
      return new RDFResourceTree(d1);
    }
  }
  RDFResourceTree lgg=new RDFResourceTree();
  Multimap<Node,Node> relatedEdges=getRelatedEdges(tree1,tree2);
  for (  Entry<Node,Collection<Node>> entry : relatedEdges.asMap().entrySet()) {
    Node edge1=entry.getKey();
    Collection<Node> edges2=entry.getValue();
    Set<RDFResourceTree> addedChildren=new HashSet<>();
    for (    RDFResourceTree child1 : tree1.getChildren(edge1)) {
      for (      Node edge2 : edges2) {
        for (        RDFResourceTree child2 : tree2.getChildren(edge2)) {
          RDFResourceTree lggChild=computeLGG(child1,child2,learnFilters);
          Node moreGeneralEdge;
          if (reasoner.isSubPropertyOf(OwlApiJenaUtils.asOWLEntity(edge1,EntityType.OBJECT_PROPERTY),OwlApiJenaUtils.asOWLEntity(edge2,EntityType.OBJECT_PROPERTY))) {
            moreGeneralEdge=edge2;
          }
 else {
            moreGeneralEdge=edge1;
          }
          boolean add=true;
          for (Iterator<RDFResourceTree> it=addedChildren.iterator(); it.hasNext(); ) {
            RDFResourceTree addedChild=it.next();
            if (QueryTreeUtils.isSubsumedBy(addedChild,lggChild,reasoner,edge1.equals(RDF.type.asNode()))) {
              add=false;
              break;
            }
 else             if (QueryTreeUtils.isSubsumedBy(lggChild,addedChild,reasoner,edge1.equals(RDF.type.asNode()))) {
              lgg.removeChild(addedChild,moreGeneralEdge);
              it.remove();
            }
          }
          if (add) {
            Node edge;
            if (reasoner.isSubPropertyOf(OwlApiJenaUtils.asOWLEntity(edge1,EntityType.OBJECT_PROPERTY),OwlApiJenaUtils.asOWLEntity(edge2,EntityType.OBJECT_PROPERTY))) {
              edge=edge2;
            }
 else {
              edge=edge1;
            }
            lgg.addChild(lggChild,edge);
            addedChildren.add(lggChild);
          }
        }
      }
    }
  }
  return lgg;
}

Fixed version (ground truth):
protected RDFResourceTree computeLGG(RDFResourceTree tree1,RDFResourceTree tree2,boolean learnFilters){
  subCalls++;
  if ((tree1.isResourceNode() || tree1.isLiteralValueNode()) && tree1.getData().equals(tree2.getData())) {
    logger.trace("String_Node_Str",tree1,tree2);
    return tree1;
  }
  if (tree1.isLiteralNode() && tree2.isLiteralNode()) {
    RDFDatatype d1=tree1.getData().getLiteralDatatype();
    RDFDatatype d2=tree2.getData().getLiteralDatatype();
    if (d1 != null && d1.equals(d2)) {
      return new RDFResourceTree(d1);
    }
  }
  RDFResourceTree lgg=new RDFResourceTree();
  Multimap<Node,Node> relatedEdges=getRelatedEdges(tree1,tree2);
  for (  Entry<Node,Collection<Node>> entry : relatedEdges.asMap().entrySet()) {
    Node edge1=entry.getKey();
    Collection<Node> edges2=entry.getValue();
    Set<RDFResourceTree> addedChildren=new HashSet<>();
    for (    RDFResourceTree child1 : tree1.getChildren(edge1)) {
      for (      Node edge2 : edges2) {
        for (        RDFResourceTree child2 : tree2.getChildren(edge2)) {
          RDFResourceTree lggChild=computeLGG(child1,child2,learnFilters);
          Node moreGeneralEdge;
          if (reasoner.isSubPropertyOf(OwlApiJenaUtils.asOWLEntity(edge1,EntityType.OBJECT_PROPERTY),OwlApiJenaUtils.asOWLEntity(edge2,EntityType.OBJECT_PROPERTY))) {
            moreGeneralEdge=edge2;
          }
 else {
            moreGeneralEdge=edge1;
          }
          boolean add=true;
          for (Iterator<RDFResourceTree> it=addedChildren.iterator(); it.hasNext(); ) {
            RDFResourceTree addedChild=it.next();
            if (QueryTreeUtils.isSubsumedBy(addedChild,lggChild,reasoner,edge1.equals(RDF.type.asNode()))) {
              add=false;
              break;
            }
 else             if (QueryTreeUtils.isSubsumedBy(lggChild,addedChild,reasoner,edge1.equals(RDF.type.asNode()))) {
              lgg.removeChild(addedChild,lgg.getEdgeToChild(addedChild));
              it.remove();
            }
          }
          if (add) {
            Node edge;
            if (reasoner.isSubPropertyOf(OwlApiJenaUtils.asOWLEntity(edge1,EntityType.OBJECT_PROPERTY),OwlApiJenaUtils.asOWLEntity(edge2,EntityType.OBJECT_PROPERTY))) {
              edge=edge2;
            }
 else {
              edge=edge1;
            }
            lgg.addChild(lggChild,edge);
            addedChildren.add(lggChild);
          }
        }
      }
    }
  }
  return lgg;
}