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 : <http://www.semanticweb.org/man/ontologies/2014/5/untitled-ontology-11#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?subject where {
?subject owl:equivalentClass ?restriction .
?restriction owl:onProperty :hasTags .
?restriction ?restrictType ?class .
?class rdfs:subClassOf* :Tag
}
-------------------------------------------------------------------------------------------
| subject |
===========================================================================================
| :Java_programming |
| <http://www.semanticweb.org/man/ontologies/2014/5/untitled-ontology-11#C++_programming> |
| :System_Programming |
-------------------------------------------------------------------------------------------