How to integrate an ontology with Rasa bot

Yeah sure @nik202, We are going to develop a Covid-19 information sharing chatbot using Rasa framework. There is a requirement to detect diagnosis level of the user and provide user specific recommendation based on the information given by the user during the conversation To do that, we decided to use an ontology which can be infer the recommendation and need to use SPARQL query to retrieve knowledge from ontology. I want to clarify whether we can do this in actions.py using simple python functions or is there any specific way to integrate ontology with Rasa ?