Computing inside inference rules


I antecipate the aswer is ‘not’, but…let me ask :slight_smile:
Is it possible to do some computation inside rules? Example: I have a transitive relation, with a ‘weight’ resource. I want to diminish the weight each transition; something like

$x isa inference-rule
        $a (super: $f1, sub: $f2) isa f2f;
        $b (super: $f2, sub: $f3) isa f2f;
        $a has weight $w0;
        $b has weight $w1;
    (super: $f1, sub: $f3) isa f2f has weight $w0 * $w1 * 0.9;

Any workaround?
Thanks for help,


Hi Ely,

good question! This is not possible at the moment. Rules are declarative and they shouldn’t have side effects. This said, the particular example you described looks a bit like a certain type of probabilistic inference. We are considering adding similar features. Stay in touch for updates!



Thanks for answer @domenico,
yep, actually this is the core of my problem (probabilistic inference). I’m using a technique called “spread activation” and I was wondering if I could use Grakn to automate the calculus.