From a22412f04e606d60669c4297cc0c4c2e46369049 Mon Sep 17 00:00:00 2001 From: Dennis Schiese Date: Tue, 25 Jun 2024 14:49:39 +0200 Subject: [PATCH] Fixed qanaryMesssage null when first approach fails --- qanary-component-QB-BirthDataWikidata/pom.xml | 2 +- .../wikidata/BirthDataQueryBuilder.java | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/qanary-component-QB-BirthDataWikidata/pom.xml b/qanary-component-QB-BirthDataWikidata/pom.xml index 11d85234..9cc622ee 100644 --- a/qanary-component-QB-BirthDataWikidata/pom.xml +++ b/qanary-component-QB-BirthDataWikidata/pom.xml @@ -5,7 +5,7 @@ 4.0.0 eu.wdaqua.qanary.component qanary-component-QB-BirthDataWikidata - 3.4.2 + 3.4.3 eu.wdaqua.qanary qa.qanarycomponent-parent diff --git a/qanary-component-QB-BirthDataWikidata/src/main/java/eu/wdaqua/component/qb/birthdata/wikidata/BirthDataQueryBuilder.java b/qanary-component-QB-BirthDataWikidata/src/main/java/eu/wdaqua/component/qb/birthdata/wikidata/BirthDataQueryBuilder.java index d620ea86..876b19f3 100644 --- a/qanary-component-QB-BirthDataWikidata/src/main/java/eu/wdaqua/component/qb/birthdata/wikidata/BirthDataQueryBuilder.java +++ b/qanary-component-QB-BirthDataWikidata/src/main/java/eu/wdaqua/component/qb/birthdata/wikidata/BirthDataQueryBuilder.java @@ -142,21 +142,21 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception { this.myQuestion = myQanaryQuestion.getTextualRepresentation(); // get the question as String // STEP 1-3 have two options - + QanaryMessage qanaryMessageNew = myQanaryMessage; // first, try to use a named entity annotation because it is more precise if it // works, then stop - myQanaryMessage = this.processForExistingNamedEntity(myQanaryMessage); - if (myQanaryMessage != null) { + qanaryMessageNew = this.processForExistingNamedEntity(myQanaryMessage); + if (qanaryMessageNew != null) { logger.info("Found a named entity annotation. Processing finished."); - return myQanaryMessage; + return qanaryMessageNew; } - // second, let's try to find a firstname and lastname, if that works we stop - myQanaryMessage = this.processForFirstNameAndLastName(myQanaryMessage); - if( myQanaryMessage != null ) { - logger.info("Found firstname and lastname. Processing finished."); - return myQanaryMessage; - } + // second, let's try to find a firstname and lastname, if that works we stop + qanaryMessageNew = this.processForFirstNameAndLastName(myQanaryMessage); + if( qanaryMessageNew != null ) { + logger.info("Found firstname and lastname. Processing finished."); + return qanaryMessageNew; + } logger.warn("Nothing could be done here."); return myQanaryMessage;