From f8befe9fbfedf7afbaceb97dbf5ddfe6aa05d634 Mon Sep 17 00:00:00 2001 From: "J. Allen Baron" Date: Thu, 1 Feb 2024 10:01:30 -0500 Subject: [PATCH 1/4] Update duplicate_exact_synonym report query - Excludes abbreviation (OMO:0003000) and acronym (OMO:0003012) synonym type from this test - Ignores case when comparing synonyms --- .../report_queries/duplicate_exact_synonym.rq | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq b/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq index 6f1f438bb..6da0642aa 100644 --- a/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq +++ b/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq @@ -1,25 +1,38 @@ # # Duplicate Exact Synonym # -# **Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities. +# **Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities and synonyms annotated as abbreviation or acronym. # -# **Solution:** Avoid ambiguity by assigning unique exact synonyms or changing the exact synonym to a different annotation (e.g. broad synonym). +# **Solution:** Avoid ambiguity by assigning unique exact synonyms, changing the exact synonym to a different annotation (e.g. broad synonym), or annotating it as an abbreviation or acronym. PREFIX obo: PREFIX oboInOwl: PREFIX owl: PREFIX rdfs: -SELECT DISTINCT ?entity ?property ?value WHERE { - VALUES ?property { - obo:IAO_0000118 - oboInOwl:hasExactSynonym +SELECT DISTINCT ?entity ?property ?value +WHERE { + { + SELECT DISTINCT ?syn_std ?property (COUNT(DISTINCT ?entity) AS ?cnt) + WHERE { + VALUES ?property { obo:IAO_0000118 oboInOwl:hasExactSynonym } + ?entity ?property ?syn . + OPTIONAL { + VALUES ?syn_type { obo:OMO_0003000 obo:OMO_0003012 } + ?exclude a owl:Axiom ; + owl:annotatedSource ?entity ; + owl:annotatedProperty ?property ; + owl:annotatedTarget ?syn ; + oboInOwl:hasSynonymType ?syn_type . + } + + BIND(UCASE(?syn) AS ?syn_std) + FILTER (!isBlank(?entity) && !BOUND(?exclude)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + } GROUP BY ?syn_std ?property HAVING (?cnt > 1) } - ?entity ?property ?value. - ?entity2 ?property ?value . - FILTER NOT EXISTS { ?entity owl:deprecated true } - FILTER NOT EXISTS { ?entity2 owl:deprecated true } - FILTER (?entity != ?entity2) + ?entity ?property ?value . FILTER (!isBlank(?entity)) - FILTER (!isBlank(?entity2)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + FILTER (UCASE(?value) = ?syn_std) } -ORDER BY DESC(UCASE(str(?value))) +ORDER BY DESC(UCASE(str(?value))) \ No newline at end of file From aaf1706646756479f250a6c869600d6db62227b9 Mon Sep 17 00:00:00 2001 From: "J. Allen Baron" Date: Thu, 1 Feb 2024 10:37:59 -0500 Subject: [PATCH 2/4] Note duplicate_exact_synonym is case-insensitive --- .../main/resources/report_queries/duplicate_exact_synonym.rq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq b/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq index 6da0642aa..319725b71 100644 --- a/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq +++ b/robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq @@ -1,6 +1,6 @@ # # Duplicate Exact Synonym # -# **Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities and synonyms annotated as abbreviation or acronym. +# **Problem:** Two entities share an exact synonym (case-insensitive). This causes ambiguity. Excludes deprecated entities and synonyms annotated as abbreviation or acronym. # # **Solution:** Avoid ambiguity by assigning unique exact synonyms, changing the exact synonym to a different annotation (e.g. broad synonym), or annotating it as an abbreviation or acronym. From 316d3606c632f7df2bcdb26c1d9de0895e1d9de6 Mon Sep 17 00:00:00 2001 From: "J. Allen Baron" Date: Thu, 1 Feb 2024 10:45:36 -0500 Subject: [PATCH 3/4] Update docs/report_queries/duplicate_exact_synonym.md --- .../report_queries/duplicate_exact_synonym.md | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/docs/report_queries/duplicate_exact_synonym.md b/docs/report_queries/duplicate_exact_synonym.md index d30bc53fa..86263e070 100644 --- a/docs/report_queries/duplicate_exact_synonym.md +++ b/docs/report_queries/duplicate_exact_synonym.md @@ -1,8 +1,8 @@ # Duplicate Exact Synonym -**Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities. +**Problem:** Two entities share an exact synonym (case-insensitive). This causes ambiguity. Excludes deprecated entities and synonyms annotated as abbreviation or acronym. -**Solution:** Avoid ambiguity by assigning unique exact synonyms or changing the exact synonym to a different annotation (e.g. broad synonym). +**Solution:** Avoid ambiguity by assigning unique exact synonyms, changing the exact synonym to a different annotation (e.g. broad synonym), or annotating it as an abbreviation or acronym. ```sparql PREFIX obo: @@ -10,18 +10,31 @@ PREFIX oboInOwl: PREFIX owl: PREFIX rdfs: -SELECT DISTINCT ?entity ?property ?value WHERE { - VALUES ?property { - obo:IAO_0000118 - oboInOwl:hasExactSynonym +SELECT DISTINCT ?entity ?property ?value +WHERE { + { + SELECT DISTINCT ?syn_std ?property (COUNT(DISTINCT ?entity) AS ?cnt) + WHERE { + VALUES ?property { obo:IAO_0000118 oboInOwl:hasExactSynonym } + ?entity ?property ?syn . + OPTIONAL { + VALUES ?syn_type { obo:OMO_0003000 obo:OMO_0003012 } + ?exclude a owl:Axiom ; + owl:annotatedSource ?entity ; + owl:annotatedProperty ?property ; + owl:annotatedTarget ?syn ; + oboInOwl:hasSynonymType ?syn_type . + } + + BIND(UCASE(?syn) AS ?syn_std) + FILTER (!isBlank(?entity) && !BOUND(?exclude)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + } GROUP BY ?syn_std ?property HAVING (?cnt > 1) } - ?entity ?property ?value. - ?entity2 ?property ?value . - FILTER NOT EXISTS { ?entity owl:deprecated true } - FILTER NOT EXISTS { ?entity2 owl:deprecated true } - FILTER (?entity != ?entity2) + ?entity ?property ?value . FILTER (!isBlank(?entity)) - FILTER (!isBlank(?entity2)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + FILTER (UCASE(?value) = ?syn_std) } ORDER BY DESC(UCASE(str(?value))) -``` +``` \ No newline at end of file From c94f513f7b8fbd773d4bbc9cf20377bfba4e2cb8 Mon Sep 17 00:00:00 2001 From: "J. Allen Baron" Date: Thu, 1 Feb 2024 16:20:59 -0500 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c333e4d54..0d031d5ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Updated `duplicate_exact_syonym` [`report`] query to be case-insensitive and ignore synoyms annotated as abbreviation or acronym synonym types [#1179] + ### Fixed - '--annotate-with-source true' does not work with extract --method subset [#1160] - Fix how Template adds entities to the QuotedEntityChecker [#1104]