Compiling Complex Terminologies for Efficient Query Answering on the Semantic Web