How to query the Rule that led to "inferred relationship"


Hi Grakn Team,

I would like to fetch some results using Graql from Grakn KG. I am able to write the query to find the required relationships, both direct and inferred, but along with it I also want to know the RULE details which actually led to the “inferred relationship” in the KG. I have multiple Rules defined so i would like to get the details of the exact Rule that got fired when the query matching the criteria of that Rule got executed.

As an example, consider there are 4 Rules - R1, R2, R3, R4 in the KG.
And the query which is executed on KG satisfies rule R2. Then in the output i need R2 details (label, conditions etc).

I have a use-case wherein i would like to show my client the power of Grakn Reasoner. From Grakn Visualizer i am able to see the “inferred relationships” by clicking on small circles but i need the Rule details in a query since we are performing lots of operations on query results, and showing many more details(other than related to KG) in our own UI.



Hey Omshanti,

Sorry I haven’t noticed you question earlier.

So internally we have this information as we store the full explanation tree of how an answer was obtained including which rules where applied at which point, to which parts of the query and what kind of information was obtained directly from the db.

The missing bit is mapping this information out in gRPC. We will try to prioritise making it complete as it’s been on our TODO list for a while now.



Thanks @kasper. Eagerly wait for your current TODO list to get empty soon :slight_smile: