I'm currently trying to get the inference explanation of a queried result through pystardog.
Using the examples inside the GitHub repository is was able to create something like this:
s = result['s']['value']
triple = "<"+s+">\t"+"<https://www.w3.org/1999/02/22-rdf-syntax-ns#type>\t"+"<http://www.w3.org/ns/sosa/Observation>."
r = conn.explain_inference(stardog.content.Raw(triple))
print(r)
But the return value is always an empty list...
I've tried other ways to format the triple itself, but then I get a 406 error...
Or does pystardog provides other ways to get the inference rules from a select query?
More in detail:
I have some rules inside my database, and when I perform a select SPARQL query, I receive the correct triples. I now want to know which rules were fired for each of the individual query results..
I haven't used pystardog myself but this is just my best guess. You might want to drop the angle brackets when constructing triple in case the result already has angle brackets in which case you'd end up with double angle brackets.
s = result['s']['value']
triple = "" + s + "\t" + "<https://www.w3.org/1999/02/22-rdf-syntax-ns#type>\t" + "<http://www.w3.org/ns/sosa/Observation>."
print(triple)
r = conn.explain_inference(stardog.content.Raw(triple))
print(r)