API for querying of arbitrary hierarchical data