This paper identifies requirements for querying and accessing context information in mobile and pervasive computing environments. Furthermore it studies existing query languages showing that they satisfy only a subset of these requirements or cover some of them only to a limited extent. A new context query language is presented to overcome these shortcomings, improving the state of the art in several respects: heterogeneous representations of context information, definition of complex filtering mechanisms, elaborate aggregation functions and ontology integration, all in one language.