I am trying to learn ontologies and SPARQL using Protégé.
I'm trying to figure out SPARQL code to show subclasses of a given class:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX untitled-ontology-10: <http://www.semanticweb.org/chris/ontologies/2022/8/untitled-ontology-10#>
SELECT DISTINCT ?subclass
WHERE {
?subclass rdfs:subClassOf Class.Thing .
}
In the example here I'm trying to find all subclasses of the class Thing (or of any other defined class, e.g. Professions, in my project).
Class.Thing doesn't work of course. Neither does :Thing nor ns:Thing nor #Thing nor any of the other variants I've found in examples.
Of course if I use a variable in place of Class.Thing, it'll show me all classes, but I would really like to narrow it down to subclasses of a specific class.
Can anyone tell me how to do this?