I\'m using Jena and Sparql to query the ontology file.
I have
You need to ask for things that are subclasses of Tag. Thus, something like
?class rdfs:subClassOf* :Tag
The * means you need to match a path of 0 or more occurrences of rdfs:subClassOf, so ?class can be Tag, or a subclass of Tag, or or subclass of a subclass of Tag, etc. A complete working query would be:
prefix :
prefix owl:
prefix rdfs:
select distinct ?subject where {
?subject owl:equivalentClass ?restriction .
?restriction owl:onProperty :hasTags .
?restriction ?restrictType ?class .
?class rdfs:subClassOf* :Tag
}
-------------------------------------------------------------------------------------------
| subject |
===========================================================================================
| :Java_programming |
| |
| :System_Programming |
-------------------------------------------------------------------------------------------