How Anna's knowledge is built
Anna, the iPhone assistant in fak10, doesn't just keep your sentences, she keeps what they mean. She breaks each sentence into small statements and files them in her knowledge. Here are the basic terms, so that when you try the app you know what you're looking at in the graph and under “Facts”.
A memory palace
Like a memory palace: what you tell Anna, she files as a web of statements and finds it again through the relations. You can walk that web in the “Graph” tab, as shown in the post about the graph.
The four building blocks
- Class (
clsin the code): a concept, such as human, daughter, dog or place. Classes form a ladder upwards: daughter → child → human → person. - Entity (
com, complex): a particular someone or something, such as a person, an animal, a place or an event. An entity is an instance of a class, and there are further statements about it. Your sister is an entity, and so is your dog. - String (
lit, literal): plain text such as a first name, a phone number, an email address or a URL. A string has no class and no facts of its own; it is read, not described. Which relations point to a string is fixed, for example “has first name” or “has phone number”. A date is not a string but a node of its own. - Relation (
rel): the predicate, that is, the relationship, such as “has child”, “lives in” or “has phone number”. Every relation has a node of its own holding what it means, for example what it points to.
There are also, among others, types you don't see: words and grammar that Anna uses to read sentences. The graph doesn't show strings; you find them under “Facts”.
Triples: subject, predicate, object
Every statement in Anna's knowledge has three parts: what it's about (subject), which relation (predicate) and what it points to (object: an entity, a class or a string). Such a group of three is called a triple. “I have a dog. My sister’s mobile number is 0170 …” becomes, for example, these triples:
my dog
entity (com)
↓→is a = instance of
dog
class (cls)
my sister
entity (com)
↓→has mobile number
“0170 …”
string (lit)
dog
class (cls)
↓→specifies
animal
class (cls)
“is a” means: the entity is an instance of this class. One sentence often yields several triples, and one triple can come from several sentences. Each triple carries more than its three parts:
- Source and further witnesses: where it came from (you, a document, the big AI, or Anna's own conclusion). Further sources can confirm or dispute it, each with its own note on when it held according to them (“yesterday”).
- Time of the statement and, where needed, a probability.
- Review status: whether you have confirmed it. Whatever the big AI suggests waits under “Review”.
- Negation: “I don't like dogs” is the same triple with the opposite meaning.
- Modality: can, want to, must, may, like to, will, intend to.
- Tense: “I had a dog” is past tense.
- Manner: “speaks German fluently” is one “speaks” with “fluently”, not a predicate of its own.
- Dependence on another statement, with its kind: because, if/then, that, although, when/while, so that, in order to. That is a statement about a statement.
What does this have to do with RDF and the Semantic Web?
The idea is best known from the Semantic Web. Its base format, RDF, describes the world in exactly this way: as triples of subject, predicate and object. Entities are called resources there, fixed values such as strings are called literals. RDFS and OWL add classes, subclasses and rules for relations. Anna's terms map onto that quite closely:
- com corresponds to a resource (entity), lit to a literal (string).
- “is a” (instance of) corresponds to
rdf:type, “specifies” (dog under animal) tordfs:subClassOf. - What a relation means is stored as ordinary triples on its own node, as with
rdf:Property: what it points to (rdfs:range), what it starts from (rdfs:domain), which more general relation it sits under (rdfs:subPropertyOf: “has daughter” is a “has child”). - Inverses, transitivity, chains and mutually exclusive classes are known in OWL as
owl:inverseOf,owl:TransitiveProperty, property chains andowl:disjointWith. OWL, like Anna, calls an identitysameAs.
What is a reasoner?
A reasoner is a program that concludes new statements from existing ones, following fixed rules. Anna's reasoner runs on your iPhone, in the background, and gets to work as soon as new statements come in. Among other things, here's what it does today:
- Classes from relations: “I live in …” always points to a place. So Anna knows the target is a place, even if you never said so.
- Chains: a parent's parents are grandparents, a parent's siblings are aunts or uncles.
- Transitivity: an ancestor of an ancestor is an ancestor too. The same holds for “is older than”, as shown in How Anna understands relations.
- Getting more precise: “has child” and the child is female, then “has daughter” holds. The other way round, “has daughter” means the child is female, if that was still open.
- The same person? If two people share first and last name, Anna suggests they are one. That's a suggestion; you decide.
- Still going: if something has begun and has no end, Anna suggests it is still going on.
Some things Anna only concludes while reading, without storing them: the inverse (“My sister is older than me” becomes “I am younger than my sister”), more general relations (“has child” also finds the daughters) and the ladder of classes upwards. What the reasoner does store carries its origin: it is entered as the source. For chains and transitivity: if the basis goes, the conclusion goes too.
A reasoner only applies rules Anna knows. Where it is unsure, it suggests, or marks an estimate as an estimate. A missing connection doesn't mean there isn't one.
If you want to join: To the beta