Annotation search: factor out result table row creation

Having the creation and appending of one result table row in a dedicated
function makes the code more readable and allows reuse. Since a click on an
annotation should expand this annotation to the entities that are annotated
with it, this function will be of use there as well.
Annotation search: replace for-loop with replace
Annotation search: add expansion of annotations in results

If one clicks on an annotation in the result table, a new query is made for all
the entities that are annotated with this particular annotation. The results are
then displayed indented below the annotation.
Annotation search: use classes for entity identification

Since annotations can be expanded, it can happen that entities will be displayed
multiple times. To refer to rows referencing an entity it makes therefore more
sense to use a class than an ID. IDs have to be unique after all which would
prevent exactly that.