blob: 200b0af489b42f43491184b2ef8229b9e15442d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
% Relations, facts, rules, joins and negation.
Relation named: Person schema: #(
[name domain: String]
[age domain: Integer]
)
[Person name: "Marcos" age: 30]
[Person name: "Ana" age: 12]
[Person name: "Rui" age: 70]
Rule name: "an adult is a person of age at least 18"
head: [Adult name: N]
body: [Person name: N age: A] :and
[GreaterEqual left: A right: 18]
% Everyone stored.
Query expression: [Person name: N age: A]
% The rule, joined through the shared variable N.
Query expression: [Adult name: N]
% Decidable denial: people who are not adults.
Query expression: ([Person name: N age: A]) :not [Adult name: N]
% The specification's negation form, scoped by the universe.
Query expression: [World] :not [Adult name: "Ana"]
World
|