The Knowledge Base module provides a high level way of querying your data. Indeed the DefaultKnowledgeBase class encapsulates an ontology and data and allows one to query the associated knowledge base without caring about the algorithm to be used.
See the Getting Started with a KB example for an example of use.