Program: 9354
Project: 9354
Buggy source:
private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks,OWLClass nc,boolean equivalence,boolean reuseKnowledgeSource,double threshold) throws ComponentInitException {
  SPARQLReasoner sr=new SPARQLReasoner(ks);
  SortedSet<OWLIndividual> posExamples=sr.getIndividuals(nc,20);
  if (posExamples.isEmpty()) {
    System.out.println("String_Node_Str" + nc.toString() + "String_Node_Str");
    return Collections.emptyList();
  }
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  long startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str");
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint());
  SortedSet<OWLIndividual> negExamples=finder.getNegativeExamples(nc,posExamples,20);
  SortedSetTuple<OWLIndividual> examples=new SortedSetTuple<OWLIndividual>(posExamples,negExamples);
  long runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + negExamples.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  SparqlKnowledgeSource ks2;
  AbstractReasonerComponent rc;
  ks2=new SparqlKnowledgeSource();
  ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet()));
  ks2.setUrl(ks.getEndpoint().getURL());
  ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs()));
  ks2.setUseLits(false);
  ks2.setUseCacheDatabase(true);
  ks2.setCacheDir(cacheDir);
  ks2.setRecursionDepth(2);
  ks2.setCloseAfterRecursion(true);
  ks2.setDissolveBlankNodes(false);
  ks2.setSaveExtractedFragment(true);
  startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str");
  ks2.init();
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + runTime + "String_Node_Str");
  rc=new ClosedWorldReasoner(ks2);
  rc.init();
  ClassLearningProblem lp=new ClassLearningProblem(rc);
  lp.setClassToDescribe(nc);
  lp.setEquivalence(equivalence);
  lp.setHeuristic(HeuristicType.FMEASURE);
  lp.setUseApproximations(false);
  lp.setMaxExecutionTimeInSeconds(10);
  lp.init();
  CELOE la=new CELOE(lp,rc);
  la.setMaxExecutionTimeInSeconds(10);
  la.setNoisePercentage(25);
  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> learnedAxioms=new LinkedList<EvaluatedAxiom>();
  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())));
  }
  return learnedAxioms;
}

Fixed version (ground truth):
private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks,OWLClass nc,boolean equivalence,boolean reuseKnowledgeSource,double threshold) throws ComponentInitException {
  SPARQLReasoner sr=new SPARQLReasoner(ks);
  SortedSet<OWLIndividual> posExamples=sr.getIndividuals(nc,20);
  if (posExamples.isEmpty()) {
    System.out.println("String_Node_Str" + nc.toString() + "String_Node_Str");
    return Collections.emptyList();
  }
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  long startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str");
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint());
  SortedSet<OWLIndividual> negExamples=finder.getNegativeExamples(nc,posExamples,20);
  SortedSetTuple<OWLIndividual> examples=new SortedSetTuple<OWLIndividual>(posExamples,negExamples);
  long runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + negExamples.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  SparqlKnowledgeSource ks2;
  AbstractReasonerComponent rc;
  ks2=new SparqlKnowledgeSource();
  ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet()));
  ks2.setUrl(ks.getEndpoint().getURL());
  ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs()));
  ks2.setUseLits(false);
  ks2.setUseCacheDatabase(true);
  ks2.setCacheDir(cacheDir);
  ks2.setRecursionDepth(2);
  ks2.setCloseAfterRecursion(true);
  ks2.setDissolveBlankNodes(false);
  ks2.setSaveExtractedFragment(true);
  startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str");
  ks2.init();
  runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + runTime + "String_Node_Str");
  rc=new ClosedWorldReasoner(ks2);
  rc.init();
  ClassLearningProblem lp=new ClassLearningProblem(rc);
  lp.setClassToDescribe(nc);
  lp.setEquivalence(equivalence);
  lp.setAccuracyMethod(HeuristicType.FMEASURE);
  lp.setUseApproximations(false);
  lp.setMaxExecutionTimeInSeconds(10);
  lp.init();
  CELOE la=new CELOE(lp,rc);
  la.setMaxExecutionTimeInSeconds(10);
  la.setNoisePercentage(25);
  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> learnedAxioms=new LinkedList<EvaluatedAxiom>();
  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())));
  }
  return learnedAxioms;
}