I think the only way to do this is to
- filter the results you get from your
inc=area-rels
query, find the one (or more) that’s “part of” with<direction>backward</direction>
- query that area and check its
area-type
- if the type is “country”, you’re done
- if the type is not a “country”, then repeat recursively until you find the country.