AIDA-83 select title query.
AIDA-83 use method to create common error message.
AIDA-83 fix sparql

- Close where clause at end.
AIDA-83 getTitle

- Only tested happy path.
AIDA-83 Improve code readability.

- Refactor common parts into methods
- Improve error warning messages.