Skip to content

Commit

Permalink
Merge pull request #1179 from allenbaron/query_update
Browse files Browse the repository at this point in the history
Exclude some synonym types from duplicate_exact_synonym report query
  • Loading branch information
jamesaoverton authored May 1, 2024
2 parents 4aebac4 + 4f59f71 commit c1ad167
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added option to input template strings from external file [#1152]

### 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]
Expand Down Expand Up @@ -388,6 +391,7 @@ First official release of ROBOT!
[`validate`]: http://robot.obolibrary.org/validate
;
[#1181]: https://github.com/ontodev/robot/pull/1181
[#1179]: https://github.com/ontodev/robot/pull/1179
[#1171]: https://github.com/ontodev/robot/pull/1171
[#1168]: https://github.com/ontodev/robot/pull/1168
[#1160]: https://github.com/ontodev/robot/pull/1160
Expand Down
39 changes: 26 additions & 13 deletions docs/report_queries/duplicate_exact_synonym.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
# 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: <http://purl.obolibrary.org/obo/>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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)))
```
```
Original file line number Diff line number Diff line change
@@ -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 (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.

PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

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)))

0 comments on commit c1ad167

Please sign in to comment.