From 34bb4f4c3b87a9e66e501e2a73c79182ae2a613f Mon Sep 17 00:00:00 2001 From: anbo-de Date: Thu, 21 Dec 2023 12:27:30 +0100 Subject: [PATCH] QB-BirthDataWikidata v3.3.7: filter Wikidata res * now, only Wikidata resources are accepted for being used in the query builder --- qanary-component-QB-BirthDataWikidata/pom.xml | 2 +- .../qb/birthdata/wikidata/BirthDataQueryBuilder.java | 2 +- .../resources/queries/getAnnotationFilteredOnlyWikidata.rq | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qanary-component-QB-BirthDataWikidata/pom.xml b/qanary-component-QB-BirthDataWikidata/pom.xml index 489bde3b4..19ae378db 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.3.6 + 3.3.7 org.springframework.boot 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 d8ff7657e..6a7aaf06f 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 @@ -41,7 +41,7 @@ public class BirthDataQueryBuilder extends QanaryComponent { private static final Logger logger = LoggerFactory.getLogger(BirthDataQueryBuilder.class); private static final String FILENAME_ANNOTATIONS = "/queries/getAnnotation.rq"; - private static final String FILENAME_ANNOTATIONS_FILTERED = "/queries/getAnnotationFiltered.rq"; + private static final String FILENAME_ANNOTATIONS_FILTERED = "/queries/getAnnotationFilteredOnlyWikidata.rq"; private static final String FILENAME_WIKIDATA_BIRTHDATA_QUERY_PERSON = "/queries/getQuestionAnswerFromWikidataByPerson.rq"; private static final String FILENAME_WIKIDATA_BIRTHDATA_QUERY_FIRST_AND_LASTNAME = "/queries/getQuestionAnswerFromWikidataByFirstnameLastname.rq"; diff --git a/qanary-component-QB-BirthDataWikidata/src/main/resources/queries/getAnnotationFilteredOnlyWikidata.rq b/qanary-component-QB-BirthDataWikidata/src/main/resources/queries/getAnnotationFilteredOnlyWikidata.rq index 69cbd0957..25a95bee2 100644 --- a/qanary-component-QB-BirthDataWikidata/src/main/resources/queries/getAnnotationFilteredOnlyWikidata.rq +++ b/qanary-component-QB-BirthDataWikidata/src/main/resources/queries/getAnnotationFilteredOnlyWikidata.rq @@ -7,10 +7,12 @@ SELECT * FROM ?graph WHERE { ?annotation oa:hasBody ?wikidataResource . + # accept only Wikidata resources as it is a Wikidata Query Builder component + FILTER( REGEX(?wikidataResource, "^http://www.wikidata.org/entity/", "i")) ?annotation qa:score ?annotationScore . ?annotation oa:hasTarget ?target . - ?target oa:hasSource ?source . - ?target oa:hasSelector ?textSelector . + ?target oa:hasSource ?source . + ?target oa:hasSelector ?textSelector . ?textSelector rdf:type oa:TextPositionSelector . ?textSelector oa:start ?start . ?textSelector oa:end ?end .