public EvaluatedDescription asEvaluatedDescription(){ if(description == null){ description = new EvaluatedDescription(getTree().asOWLClassExpression(LiteralNodeConversionStrategy.MIN_MAX), score); } return description; }
/** * @return the query tree as OWL class expression with score */ public EvaluatedDescription<? extends Score> asEvaluatedDescription(){ // lazy generation if(description == null){ description = new EvaluatedDescription(QueryTreeUtils.toOWLClassExpression(getTree()), score); } return description; }
public EvaluatedDescription asEvaluatedDescription(LiteralNodeConversionStrategy strategy){ return new EvaluatedDescription(getTree().asOWLClassExpression(strategy), score); }
combinedSolution = new EvaluatedDescription(unionDescription, score);
EvaluatedDescription evaluatedDescription = new EvaluatedDescription(c, queryTreeScore);
combinedSolution = new EvaluatedDescription(unionDescription, score);
EvaluatedDescription evaluatedDescription = new EvaluatedDescription(c, queryTreeScore);
private Set<EvaluatedDescription> computeDisjointessOfSiblings(OWLClass cls) { Set<EvaluatedDescription> evaluatedDescriptions = new HashSet<>(); //get number of instances of A int instanceCountA = reasoner.getPopularity(cls); if (instanceCountA > 0) { //we compute the disjointness to all sibling classes Set<OWLClass> siblingClasses = reasoner.getSiblingClasses(cls); for (OWLClass sib : siblingClasses) { //get number of instances of B int instanceCountB = reasoner.getPopularity(sib); if (instanceCountB > 0) { //get number of instances of (A and B) int instanceCountAB = reasoner.getPopularityOf(df.getOWLObjectIntersectionOf(cls, sib)); // compute the estimated precision double precision = Heuristics.getConfidenceInterval95WaldAverage(instanceCountB, instanceCountAB); // compute the estimated recall double recall = Heuristics.getConfidenceInterval95WaldAverage(instanceCountA, instanceCountAB); // compute the final score double score = 1 - Heuristics.getFScore(recall, precision); EvaluatedDescription evalDesc = new EvaluatedDescription(sib, new AxiomScore(score)); evaluatedDescriptions.add(evalDesc); } } } return evaluatedDescriptions; }
evalDesc = new EvaluatedDescription(cls, new AxiomScore(score)); } else { evalDesc = new EvaluatedDescription(cls, new AxiomScore(1)); evalDesc = new EvaluatedDescription(cls, new AxiomScore(score)); } else { evalDesc = new EvaluatedDescription(cls, new AxiomScore(1));
private void runBatched() { ParameterizedSparqlString template = strictOWLMode ? CLASS_OVERLAP_BATCH_QUERY_STRICT_OWL : CLASS_OVERLAP_BATCH_QUERY; template.setIri("cls", entityToDescribe.toStringID()); ResultSet rs = executeSelectQuery(template.toString()); while (rs.hasNext()) { QuerySolution qs = rs.next(); RDFNode cls = qs.get("cls_other"); if (!cls.isAnon()) { OWLClass sup = OwlApiJenaUtils.asOWLEntity(cls.asNode(), EntityType.CLASS); int overlap = qs.get("cnt").asLiteral().getInt(); if (!sup.isOWLThing() && !entityToDescribe.equals(sup)) {//omit owl:Thing and the class to describe itself currentlyBestEvaluatedDescriptions.add(new EvaluatedDescription(sup, computeScore(popularity, overlap))); } } else { logger.warn("Ignoring anonymous super class candidate: " + cls); } } }
private void runIterative() { CLASS_OVERLAP_QUERY.setIri("cls", entityToDescribe.toStringID()); // get the candidates SortedSet<OWLClass> candidates = getCandidates(); // check for each candidate if an overlap exist int i = 1; for (OWLClass cls : candidates) { progressMonitor.learningProgressChanged(axiomType, i++, candidates.size()); // get the popularity of the candidate int candidatePopularity = reasoner.getPopularity(cls); if(candidatePopularity == 0){// skip empty classes logger.debug("Cannot compute subclass statements for empty candidate class " + cls); continue; } // get the number of instances that belong to both classes CLASS_OVERLAP_QUERY.setIri("cls_other", cls.toStringID()); ResultSet rs = executeSelectQuery(CLASS_OVERLAP_QUERY.toString()); int overlap = rs.next().getLiteral("cnt").getInt(); // compute the score AxiomScore score = computeScore(popularity, overlap); currentlyBestEvaluatedDescriptions.add(new EvaluatedDescription(cls, new ScoreSimple(score.getAccuracy()))); } }
EvaluatedDescription<Score> ed = new EvaluatedDescription<>(classExpression, score); bestEvaluatedDescriptions.add(ed);