Urban tourism information available on Internet has been of enormous relevance to motivate the tourism in many countries. There exist many applications focused on promoting and preserving the cultural heritage, through urban tourism, which in turn demand a well-defined and standard model for representing the whole knowledge of this domain, thus ensuring interoperable and flexible applications. Current studies propose the use of ontologies to formally model such knowledge. Nonetheless, most of them only represent partial knowledge of cultural heritage or are restrictive to an indoor perspective (i.e., museum ontologies). In this context, we propose the ontology CURIOCITY (Cultural Heritage for Urban Tourism in Indoor/Outdoor environments of the CITY), to represent the cultural heritage knowledge based on UNESCO's definitions. CURIOCITY ontology has a three-level architecture (Upper, Middle, and Lower ontologies) in accordance with a purpose of modularity and levels of specificity. In this paper, we describe in detail all modules of CURIOCITY ontology and perform a comparative evaluation with state-of-the-art ontologies. Additionally, to demonstrate the suitability of CURIOCITY ontology, we show several touristic services offered through a framework supported in the ontology. The framework includes an automatic population process, that allows transforming a museum data repository (in CSV format) into RDF triples of CURIOCITY ontology to automatically populate the CURIOCITY repository, and facilities to develop a set of tourism applications and services, following the UNESCO's definitions.