Skip to end of metadata
Go to start of metadata

An example SPARQL query that can help you assemble the hierarchy of classes in an ontology.

select distinct ?type ?label ?supertype 
where { 
	{ ?type a owl:Class . } UNION { ?ind a ?type . } . 
	OPTIONAL { ?type rdfs:subClassOf ?supertype } . 
	OPTIONAL { ?type rdfs:label ?label } 
} ORDER BY ?type


Source: I found this query within the web console of Stardog as one of the sample queries they provide in a drop-down list of options.