Program: 9334
Project: 9334
Buggy source:
private List<EvaluatedAxiom<OWLAxiom>> applyCELOE(SparqlEndpointKS ks,OWLClass nc,boolean equivalence,boolean reuseKnowledgeSource) throws ComponentInitException {
  System.out.print("String_Node_Str");
  long startTime=System.currentTimeMillis();
  SortedSet<OWLIndividual> posExamples=reasoner.getIndividuals(nc,maxNrOfPositiveExamples);
  long runTime=System.currentTimeMillis() - startTime;
  if (posExamples.isEmpty()) {
    System.out.println("String_Node_Str" + nc.toString() + "String_Node_Str");
    return Collections.emptyList();
  }
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  System.out.println("String_Node_Str" + posExStr.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  System.out.print("String_Node_Str");
  startTime=System.currentTimeMillis();
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint(),reasoner);
  SortedSet<OWLIndividual> negExamples=finder.getNegativeExamples(nc,posExamples,maxNrOfNegativeExamples);
  SortedSetTuple<OWLIndividual> examples=new SortedSetTuple<>(posExamples,negExamples);
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + negExamples.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  AbstractReasonerComponent rc;
  KnowledgeSource ksFragment;
  if (reuseKnowledgeSource) {
    ksFragment=ksCached;
    rc=rcCached;
  }
 else {
    System.out.print("String_Node_Str");
    startTime=System.currentTimeMillis();
    Model model;
    if (ks.isRemote()) {
      model=getFragment(ks,Sets.union(posExamples,negExamples));
    }
 else {
      model=((LocalModelBasedSparqlEndpointKS)ks).getModel();
    }
    filter(model);
    filterByNamespaces(model);
    OWLEntityTypeAdder.addEntityTypes(model);
    runTime=System.currentTimeMillis() - startTime;
    System.out.println("String_Node_Str" + model.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
    OWLOntology ontology=asOWLOntology(model);
    if (reasoner.getClassHierarchy() != null) {
      ontology.getOWLOntologyManager().addAxioms(ontology,reasoner.getClassHierarchy().toOWLAxioms());
    }
    ksFragment=new OWLAPIOntology(ontology);
    try {
      OWLManager.createOWLOntologyManager().saveOntology(ontology,new TurtleDocumentFormat(),new FileOutputStream("String_Node_Str"));
    }
 catch (    OWLOntologyStorageException|FileNotFoundException e) {
      e.printStackTrace();
    }
    System.out.println("String_Node_Str");
    rc=new ClosedWorldReasoner(ksFragment);
    rc.init();
    System.out.println("String_Node_Str");
    ksCached=ksFragment;
    rcCached=rc;
  }
  ClassLearningProblem lp=new ClassLearningProblem(rc);
  lp.setClassToDescribe(nc);
  lp.setEquivalence(equivalence);
  lp.setAccuracyMethod(new AccMethodFMeasure(true));
  lp.setMaxExecutionTimeInSeconds(10);
  lp.init();
  CELOE la=new CELOE(lp,rc);
  la.setMaxExecutionTimeInSeconds(10);
  la.setNoisePercentage(25);
  la.setMaxNrOfResults(100);
  la.init();
  startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str" + (equivalence ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  la.start();
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + runTime + "String_Node_Str");
  List<? extends EvaluatedDescription<? extends Score>> learnedDescriptions=la.getCurrentlyBestEvaluatedDescriptions(threshold);
  List<EvaluatedAxiom<OWLAxiom>> learnedAxioms=new LinkedList<>();
  for (  EvaluatedDescription<? extends Score> learnedDescription : learnedDescriptions) {
    OWLAxiom axiom;
    if (equivalence) {
      axiom=dataFactory.getOWLEquivalentClassesAxiom(nc,learnedDescription.getDescription());
    }
 else {
      axiom=dataFactory.getOWLSubClassOfAxiom(nc,learnedDescription.getDescription());
    }
    Score score=lp.computeScore(learnedDescription.getDescription());
    learnedAxioms.add(new EvaluatedAxiom<>(axiom,new AxiomScore(score.getAccuracy())));
  }
  System.out.println(prettyPrint(learnedAxioms));
  learnedEvaluatedAxioms.addAll(learnedAxioms);
  algorithmRuns.add(new AlgorithmRun(CELOE.class,learnedAxioms,ConfigHelper.getConfigOptionValues(la)));
  return learnedAxioms;
}

Fixed version (ground truth):
private List<EvaluatedAxiom<OWLAxiom>> applyCELOE(SparqlEndpointKS ks,OWLClass nc,boolean equivalence,boolean reuseKnowledgeSource) throws ComponentInitException {
  System.out.print("String_Node_Str");
  long startTime=System.currentTimeMillis();
  SortedSet<OWLIndividual> posExamples=reasoner.getIndividuals(nc,maxNrOfPositiveExamples);
  long runTime=System.currentTimeMillis() - startTime;
  if (posExamples.isEmpty()) {
    System.out.println("String_Node_Str" + nc.toString() + "String_Node_Str");
    return Collections.emptyList();
  }
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  System.out.println("String_Node_Str" + posExStr.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  System.out.print("String_Node_Str");
  startTime=System.currentTimeMillis();
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(reasoner);
  SortedSet<OWLIndividual> negExamples=finder.getNegativeExamples(nc,posExamples,maxNrOfNegativeExamples);
  SortedSetTuple<OWLIndividual> examples=new SortedSetTuple<>(posExamples,negExamples);
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + negExamples.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  AbstractReasonerComponent rc;
  KnowledgeSource ksFragment;
  if (reuseKnowledgeSource) {
    ksFragment=ksCached;
    rc=rcCached;
  }
 else {
    System.out.print("String_Node_Str");
    startTime=System.currentTimeMillis();
    Model model;
    if (ks.isRemote()) {
      model=getFragment(ks,Sets.union(posExamples,negExamples));
    }
 else {
      model=((LocalModelBasedSparqlEndpointKS)ks).getModel();
    }
    filter(model);
    filterByNamespaces(model);
    OWLEntityTypeAdder.addEntityTypes(model);
    runTime=System.currentTimeMillis() - startTime;
    System.out.println("String_Node_Str" + model.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
    OWLOntology ontology=asOWLOntology(model);
    if (reasoner.getClassHierarchy() != null) {
      ontology.getOWLOntologyManager().addAxioms(ontology,reasoner.getClassHierarchy().toOWLAxioms());
    }
    ksFragment=new OWLAPIOntology(ontology);
    try {
      OWLManager.createOWLOntologyManager().saveOntology(ontology,new TurtleDocumentFormat(),new FileOutputStream("String_Node_Str"));
    }
 catch (    OWLOntologyStorageException|FileNotFoundException e) {
      e.printStackTrace();
    }
    System.out.println("String_Node_Str");
    rc=new ClosedWorldReasoner(ksFragment);
    rc.init();
    System.out.println("String_Node_Str");
    ksCached=ksFragment;
    rcCached=rc;
  }
  ClassLearningProblem lp=new ClassLearningProblem(rc);
  lp.setClassToDescribe(nc);
  lp.setEquivalence(equivalence);
  lp.setAccuracyMethod(new AccMethodFMeasure(true));
  lp.setMaxExecutionTimeInSeconds(10);
  lp.init();
  CELOE la=new CELOE(lp,rc);
  la.setMaxExecutionTimeInSeconds(10);
  la.setNoisePercentage(25);
  la.setMaxNrOfResults(100);
  la.init();
  startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str" + (equivalence ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  la.start();
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + runTime + "String_Node_Str");
  List<? extends EvaluatedDescription<? extends Score>> learnedDescriptions=la.getCurrentlyBestEvaluatedDescriptions(threshold);
  List<EvaluatedAxiom<OWLAxiom>> learnedAxioms=new LinkedList<>();
  for (  EvaluatedDescription<? extends Score> learnedDescription : learnedDescriptions) {
    OWLAxiom axiom;
    if (equivalence) {
      axiom=dataFactory.getOWLEquivalentClassesAxiom(nc,learnedDescription.getDescription());
    }
 else {
      axiom=dataFactory.getOWLSubClassOfAxiom(nc,learnedDescription.getDescription());
    }
    Score score=lp.computeScore(learnedDescription.getDescription());
    learnedAxioms.add(new EvaluatedAxiom<>(axiom,new AxiomScore(score.getAccuracy())));
  }
  System.out.println(prettyPrint(learnedAxioms));
  learnedEvaluatedAxioms.addAll(learnedAxioms);
  algorithmRuns.add(new AlgorithmRun(CELOE.class,learnedAxioms,ConfigHelper.getConfigOptionValues(la)));
  return learnedAxioms;
}