I feel like I'm missing something rather obvious. I would like to query my graph so that I get all the "leafs", so any class that does not have a subclass. Basically, I need the inverse of rdfs:hasSubClass (I tried rdfs:superClassOf but it doesn't not exist ahaha).
For example, when I query for the lowest level of the classes by using
WHERE
{?level1 subClassOf ?level2
?level2 subClassOf ?level3
?level3 subClassOf ?level4
etc.}
I eventually end up with kind of what I want: some of the leafs. But if I then join this result to the leafs of one level higher, I also receive the parent classes of the leafs of the query above, which I do not want. I only want children classes, no parents, if that makes sense.
The goal is to be able to output a list of classes that can be instantiated.
Looking for any tips in the right direction! Thank you!
question from:
https://stackoverflow.com/questions/65905143/sparql-query-to-get-all-the-leaf-classes-lowest-level-classes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…