Skip to content

Instantly share code, notes, and snippets.

@justin2004
Created September 19, 2025 02:10
Show Gist options
  • Select an option

  • Save justin2004/589f307da88b6893bfe5f22c13f56196 to your computer and use it in GitHub Desktop.

Select an option

Save justin2004/589f307da88b6893bfe5f22c13f56196 to your computer and use it in GitHub Desktop.
ontology to table
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
prefix bfo: <http://purl.obolibrary.org/obo/>
prefix cco: <https://www.commoncoreontologies.org/>
prefix owl: <http://www.w3.org/2002/07/owl#>
select * where {
?s a owl:ObjectProperty .
# ?s a owl:DatatypeProperty .
# ?s a owl:Class .
?s rdfs:label ?label .
optional{?s skos:definition ?definition } .
# filter(STRSTARTS(str(?s), "http://purl.obolibrary.org/obo/BFO_"))
filter(STRSTARTS(str(?s), "https://www.commoncoreontologies.org/"))
bind(REPLACE(STR(?s), STR(cco:), "cco:") AS ?s_qname)
bind(REPLACE(STR(?label), STR(" "), "_") AS ?label_no_space)
bind(concat("cco:",?label_no_space) as ?label_as_qname)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment