aboutsummaryrefslogblamecommitdiffstats
path: root/examples/family.sol
blob: 8d1f7f917555b417f31cea558260109228dc1c56 (plain) (tree)


























                                                                
% 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"]