1 ;; clyde.el - Example of scholium seach using a classic semantic network
3 ;; Copyright (C) 2013 Raymond S. Puzio
5 ;; This program is free software: you can redistribute it and/or modify
6 ;; it under the terms of the GNU Affero General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU Affero General Public License for more details.
15 ;; You should have received a copy of the GNU Affero General Public License
16 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ;; See http://arxana.net/semnet.jpg for a vital map.
24 (load-file "bootstart.el")
25 (load-file "search.expanded.el")
27 ;; We enter the semantic net in node by node.
29 ;; Start with "ground"
30 (setq article-list
'(1 (0 (0) () (0))))
34 (ins-nod (get-gnd) 'CLYDE
(get-gnd))
37 (ins-nod (get-gnd) 'ROBIN
(get-gnd))
40 (ins-nod (get-gnd) 'BIRD
(get-gnd))
43 (ins-nod (get-gnd) 'OWN1
(get-gnd))
46 (ins-nod (get-gnd) 'NEST1
(get-gnd))
49 (ins-nod (get-gnd) 'OWN
(get-gnd))
52 (ins-nod (get-gnd) 'OWNERSHIP
(get-gnd))
55 (ins-nod (get-gnd) 'SITUATION
(get-gnd))
79 ;; each of the components -- whether nodes or links -- is represented using a similar syntax
80 ;; 16 at the start of the list represents the next available identifier
91 (8 (0) SITUATION
(0 15))
92 (7 (0 15) OWNERSHIP
(0 14))
94 (5 (0 13) NEST1
(0 12))
95 (4 (0 14 12 11) OWN1
(0))
97 (2 (0 10) ROBIN
(0 9))
98 (1 (0 9) CLYDE
(0 11))
99 (0 (0 8 7 6 5 4 3 2 1) nil
(0 8 7 6 5 4 3 2 1)))
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
103 ;; What sort of entity can something be in this example? (I.e. what kind of nodes do `isa' links point to?)
104 ;; This `lambda' makes a predicate on the fly.
105 ;; Send Ray a Trello screenshot for a use case
106 (search '(((a (lambda (x)
120 (search '(((a (lambda (x)
125 (ROBIN BIRD OWN OWNERSHIP SITUATION
)
127 ;; What does Clyde own?
128 ;; (This could be written [clyde owns ?] but the macro expansion language would have to know that ownership is stored in two parts here.)
130 (search '(((a (lambda (x) (equal x
'CLYDE
)))
131 (b (lambda (x) (equal x
'owner
)))
133 (d (lambda (x) (equal x
'ownee
)))
135 (f (lambda (x) (equal x
'isa
)))
136 (g (lambda (x) (equal x
'OWNERSHIP
))))
144 (((g 7) (f 14) (e 5) (d 12) (c 4) (b 11) (a 1)))
149 (search '(((a (lambda (x) (equal x
'CLYDE
)))
150 (b (lambda (x) (equal x
'owner
)))
152 (d (lambda (x) (equal x
'ownee
)))
154 (f (lambda (x) (equal x
'isa
)))
155 (g (lambda (x) (equal x
'OWNERSHIP
))))