Nowadays, there is an increasing development of intelligent systems like online social networks, personalized recommendation systems and knowledge-based systems which are especially based on ontologies. Personalized recommendation systems applied with online social networking assist delivering a personalized content to Web-based application users. Indeed, these systems offer services that can greatly improve the response to users’ needs in their search for persons or for some products. In order to model these users, semantic web technologies such as ontologies are used to explicit the hidden knowledge through using rules. In this paper, we propose to measure the similarity between the user context and other users’ contexts in our ontology. Then, we integrate this measure in recommendation model to infer recommendation items (raw material, production tool, supplier name, etc.) based on SWRL rules. The experiments and evaluations show the applicability of our approach.