An inference engine is described with improved speed in evaluating queries posed to a data structure based on an ontology with a declarative set of rules. The inference engine comprises: rule rewriters, a rule compiler, and an operator net.The operator net comprises a graph with operators as nodes and with connections between the operators as edges of the graph.The operators serve for: retrieving facts; matching facts and variables in rules; expressing rule bodies and rule heads; expressing negations; and expressing logical AND operations between rule bodies. The operator net is a very general and versatile representation of the rules and queries. It also lends itself easily to multithreading and debugging.