Implemented knoldegbase and query mechanism