Datalog is a programming language for logical inference. It is declarative, which means that it states the required result without describing the steps needed in order to achieve it (the engine executing the program is responsible for deciding what these steps should be).
A Datalog program can consist of any number of individual rules representing first-order logic statements. Each rule is like an “IF… THEN…" sentence.
“If X is a person and X is a parent of Y, then Y is a person”
[?Y, rdf:type, :Person] :- [?X, rdf:type, :Person], [?X, :isParentOf, ?Y].