Tim's Weblog
Tim Strehle’s links and thoughts on Web apps, software development and Digital Asset Management, since 2002.
2003-12-01

Inference in Topic Maps using tolog

Fascinating - Topic Map Inference rules in tolog:

"The parent-of rule parent-of($A, $B) :- { parenthood($B : child, $A : mother, $F : father) | parenthood($B : child, $M : mother, $A : father) }.

What this rule says is that A is the parent-of B if A is either the mother or father of B. After evaluation this rule becomes a predicate like any other, available to all queries, and to the definition of other rules.

This means that we could now rewrite the query that found my parents using this rule, and get exactly the same results.

Querying with rules parent-of($P, lmg)?

As you can see, the query becomes much simpler and more direct using this simple rule, and this applies to the other rules discussed above. Below they are defined, built on this simple rule.

The rest of the rules grandfather-of($A, $B) :- parent-of($A, $C), parent-of($C, $B).

uncle-of($A, $B) :- parent-of($ASIBLING, $B), parent-of($GP, $ASIBLING), parent-of($GP, $A).

descendant-of($A, $B) :- { parent-of($A, $C), descendant-of($C, B) | parent-of($A, $B) }.

As you can see, these rules are pretty straightforward to define, and easy to understand and use. Yet they make a great difference in how you query this topic map."