Added some sample data for the death of Caesar example

This commit is contained in:
Simon Brooke 2020-04-23 01:55:24 +01:00
parent fdd0b477e7
commit 180b57b09a
3 changed files with 45 additions and 2 deletions

View file

@ -68,3 +68,5 @@ This means that every implementation of the `wildwood.knowledge-accessor/Accesso
## Thoughts on the shape of a knowledge base
The object of building Bialowieza as a library is that we should not constrain how applications which use the library store their knowledge. Rather, knowledge accessors must transduce between the representation used by the particular storage implementation and that defined in `wildwood.schema`. However, what we've described above suggests that a hierarchical database would be a very natural fit for knowlege base data - more natural, in this case, than a relational database.

View file

@ -25,10 +25,9 @@
side - be able to consume and emit natural language, but that functionality
does not need to be part of the wildwood library, and certainly does
not need to be part of the default advocate as specified here."
(:require [wildwood.knowledge-accessor :refer []]
(:require [wildwood.knowledge-accessor :refer [Accessor]]
[wildwood.schema :refer [proposition? argument?]]))
(defprotocol Advocate
(record [self proposition value]
"Pass a `proposition` with a determined `value` to me, in order that

42
src/wildwood/caesar.clj Normal file
View file

@ -0,0 +1,42 @@
(ns wildwood.caesar
"A dummy set of advocates and knowledge accessors with knowledge about the
death of Julius Caesar."
(:require [wildwood.knowledge-accessor :refer [Accessor]]
[wildwood.advocate :refer [Advocate]]))
(def ides-of-march
"16th March, 44BC"
(+ -440000 300 16))
(def march
"The month of March, 44BC, as a range."
(sort [(+ -440000 300 1) (+ -440000 300 30)]))
(def april
"The month of April, 44BC, as a range."
(sort [(+ -440000 400 1) (+ -440000 400 30)]))
(def drusila-kb
"Drusila knows that Longus killed Caesar in the forum. She keys it on all three, for efficiency
of retrieval."
{:caesar [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}]
:longus [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}]
:forum [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}]})
(defn faldo-db
"Falco knows that Caesar has been killed, but doesn't know who by or when."
{:caesar [{:verb :killed :object :caesar :location :forum}]
:brutus [{:verb :killed :object :caesar :location :forum}]
:forum [{:verb :killed :object :caesar :location :forum}]})
(def gaius-db
"Gaius knows that Brutus killed him, but thinks it happened in April."
{:caesar [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}]
:brutus [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}]
:forum [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}]})
(def marc-anthony-kb
"Mark Antony knows that Brutus is honourable."
{:brutus [{:verb :is :subject :brutus :object :honourable}]})