[6de8ee]: examples / findall / README.txt  Maximize  Restore  History

Download this file

30 lines (23 with data), 1.0 kB

 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
This is a small example of the 'forall' clause used to gather a list of
answers in both forward-chaining and backward-chaining rules.

The forward-chaining and backward-chaining rules are in two different .krb
files showing examples of use of the 'forall' clause in both cases.

Rather than finding individual siblings and cousins, these rules find all
siblings and all cousins and assert them in a single fact (as a tuple).

    >>> import driver

    # uses fc_findall.krb
    >>> driver.fc_test()
    egon has ('harald', 'claudia') as cousins
    ralf has ('harald', 'claudia') as cousins
    hilde has () as cousins
    diethelm has () as cousins
    harald has ('egon', 'ralf') as cousins
    claudia has ('egon', 'ralf') as cousins

    # uses bc_findall.krb
    >>> driver.bc_test()
    egon has ('harald', 'claudia') as cousins
    ralf has ('harald', 'claudia') as cousins
    hilde has () as cousins
    diethelm has () as cousins
    harald has ('egon', 'ralf') as cousins
    claudia has ('egon', 'ralf') as cousins

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks