a fictional george in sw format
Let's define what we know about a fictional character we call George.
Really is quite simple.
|context> => |context: George>
source |context: George> => |sw-url: http://semantic-db.org/sw-examples/new-george.sw>
-- George is just some fictional character
|person: George> => |word: george>
age |person: George> => |age: 29>
dob |person: George> => |date: 1984-05-23>
hair-colour |person: George> => |hair-colour: brown>
eye-colour |person: George> => |eye-colour: blue>
gender |person: George> => |gender: male>
height |person: George> => |height: cm: 176>
wife |person: George> => |person: Beth>
occupation |person: George> => |occupation: car salesman>
friends |person: George> => |person: Fred> + |person: Jane> + |person: Liz> + |person: Andrew>
mother |person: George> => |person: Sarah>
father |person: George> => |person: David>
sisters |person: George> => |person: Emily>
brothers |person: George> => |person: Frank> + |person: Tim> + |person: Sam>
email |person: George> => |email: george.douglas@gmail.com>
education |person: George> => |education: high-school>
My favourite thing about this example is that it shows we can describe all types of "molecules of knowledge" using 1 line, and all in the format:
OP KET => SUPERPOSITION
One advantage of the 1 line thing is that when we have large sw files, it is trivial to grep down to the rules of interest. I will give an example of that in the future, probably using the IMDB data I have in sw format. Indeed, there is not a single construct in BKO that is multi-line. I think this gives it some power, eg, being able to grep, and easier to parse.
Fine, let's give a simple example:
$ grep "person: Jane" blog-george.sw
friends |person: George> => |person: Fred> + |person: Jane> + |person: Liz> + |person: Andrew>
Now, let's load it up and give the pretty-print display:
sa: load blog-george.sw
sa: display
context: George
context: George
supported-ops: op: source
source: sw-url: http://semantic-db.org/sw-examples/new-george.sw
person: George
supported-ops: op: , op: age, op: dob, op: hair-colour, op: eye-colour, op: gender, op: height, op: wife, op: occupation, op: friends, op: mother, op: father, op: sisters, op: brothers, op: email, op: education
: word: george
age: age: 29
dob: date: 1984-05-23
hair-colour: hair-colour: brown
eye-colour: eye-colour: blue
gender: gender: male
height: height: cm: 176
wife: person: Beth
occupation: occupation: car salesman
friends: person: Fred, person: Jane, person: Liz, person: Andrew
mother: person: Sarah
father: person: David
sisters: person: Emily
brothers: person: Frank, person: Tim, person: Sam
email: email: george.douglas@gmail.com
education: education: high-school
And that's it for now. I was going to put the general people rules here too, but now I will put them in the next post.
Update: now with the magic of tables:
sa: load blog-george.sw
sa: George |*> #=> apply(|_self>,|person: George>)
sa: table[op,George] supported-ops |person: George>
+-------------+--------------------------+
| op | George |
+-------------+--------------------------+
| | george |
| age | 29 |
| dob | 1984-05-23 |
| hair-colour | brown |
| eye-colour | blue |
| gender | male |
| height | 176 |
| wife | Beth |
| occupation | car salesman |
| friends | Fred, Jane, Liz, Andrew |
| mother | Sarah |
| father | David |
| sisters | Emily |
| brothers | Frank, Tim, Sam |
| email | george.douglas@gmail.com |
| education | high-school |
+-------------+--------------------------+
Home
previous: the self ket
next: some general people rules
updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org