Program: 9615
Project: 9615
Buggy source:
private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks,NamedClass nc,boolean equivalence) throws ComponentInitException {
  SPARQLReasoner sr=new SPARQLReasoner(ks);
  SortedSet<Individual> posExamples=sr.getIndividuals(nc,20);
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  System.out.print("String_Node_Str");
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint());
  SortedSet<String> negExStr=finder.getNegativeExamples(nc.getName(),posExStr);
  negExStr=SetManipulation.fuzzyShrink(negExStr,20);
  SortedSet<Individual> negExamples=Helper.getIndividualSet(negExStr);
  SortedSetTuple<Individual> examples=new SortedSetTuple<Individual>(posExamples,negExamples);
  System.out.println("String_Node_Str" + negExStr.size() + "String_Node_Str");
  SparqlKnowledgeSource 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.setRecursionDepth(2);
  ks2.setCloseAfterRecursion(true);
  System.out.println("String_Node_Str");
  ks2.init();
  System.out.println("String_Node_Str");
  AbstractReasonerComponent rc=new FastInstanceChecker(ks2);
  rc.init();
  ClassLearningProblem lp=new ClassLearningProblem(rc);
  lp.setClassToDescribe(nc);
  lp.setEquivalence(true);
  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();
  System.out.print("String_Node_Str" + (equivalence ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  la.start();
  System.out.println("String_Node_Str");
  List<? extends EvaluatedDescription> learnedDescriptions=la.getCurrentlyBestEvaluatedDescriptions(threshold);
  List<EvaluatedAxiom> learnedAxioms=new LinkedList<EvaluatedAxiom>();
  for (  EvaluatedDescription learnedDescription : learnedDescriptions) {
    Axiom axiom;
    if (equivalence) {
      axiom=new EquivalentClassesAxiom(nc,learnedDescription.getDescription());
    }
 else {
      axiom=new SubClassAxiom(nc,learnedDescription.getDescription());
    }
    Score score=lp.computeScore(learnedDescription.getDescription());
    learnedAxioms.add(new EvaluatedAxiom(axiom,score));
  }
  System.out.println(prettyPrint(learnedAxioms));
  algorithmRuns.add(new AlgorithmRun(CELOE.class,learnedAxioms,ConfigHelper.getConfigOptionValuesString(la)));
  return learnedAxioms;
}

Fixed version (ground truth):
private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks,NamedClass nc,boolean equivalence,boolean reuseKnowledgeSource) throws ComponentInitException {
  SPARQLReasoner sr=new SPARQLReasoner(ks);
  SortedSet<Individual> posExamples=sr.getIndividuals(nc,20);
  SortedSet<String> posExStr=Helper.getStringSet(posExamples);
  long startTime=System.currentTimeMillis();
  System.out.print("String_Node_Str");
  AutomaticNegativeExampleFinderSPARQL2 finder=new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint());
  SortedSet<String> negExStr=finder.getNegativeExamples(nc.getName(),posExStr);
  negExStr=SetManipulation.fuzzyShrink(negExStr,20);
  SortedSet<Individual> negExamples=Helper.getIndividualSet(negExStr);
  SortedSetTuple<Individual> examples=new SortedSetTuple<Individual>(posExamples,negExamples);
  long runTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + negExStr.size() + "String_Node_Str"+ runTime+ "String_Node_Str");
  SparqlKnowledgeSource ks2;
  AbstractReasonerComponent rc;
  if (reuseKnowledgeSource) {
    ks2=ksCached;
    rc=rcCached;
    System.out.println("String_Node_Str");
  }
 else {
    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.setRecursionDepth(2);
    ks2.setCloseAfterRecursion(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 FastInstanceChecker(ks2);
    rc.init();
    ksCached=ks2;
    rcCached=rc;
  }
  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> learnedDescriptions=la.getCurrentlyBestEvaluatedDescriptions(threshold);
  List<EvaluatedAxiom> learnedAxioms=new LinkedList<EvaluatedAxiom>();
  for (  EvaluatedDescription learnedDescription : learnedDescriptions) {
    Axiom axiom;
    if (equivalence) {
      axiom=new EquivalentClassesAxiom(nc,learnedDescription.getDescription());
    }
 else {
      axiom=new SubClassAxiom(nc,learnedDescription.getDescription());
    }
    Score score=lp.computeScore(learnedDescription.getDescription());
    learnedAxioms.add(new EvaluatedAxiom(axiom,score));
  }
  System.out.println(prettyPrint(learnedAxioms));
  algorithmRuns.add(new AlgorithmRun(CELOE.class,learnedAxioms,ConfigHelper.getConfigOptionValuesString(la)));
  return learnedAxioms;
}