Representing and reasoning about preferences is a key issue in many real-world scenarios in which personalized access to information is required. Many approaches have been proposed and studied in the literature that allow a system to work with qualitative or quantitative preferences; among the qualitative models, one of the most prominent are CP-nets. Their clear graphical structure unifies an easy representation of user preferences with good computational properties when computing the best outcome. In this paper, we show how to reason with CP-nets when the attributes modeling the knowledge domain are structured via an underlying domain ontology. We show how the computation of all undominated feasible outcomes of an ontological CP-net can be reduced to the solution of a constraint satisfaction problem, and study the computational complexity of the basic reasoning problems in ontological CP-nets.