From 65bb0c93250665a71b7c7ac36fd411ab3fffb92d Mon Sep 17 00:00:00 2001 From: oliviahobai <119642653+oliviahobai@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:05:17 -0400 Subject: [PATCH 1/3] Create no-orphaned-subclasses.sparql There is probably some trouble with lines 10-11. When it's convenient, could somebody else look at this file, please? --- .../sparql/no-orphaned-subclasses.sparql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/deployment/sparql/no-orphaned-subclasses.sparql diff --git a/.github/deployment/sparql/no-orphaned-subclasses.sparql b/.github/deployment/sparql/no-orphaned-subclasses.sparql new file mode 100644 index 0000000..a327d96 --- /dev/null +++ b/.github/deployment/sparql/no-orphaned-subclasses.sparql @@ -0,0 +1,21 @@ +# Title: +# No Orphaned Subclasses +# Constraint Description: +# All classes must have some parent class. The only result otherwise should be “entity”. +# Severity: +# Warning +# Author: +# github.com/swartik + +Severity: + (select "Warning" or "Error") + +PREFIX owl: +PREFIX rdfs: + +SELECT DISTINCT ?cls +WHERE { + ?cls a owl:Class + FILTER isIRI(?cls) + FILTER NOT EXISTS { ?cls rdfs:subClassOf ?supercls } +} From 51efd29ffae96241e4cb9235feba356f4c61f0d5 Mon Sep 17 00:00:00 2001 From: oliviahobai <119642653+oliviahobai@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:24:41 -0400 Subject: [PATCH 2/3] Update no-orphaned-subclasses.sparql Based on the updates provided by @swartik, thank you. Tell me if there are any remaining edits that need to be made. --- .github/deployment/sparql/no-orphaned-subclasses.sparql | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/deployment/sparql/no-orphaned-subclasses.sparql b/.github/deployment/sparql/no-orphaned-subclasses.sparql index a327d96..07c185c 100644 --- a/.github/deployment/sparql/no-orphaned-subclasses.sparql +++ b/.github/deployment/sparql/no-orphaned-subclasses.sparql @@ -1,15 +1,12 @@ # Title: # No Orphaned Subclasses # Constraint Description: -# All classes must have some parent class. The only result otherwise should be “entity”. +# All CCO classes must have a superclass. # Severity: -# Warning +# Error # Author: # github.com/swartik -Severity: - (select "Warning" or "Error") - PREFIX owl: PREFIX rdfs: @@ -18,4 +15,5 @@ WHERE { ?cls a owl:Class FILTER isIRI(?cls) FILTER NOT EXISTS { ?cls rdfs:subClassOf ?supercls } + FILTER (?cls != ) } From f512eaf41ff1dbd3a8efd05cf0a0573ba95d2c84 Mon Sep 17 00:00:00 2001 From: oliviahobai <119642653+oliviahobai@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:55:55 -0400 Subject: [PATCH 3/3] Change no-orphaned-subclasses.sparql to all-CCO-classes-have-a-BFO-superclass This is a query designed by @neilotte after an issue originally raised by @swartik . --- .../all-CCO-classes-have-a-BFO-superclass | 19 +++++++++++++++++++ .../sparql/no-orphaned-subclasses.sparql | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 .github/deployment/sparql/all-CCO-classes-have-a-BFO-superclass delete mode 100644 .github/deployment/sparql/no-orphaned-subclasses.sparql diff --git a/.github/deployment/sparql/all-CCO-classes-have-a-BFO-superclass b/.github/deployment/sparql/all-CCO-classes-have-a-BFO-superclass new file mode 100644 index 0000000..eeea2f5 --- /dev/null +++ b/.github/deployment/sparql/all-CCO-classes-have-a-BFO-superclass @@ -0,0 +1,19 @@ +# Title: +# No CCO Class Should Be Outside the BFO Hierarchy +# Constraint Description: +# All CCO classes must have a BFO superclass. +# Severity: +# Error +# Author: +# github.com/neilotte + +PREFIX owl: http://www.w3.org/2002/07/owl# +PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema# + +SELECT DISTINCT ?class ?label +WHERE { +?class a owl:Class . +FILTER contains(str(?class),"http://www.ontologyrepository.com/CommonCoreOntologies/") +FILTER NOT EXISTS {?class rdfs:subClassOf+ http://purl.obolibrary.org/obo/BFO_0000001 } +OPTIONAL {?class rdfs:label ?label} +} diff --git a/.github/deployment/sparql/no-orphaned-subclasses.sparql b/.github/deployment/sparql/no-orphaned-subclasses.sparql deleted file mode 100644 index 07c185c..0000000 --- a/.github/deployment/sparql/no-orphaned-subclasses.sparql +++ /dev/null @@ -1,19 +0,0 @@ -# Title: -# No Orphaned Subclasses -# Constraint Description: -# All CCO classes must have a superclass. -# Severity: -# Error -# Author: -# github.com/swartik - -PREFIX owl: -PREFIX rdfs: - -SELECT DISTINCT ?cls -WHERE { - ?cls a owl:Class - FILTER isIRI(?cls) - FILTER NOT EXISTS { ?cls rdfs:subClassOf ?supercls } - FILTER (?cls != ) -}