Location-Based Services (LBS) are attracting a great interest with the fast expansion of mobile computing nowadays. These services use the user location to customize the offered information. However, most of those services are designed for specific scenarios and goals with implicit knowledge about the application context. As a consequence, hundreds of them are available (even with the same purpose). So, it is difficult for users to choose the most suitable service as they are in charge of knowing/finding the services which will be interesting for them, and handle the information that such services need. In this paper, we present an approach to handle LBS for mobile users which relieves them from knowing and managing the knowledge related to such services. This approach consists of a proposal for the modeling of such information as ontologies, which are handled by an agent-based architecture. Also, we propose to maintain updated the knowledge each mobile device contains by leveraging the exchange of information with others. For accessing the local knowledge, we present an SPARQL-like query language which avoids the ambiguities of natural language. Finally, we propose an approach to translate the user information needs into formal requests expressed in this query language, which could be later processed against the knowledge repositories to obtain the results the user needs.