I am trying to query a very simple database about Alloys with a parametrized SPARQL query using RDFLib:
x = "Inconel_625"
g = Graph()
g.parse ("Desktop/materials.ttl")
knows_query = """
SELECT ?min ?max
WHERE
{ ?s rdfs:label """+x+""";
mydb:min ?min ;
mydb:max ?max.
}"""
qres = g.query(knows_query)
for x in qres:
print(x.min, x.max)
Unfortunatly this code does not work. If i replace """+x+""" with "Inconel_625 it works somehow. What am i not seeing? Is it not possible to parametrize a sparql query in RDFLib?