Hi!
We're trying to extract full type hierarchy of Wikidata starting from all occurrences of P31 and P279. While we have some custom code for this, we're thinking there may be a smarter/more-efficient way of doing it using SPARQL or a tool that we are probably unaware of. Any hint would be appreciated. :)
Well, Blazegraph implements BFS: https://wiki.blazegraph.com/wiki/index.php/RDF_GAS_API#GAS_Examples which may be useful in this case, though I am not sure it is possible to map the whole thing in one query without running into timeouts.
Also, I'm not sure P31 and P279 currently represent hierarchy as such - t.e. loops have been known to exist in those (maybe already fixed, but not 100% sure). So one needs to be aware of that too.