Abstract-Context-aware Recommender Systems aim to provide users with the most adequate recommendations for their current situation. However, an exact context obtained from a user could be too specific and may not have enough data for accurate rating prediction. This is known as the data sparsity problem. Moreover, often user preference representation depends on the domain or the specific recommendation approach used. Therefore, a big effort is required to change the method used. In this paper we present a new approach for contextual pre-filtering (i.e. using the current context to select a relevant subset of data). Our approach can be used with existing recommendation algorithms. It is based on two ontologies: Recommender System Context ontology, which represents the context, and Contextual Ontological User Profile ontology, which represents user preferences. We evaluated our approach through an offline study which showed that when used with well-known recommendation algorithms it can significantly improve the accuracy of prediction.