Right now the delivery API returns a list of sitemap_locations for items. It would be nice to know the path through the sitemap tree to the item for each sitemap_location.
Currently the only way to get the hierarchy is through the migration api.
The sitemap functionality was designed in the early days of Kentico Cloud, as a feature that supports the process of content creation and collaboration. We have plans to improve the feature (but I can't be more specific on when it gets into production).
In the meantime, I've written an article on how navigation can be modeled with a dedicated content type ("Navigation Item"). In my example, the navigation hierarchy/graph is cached and could be queried quickly to get a path of a given content item. Although I haven't written such specific method in my example, I believe it would look very similar to the ProcessUrlLevelAsync method (which works the other way around--it finds a content item by the URL path).
If you wish me to give you some more detailed info on the example, just let me know. I'll be happy to help. In the end, we may write a follow-up article on that topic, in Java, for instance.