The Drosophila brain has only a fraction of the number of neurons of higher organisms such as mice. Yet the sheer complexity of its neural circuits recently revealed by large connectomics datasets suggests that computationally modeling the function of fruit fly brain at this scale posits significant challenges. To address these challenges, we present here a programmable ontology that expands the scope of the current Drosophila brain anatomy ontologies to encompass the functional logic of the fly brain. The programmable ontology provides a language not only for defining functional circuit motifs but also for programmatically exploring their functional logic. To achieve this goal, we tightly integrated the programmable ontology with the workflow of the interactive FlyBrainLab computing platform. As part of the programmable ontology, we developed NeuroNLP++, a web application that supports free-form English queries for constructing functional brain circuits fully anchored on the available connectome/synaptome datasets, and the published worldwide literature. In addition, we present a methodology for including a model of the space of odorants into the programmable ontology, and for modeling olfactory sensory circuits of the antenna of the fruit fly brain that detect odorant sources. Furthermore, we describe a methodology for modeling the functional logic of the antennal lobe circuit consisting of massive local feedback loops, a characteristic feature observed across Drosophila brain regions. Finally, using a circuit library, we demonstrate the power of our methodology for interactively exploring the functional logic of the massive number of feedback loops in the antennal lobe.