Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?class ?label
WHERE {
?class a owl:Class .
FILTER (regex(str(?class),"http://www.ontologyrepository.com/CommonCoreOntologies/"))
FILTER (regex(str(?class),"https://www.commoncoreontologies.org/"))
FILTER NOT EXISTS {?class rdfs:subClassOf+ <http://purl.obolibrary.org/obo/BFO_0000001> }
OPTIONAL {?class rdfs:label ?label}
}
60 changes: 60 additions & 0 deletions .github/deployment/sparql/annotation_language_tag.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Title:
# Annotation Values Must Have English Language Tag
# Constraint Description:
# All natural-language annotation values on CCO ontology elements must carry
# an English (@en) language tag. This applies to: rdfs:label, skos:definition,
# rdfs:comment, skos:altLabel, skos:prefLabel, skos:editorNote,
# cco:ont00001737 [doctrinal definition], and cco:ont00001748 [doctrinal label].
# Values typed as xsd:anyURI are exempt (they are IRI references, not NL text).
# English dialect tags such as @en-US and @en-GB are accepted.
# Severity:
# Error
# Reference:
# # Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cco: <https://www.commoncoreontologies.org/>

SELECT DISTINCT ?resource ?prop ?val ?error
WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
# Scope to natural-language annotation properties only.
# xsd:anyURI-typed values (IRI references) are handled by the datatype filter below.
VALUES ?prop {
rdfs:label
skos:definition
rdfs:comment
skos:altLabel
skos:prefLabel
skos:editorNote
cco:ont00001737
cco:ont00001748
}
?resource a ?type .
FILTER (STRSTARTS(STR(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
?resource ?prop ?val .
FILTER (isLiteral(?val))
# langMatches handles dialect tags: @en-US, @en-GB all pass.
# lang("") of a plain literal returns "" — langMatches("", "en") = FALSE — flagged.
FILTER (!langMatches(lang(?val), "en"))
# Allow xsd:anyURI values (IRI references do not need a language tag).
FILTER (datatype(?val) != xsd:anyURI)
BIND (CONCAT(
"ERROR: Term ", STR(?resource),
" has annotation <", STR(?prop),
"> with value \"", STR(?val),
"\" that is missing an @en language tag (lang='", lang(?val), "')."
) AS ?error)
}
ORDER BY ?resource ?prop
58 changes: 58 additions & 0 deletions .github/deployment/sparql/curated_in_matches_ontology.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Title:
# cco:ont00001760 Value Must Point to a Declared CCO Ontology
# Constraint Description:
# The value of cco:ont00001760 [is curated in ontology] on every CCO ontology
# element must be the IRI of a CCO ontology that is actually declared as
# owl:Ontology within the CCO namespace
# (https://www.commoncoreontologies.org/).
# This catches values that:
# - Point to a non-existent or deleted ontology module.
# - Use the old v1 namespace (http://www.ontologyrepository.com/...).
# - Contain a typo in the ontology name.
# Severity:
# Error
# Reference:
# CCO Release Process v2, Step 6c / Step 6f
# Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX cco: <https://www.commoncoreontologies.org/>

SELECT DISTINCT ?resource ?curatedIn ?error
WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (STRSTARTS(STR(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
?resource cco:ont00001760 ?curatedIn .
# The merged file only carries one owl:Ontology IRI (CommonCoreOntologiesMerged),
# so dynamic lookup against owl:Ontology triples is not feasible for merged runs.
# Instead validate against the fixed allowlist of the 11 CCO module ontology IRIs.
# Update this list whenever a module is added or removed.
FILTER (STR(?curatedIn) NOT IN (
"https://www.commoncoreontologies.org/AgentOntology",
"https://www.commoncoreontologies.org/ArtifactOntology",
"https://www.commoncoreontologies.org/CurrencyUnitOntology",
"https://www.commoncoreontologies.org/EventOntology",
"https://www.commoncoreontologies.org/ExtendedRelationOntology",
"https://www.commoncoreontologies.org/FacilityOntology",
"https://www.commoncoreontologies.org/GeospatialOntology",
"https://www.commoncoreontologies.org/InformationEntityOntology",
"https://www.commoncoreontologies.org/QualityOntology",
"https://www.commoncoreontologies.org/TimeOntology",
"https://www.commoncoreontologies.org/UnitsOfMeasureOntology"
))
BIND (CONCAT(
"ERROR: Term <", STR(?resource),
"> has cco:ont00001760 value <", STR(?curatedIn),
"> which does not match any known CCO module ontology IRI."
) AS ?error)
}
ORDER BY ?resource
42 changes: 42 additions & 0 deletions .github/deployment/sparql/duplicate_iri_number.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# duplicate_iri_number.sparql
# Step 6 QC — Flags any two OWL entities whose IRI ends in the same
# "ont" + 8-digit numeric fragment, regardless of namespace.
#
# Why this matters:
# The canonical IRI pattern is https://www.commoncoreontologies.org/ont<8digits>
# If the same 8-digit number appears under a different base (e.g., old v1
# namespace http://www.ontologyrepository.com/CommonCoreOntologies/ or a
# typo namespace), two distinct IRIs share the same logical ID — creating
# ambiguity, potential reasoner issues, and broken cross-references.
#
# Reports: pairs of IRIs sharing the same numeric fragment, plus that fragment.
# Expected result on a clean release: 0 violations.

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT ?iri1 ?iri2 ?sharedID WHERE {
VALUES ?owlType {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}

# Both IRIs must be declared OWL entities with the ont+8digit pattern
?iri1 rdf:type ?owlType .
?iri2 rdf:type ?owlType .

FILTER(?iri1 != ?iri2)
FILTER(REGEX(STR(?iri1), "ont[0-9]{8}$"))
FILTER(REGEX(STR(?iri2), "ont[0-9]{8}$"))

# Extract the shared numeric fragment (e.g. "ont00001234")
BIND(REPLACE(STR(?iri1), "^.*(ont[0-9]{8})$", "$1") AS ?sharedID)
FILTER(STRENDS(STR(?iri2), ?sharedID))

# Report each pair once only
FILTER(STR(?iri1) < STR(?iri2))
}
ORDER BY ?sharedID
56 changes: 56 additions & 0 deletions .github/deployment/sparql/exactly_1_curated_in.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Title:
# Exactly One cco:ont00001760 [is curated in ontology] Per Ontology Element
# Constraint Description:
# All CCO ontology elements (classes, properties, individuals) must have
# exactly one cco:ont00001760 annotation. This query flags:
# (a) Elements with NO cco:ont00001760 annotation at all.
# (b) Elements with MORE THAN ONE cco:ont00001760 annotation.
# Severity:
# Error
# Reference:
# CCO Release Process v2, Step 6c
# Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX cco: <https://www.commoncoreontologies.org/>

SELECT DISTINCT ?resource ?error
WHERE {
{
# Branch (a): missing cco:ont00001760 entirely
# All patterns are self-contained inside each UNION branch so that
# ?resource is properly bound before FILTER NOT EXISTS is evaluated.
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (regex(str(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
FILTER NOT EXISTS { ?resource cco:ont00001760 ?any }
BIND (CONCAT("ERROR: Term ", str(?resource), " is missing cco:ont00001760 [is curated in ontology].") AS ?error)
}
UNION
{
# Branch (b): more than one cco:ont00001760 annotation
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (regex(str(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
?resource cco:ont00001760 ?val1 .
?resource cco:ont00001760 ?val2 .
FILTER (STR(?val1) != STR(?val2))
BIND (CONCAT("ERROR: Term ", str(?resource), " has duplicate cco:ont00001760 values: <", str(?val1), "> and <", str(?val2), ">.") AS ?error)
}
}
ORDER BY ?resource
59 changes: 59 additions & 0 deletions .github/deployment/sparql/exactly_1_label.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Title:
# Exactly One rdfs:label Per Language Per Ontology Element
# Constraint Description:
# All CCO ontology elements (classes, properties, individuals) must have
# exactly one rdfs:label. This query flags:
# (a) Elements with NO rdfs:label at all.
# (b) Elements with MORE THAN ONE rdfs:label in the same language.
# Severity:
# Error
# Reference:
# CCO Release Process v2, Step 6c
# Pattern based on: exactly_1_prefLabel_per_lang.sparql
# Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?resource ?error
WHERE {
{
# Branch (a): missing rdfs:label entirely
# All patterns must be self-contained inside each UNION branch so that
# ?resource is properly bound before FILTER NOT EXISTS is evaluated.
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (regex(str(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
FILTER NOT EXISTS { ?resource rdfs:label ?anyLbl }
BIND (CONCAT("ERROR: Term ", str(?resource), " has no rdfs:label.") AS ?error)
}
UNION
{
# Branch (b): more than one rdfs:label in the same language
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (regex(str(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
?resource rdfs:label ?lbl1 .
?resource rdfs:label ?lbl2 .
FILTER (?lbl1 != ?lbl2)
FILTER (lang(?lbl1) = lang(?lbl2))
FILTER (lang(?lbl1) != "")
BIND (CONCAT("ERROR: Term ", str(?resource), " has duplicate rdfs:label values in language '", lang(?lbl1), "': \"", str(?lbl1), "\" and \"", str(?lbl2), "\".") AS ?error)
}
}
ORDER BY ?resource
38 changes: 38 additions & 0 deletions .github/deployment/sparql/iri_format_check.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Title:
# CCO Term IRI Format Check
# Constraint Description:
# All CCO ontology elements (classes, properties, individuals) must have an IRI
# matching the canonical CCO format:
# https://www.commoncoreontologies.org/ont<8 digits>
# Example: https://www.commoncoreontologies.org/ont00001760
# Ontology-level IRIs (owl:Ontology) are not term IRIs and are intentionally
# excluded from this check.
# Severity:
# Error
# Reference:
# CCO Release Process v2, Step 6e
# Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT DISTINCT ?resource ?error
WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:AnnotationProperty
owl:DatatypeProperty
owl:NamedIndividual
}
?resource a ?type .
FILTER (STRSTARTS(STR(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))
# Flag any term IRI that does NOT match ont + exactly 8 digits.
FILTER (!REGEX(STR(?resource), "^https://www\\.commoncoreontologies\\.org/ont[0-9]{8}$"))
BIND (CONCAT(
"ERROR: Term IRI <", STR(?resource),
"> does not match the required CCO format https://www.commoncoreontologies.org/ont<8 digits>."
) AS ?error)
}
ORDER BY ?resource
41 changes: 41 additions & 0 deletions .github/deployment/sparql/missing_definition_source.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Title:
# Definition Source Required
# Constraint Description:
# All CCO classes and object properties that have a skos:definition should also
# have a cco:ont00001754 [definition source] annotation. Terms missing a
# definition source are flagged as warnings. Some terms may legitimately lack a
# source (e.g., primitive relations); those should be reviewed case by case.
# Severity:
# Warning
# Reference:
# CCO Release Process v2, Step 6h
# Pattern based on: min_1_eng_def.sparql
# Author:
# github.com/shanmukhkalasamudram

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX cco: <https://www.commoncoreontologies.org/>

SELECT DISTINCT ?resource ?label ?error
WHERE {
VALUES ?type { owl:Class owl:ObjectProperty }
?resource a ?type .

# Must have a definition (already caught by min_1_eng_def if missing)
?resource skos:definition ?definition .

# Scope to current CCO terms only
FILTER (regex(str(?resource), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?resource))

# Flag those missing a definition source
OPTIONAL { ?resource cco:ont00001754 ?source }
FILTER (!bound(?source))

OPTIONAL { ?resource rdfs:label ?label }

BIND (CONCAT("WARNING: Term ", str(?resource), " has a definition but is missing cco:ont00001754 [definition source].") AS ?error)
}
ORDER BY ?resource
28 changes: 28 additions & 0 deletions .github/deployment/sparql/no_cco_elucidation.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Title:
# No Use of Deprecated cco:elucidation Property
# Constraint Description:
# The annotation property cco:elucidation (from the old CCO v1 namespace) is
# deprecated. It was replaced by skos:editorNote in CCO v2. Any CCO term that
# still uses cco:elucidation as a predicate must be updated.
# Severity:
# Error
# Author:
# github.com/shanmukhkalasamudram
# Inspired by: Giacomo Decolle

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?subject ?label ?error
WHERE {
?subject <http://www.ontologyrepository.com/CommonCoreOntologies/elucidation> ?value .

# Scope to current CCO terms only
FILTER (regex(str(?subject), "https://www.commoncoreontologies.org/"))
FILTER (!isBlank(?subject))

OPTIONAL { ?subject rdfs:label ?label }

BIND (CONCAT("ERROR: Term ", str(?subject), " uses deprecated cco:elucidation. Replace with skos:editorNote.") AS ?error)
}
ORDER BY ?subject
Loading
Loading