Add query to `self` links; fix HATEOAS links for versioned documents

Adds the current query string to the `self` link for responses with multiple documents (fixes #464). Makes sure that `parent` and `collection` links follow the scheme described in #475.

These changes will hopefully allow the entire API to be navigable by following HATEOAS links.