From 3e6ef41cc4b969f5fa076c6dda73e6944a6b5d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20R=C3=B6der?= Date: Sun, 29 Sep 2024 17:20:40 +0200 Subject: [PATCH] Fixed a problem in the sanity check of counts. --- src/main/java/org/dice_research/cel/PruneCEL.java | 3 ++- .../cel/refine/SuggestorBasedRefinementOperator.java | 2 +- .../cel/refine/suggest/sparql/SparqlBasedSuggestor.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/dice_research/cel/PruneCEL.java b/src/main/java/org/dice_research/cel/PruneCEL.java index 5e86257..f3bba41 100644 --- a/src/main/java/org/dice_research/cel/PruneCEL.java +++ b/src/main/java/org/dice_research/cel/PruneCEL.java @@ -279,7 +279,8 @@ public static void main(String[] args) throws Exception { // XXX Choose the learning problem (as JSON file) JSONLearningProblemReader reader = new JSONLearningProblemReader(); // Collection problems = reader.readProblems("LPs/Family/lps.json"); - Collection problems = reader.readProblems("/home/micha/Downloads/TandF_MST5_reverse.json"); + //Collection problems = reader.readProblems("/home/micha/Downloads/TandF_MST5_reverse.json"); + Collection problems = reader.readProblems("/home/micha/Downloads/TandF_MST5.json"); // Collection problems = // reader.readProblems("LPs/QA/TandF_MST5_reverse.json"); diff --git a/src/main/java/org/dice_research/cel/refine/SuggestorBasedRefinementOperator.java b/src/main/java/org/dice_research/cel/refine/SuggestorBasedRefinementOperator.java index c3d4320..4d946e1 100644 --- a/src/main/java/org/dice_research/cel/refine/SuggestorBasedRefinementOperator.java +++ b/src/main/java/org/dice_research/cel/refine/SuggestorBasedRefinementOperator.java @@ -197,7 +197,7 @@ protected void addResult(ScoredIRI suggestion, ClassExpression newNode, boolean protected void addResult(ClassExpression newExpression, SelectionScores scores, boolean addedEdge) { // Check results for sanity if ((scores.getPosCount() < 0) || (scores.getPosCount() > numberOfPositives) || (scores.getNegCount() < 0) - || (scores.getPosCount() > numberOfNegatives)) { + || (scores.getNegCount() > numberOfNegatives)) { LOGGER.error("Got wrong counts: #positives={}, #negatives={}, expression={}, scores={}", numberOfPositives, numberOfNegatives, newExpression, scores); } diff --git a/src/main/java/org/dice_research/cel/refine/suggest/sparql/SparqlBasedSuggestor.java b/src/main/java/org/dice_research/cel/refine/suggest/sparql/SparqlBasedSuggestor.java index 9f78a61..72b7efb 100644 --- a/src/main/java/org/dice_research/cel/refine/suggest/sparql/SparqlBasedSuggestor.java +++ b/src/main/java/org/dice_research/cel/refine/suggest/sparql/SparqlBasedSuggestor.java @@ -79,7 +79,7 @@ protected Collection performQuery(SuggestionData data, Collection faultyResult = scoredIris.stream().filter( - s -> s.posCount < 0 || s.posCount > data.maxPos || s.negCount < 0 || s.posCount > data.maxNeg) + s -> s.posCount < 0 || s.posCount > data.maxPos || s.negCount < 0 || s.negCount > data.maxNeg) .findFirst(); if (faultyResult.isPresent()) { LOGGER.error("Got a faulty count: #positives={}, #negatives={}, scoredIRI={}", data.maxPos, data.maxNeg,