Added domain detection and refactored Sparql queries.