From 4256b6f6492f3dc46ff986df53f0b621391d6091 Mon Sep 17 00:00:00 2001 From: Anita Caron Date: Fri, 1 Sep 2023 16:05:59 +0100 Subject: [PATCH] Add label synonym polysemy check (#2112) * add label synonym polysemy check * update annotation to use obo:cl#abbreviation in sparql qc --------- Co-authored-by: Anita Caron --- src/ontology/Makefile | 2 +- src/ontology/cl-odk.yaml | 1 + .../label-synonym-polysemy-violation.sparql | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/sparql/label-synonym-polysemy-violation.sparql diff --git a/src/ontology/Makefile b/src/ontology/Makefile index b604bab1e..cb1fd9e53 100644 --- a/src/ontology/Makefile +++ b/src/ontology/Makefile @@ -41,7 +41,7 @@ REPORT_FAIL_ON = ERROR REPORT_LABEL = REPORT_PROFILE_OPTS = OBO_FORMAT_OPTIONS = -SPARQL_VALIDATION_CHECKS = equivalent-classes owldef-self-reference nolabels pmid-not-dbxref obsolete-replaced_by obsolete-alt-id orcid-contributor illegal-annotation-property +SPARQL_VALIDATION_CHECKS = equivalent-classes owldef-self-reference nolabels pmid-not-dbxref obsolete-replaced_by obsolete-alt-id orcid-contributor illegal-annotation-property label-synonym-polysemy SPARQL_EXPORTS = basic-report ODK_VERSION_MAKEFILE = v1.4.1 diff --git a/src/ontology/cl-odk.yaml b/src/ontology/cl-odk.yaml index 5d8f91b7d..ace3b84e4 100644 --- a/src/ontology/cl-odk.yaml +++ b/src/ontology/cl-odk.yaml @@ -90,6 +90,7 @@ robot_report: - obsolete-alt-id - orcid-contributor - illegal-annotation-property + - label-synonym-polysemy custom_sparql_exports : - basic-report components: diff --git a/src/sparql/label-synonym-polysemy-violation.sparql b/src/sparql/label-synonym-polysemy-violation.sparql new file mode 100644 index 000000000..803e2201d --- /dev/null +++ b/src/sparql/label-synonym-polysemy-violation.sparql @@ -0,0 +1,36 @@ +PREFIX obo: +PREFIX oboInOwl: +PREFIX owl: +PREFIX rdfs: + +SELECT ?entity ?property ?value WHERE { + VALUES ?property { + obo:IAO_0000118 + oboInOwl:hasExactSynonym + rdfs:label + } + { SELECT DISTINCT ?iname (COUNT(DISTINCT ?entity) AS ?cnt) WHERE { + VALUES ?property { + obo:IAO_0000118 + oboInOwl:hasExactSynonym + rdfs:label + } + ?entity ?property ?name . + OPTIONAL { + ?abbr a owl:Axiom; + owl:annotatedSource ?entity; + owl:annotatedProperty oboInOwl:hasExactSynonym; + owl:annotatedTarget ?name; + oboInOwl:hasSynonymType . + } + + BIND(UCASE((?name)) AS ?iname) + FILTER (!isBlank(?entity) && !BOUND(?abbr)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + } GROUP BY ?iname HAVING (?cnt > 1) + } + ?entity ?property ?value . + FILTER (!isBlank(?entity)) + FILTER NOT EXISTS { ?entity owl:deprecated true } + FILTER (UCASE(?value) = ?iname) +} ORDER BY ?entity