improved error messages

- improved error messages related to sparql queries failing.
- refactored some duplicate information into variables