Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/deployment/sparql/citation-required.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Title:
# Missing Bibliographic Citation
# Constraint Description:
# Every resource shall have one or more bibliographic citations.
# Severity:
# Error

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

SELECT DISTINCT ?entity ?type WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:DatatypeProperty
owl:AnnotationProperty
owl:NamedIndividual
}

?entity a ?type .

FILTER(STRSTARTS(STR(?entity), STR(cco:)))

FILTER NOT EXISTS {
?entity dcterms:bibliographicCitation ?citation .
}
}
ORDER BY ?entity
25 changes: 25 additions & 0 deletions .github/deployment/sparql/feature-not-under-environmental.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Title:
# Feature Classes Not Under Environmental Feature
# Constraint Description:
# Finds classes whose labels indicate geospatial or environmental features but which are not subclasses of Environmental Feature.
# Severity:
# Error

PREFIX cco: <https://www.commoncoreontologies.org/>
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 ;
rdfs:label ?label .

FILTER(STRSTARTS(STR(?class), STR(cco:)))
FILTER(?class != cco:ont00000574) # Environmental Feature

FILTER(REGEX(STR(?label), "Feature$", "i"))

FILTER NOT EXISTS {
?class rdfs:subClassOf+ cco:ont00000574 .
}
}
ORDER BY ?label
37 changes: 37 additions & 0 deletions .github/deployment/sparql/is-curated-in-iri.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Title:
# is curated in ontology Cardinality or Value Problem
# Constraint Description:
# Every class, property, and individual shall have exactly one is curated in ontology statement, and its value shall be an ontology IRI.
# Severity:
# Error

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

SELECT ?entity ?type (COUNT(?curatedIn) AS ?curatedInCount) ?problem WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:DatatypeProperty
owl:AnnotationProperty
owl:NamedIndividual
}

?entity a ?type .

FILTER(STRSTARTS(STR(?entity), STR(cco:)))

OPTIONAL {
?entity cco:ont00001760 ?curatedIn .
}

BIND(
IF(COUNT(?curatedIn) != 1,
"resource does not have exactly one is curated in ontology statement",
"ok")
AS ?problem
)
}
GROUP BY ?entity ?type
HAVING(COUNT(?curatedIn) != 1)
ORDER BY ?entity
35 changes: 35 additions & 0 deletions .github/deployment/sparql/language-tag-and-period.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Title:
# Definition Formatting Problems
# Constraint Description:
# Every definition shall have an English language tag, be set as a complete sentence, and terminate in a period. This query checks language tag and final punctuation.
# Severity:
# Warning

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

SELECT DISTINCT ?entity ?definition ?problem WHERE {
VALUES ?type {
owl:Class
owl:ObjectProperty
owl:DatatypeProperty
owl:AnnotationProperty
}

?entity a ?type ;
skos:definition ?definition .

FILTER(STRSTARTS(STR(?entity), STR(cco:)))

{
FILTER(!LANGMATCHES(LANG(?definition), "en"))
BIND("definition does not have an English language tag" AS ?problem)
}
UNION
{
FILTER(!REGEX(STR(?definition), "\\.$"))
BIND("definition does not terminate in a period" AS ?problem)
}
}
ORDER BY ?entity ?problem
25 changes: 25 additions & 0 deletions .github/deployment/sparql/media-not-under-media-content.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Title:
# Media Content Classes Not Under Media Content Entity
# Constraint Description:
# Finds classes whose labels indicate media, documents, messages, images, videos, reports, spreadsheets, or similar content but which are not subclasses of Media Content Entity.
# Severity:
# Error

PREFIX cco: <https://www.commoncoreontologies.org/>
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 ;
rdfs:label ?label .

FILTER(STRSTARTS(STR(?class), STR(cco:)))
FILTER(?class != cco:ont00002001) # Media Content Entity

FILTER(REGEX(STR(?label), "Document|Message|Image|Video|Book|Spreadsheet|Report|Transcript|Certificate|Chart|Database|List", "i"))

FILTER NOT EXISTS {
?class rdfs:subClassOf+ cco:ont00002001 .
}
}
ORDER BY ?label
17 changes: 17 additions & 0 deletions .github/deployment/sparql/missing-version-iri.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Title:
# Ontology Missing Version IRI
# Constraint Description:
# Every ontology in CCO shall have a version IRI.
# Severity:
# Error

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

SELECT DISTINCT ?ontology WHERE {
?ontology a owl:Ontology .

FILTER NOT EXISTS {
?ontology owl:versionIRI ?versionIRI .
}
}
ORDER BY ?ontology
27 changes: 27 additions & 0 deletions .github/deployment/sparql/required-metadata.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Title:
# Ontology Metadata Cardinality Violation
# Constraint Description:
# Every ontology shall have exactly one license, rights statement, version info statement, and description.
# Severity:
# Error

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT ?ontology ?property (COUNT(?value) AS ?valueCount) WHERE {
?ontology a owl:Ontology .

VALUES ?property {
dcterms:license
dcterms:rights
owl:versionInfo
dcterms:description
}

OPTIONAL {
?ontology ?property ?value .
}
}
GROUP BY ?ontology ?property
HAVING(COUNT(?value) != 1)
ORDER BY ?ontology ?property
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Title:
# Temporal Relations Missing Domain or Range
# Constraint Description:
# Finds Time Ontology object properties whose labels indicate temporal relations but which lack an asserted domain or range.
# Severity:
# Warning

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

SELECT DISTINCT ?property ?label ?missing WHERE {
?property a owl:ObjectProperty ;
rdfs:label ?label .

FILTER(STRSTARTS(STR(?property), STR(cco:)))
FILTER(REGEX(STR(?label), "interval|instant|inside", "i"))

{
FILTER NOT EXISTS { ?property rdfs:domain ?domain }
BIND("missing domain" AS ?missing)
}
UNION
{
FILTER NOT EXISTS { ?property rdfs:range ?range }
BIND("missing range" AS ?missing)
}
}
ORDER BY ?label ?missing
Loading