extracting IQuery interface from ShortestPathQuery and implemented into the other queries