Monday 14 December 2015

semantic networks in BKO

Reading over on wikipedia about semantic networks. Thought I would give a brief comparison with BKO.

Let's start with this LISP:
(defun *database* ()
'((canary  (is-a bird)
               (color yellow)
               (size small))
   (penguin (is-a bird)
                  (movement swim))
   (bird    (is-a vertebrate)
               (has-part wings)
               (reproduction egg-laying))))
Now in BKO:
----------------------------------------
|context> => |context: semantic network>

is-a |canary> => |bird>
color |canary> => |yellow>
size |canary> => |small>

is-a |penguin> => |bird>
movement |penguin> => |swim>

is-a |bird> => |vertebrate>
has-part |bird> => |wings>
reproduction |bird> => |egg-laying>
----------------------------------------
Anyway, I obviously prefer my notation. For one it is uniform, ie all in form OP KET => KET. And unlike LISP, the grep of any valid sw file, is itself a valid sw file. A small thing, but sometimes useful. eg, if you have a big file and you only need a subset of the operators, using grep you can shrink it to a more manageable file size. The other thing is that in BKO we can effectively have a list on the right hand side (ie a superposition), and further, associate floats with each element in that list. Presumably this is harder in LISP.

Next, the wikipage has this image:
So, let's cast this to BKO:
----------------------------------------
|context> => |context: semantic network example>

has |Mammal> => |Vertebra>
is-an |Mammal> => |Animal>

is-a |Cat> => |Mammal>
has |Cat> => |Fur>

is-a |Bear> => |Mammal>
has |Bear> => |Fur>

is-a |Whale> => |Mammal>
lives-in |Whale> => |Water>

is-an |Fish> => |Animal>
lives-in |Fish> => |Water>
----------------------------------------
And then graphviz this sw we get:

No comments:

Post a Comment