I have the following query getting the terminal leaf nodes from a parent category
select distinct ?subcat where {
?subcat skos:broader* category:Buildings_and_structures_in_France_by_city .
optional { ?subsubcat skos:broader ?subcat }
}
group by ?subcat
having count(?subsubcat) = 0
How do I get the path length between the child node ?subcat
and the parent node category:Buildings_and_structures_in_France_by_city
such that the output would be something like?