Rules

In the context of knowledge graphs and semantic reasoners, a rule is like a statement that adds meaning to the database. It helps the system understand and connect different pieces of information.

A rule represents an 'if-then' statement. For instance:

If ?x has a parent ?y and ?y has a brother ?z, then ?x has an uncle ?z.

These rules are expressed using datalog, which has the following format:

[?x, :hasUncle, ?z] :-
[?x, :hasParent, ?y],
[?y, :hasBrother, ?z].

In this format, the left-hand side of the :- operator is the rule head (the 'then' part), and the right-hand side is the rule body (the 'if' part).

Essentially, this rule implies that if both conditions, [?x, :hasParent, ?y] and [?y, :hasBrother, ?z], are satisfied, then the condition [?x, :hasUncle, ?z] is also true.

Down arrow icon.