You could use the CategoryNamePath field to query your data. However if you change the name of any of the category names in that path it will break your query.
So what we do is a naming convention for the code names of the categories. For example
Then in our query we look at the CategoryName starts with News.
We've found this to work the best AND it works across multiple environments as well as allows the user to change things around and add/remove items.