Checks if the given uri is hierarchical, as otherwise the `getQueryParameterNames` function will throw an exception.