Resolved: Read Turtle file and query the graph using SPARQL


I am in a learning phase of SPARQL so excuse if the question sounds basic. I am exploring SPARQLWrapper to connect to a SPARQL endpoint to fetch some data. Below is the query.
The query above work fine. Is there a way to load or read a Turtle file and then use SPARQLWrapper to query the graph?


To be able to query a graph with SPARQLWrapper, you need to load this graph in a SPARQL endpoint. Such an endpoint could be hosted locally, e.g.:
The documentation lists how certain endpoints can be used with SPARQLWrapper: SPARQL Endpoint Implementations
Instead of using SPARQLWrapper, you could consider using RDFLib (which gets used by SPARQLWrapper, and comes from the same developers), which allows you to query endpoints (using SERVICE) as well as files (no need to load them in an endpoint).

If you have better answer, please add a comment about this, thank you!