A sandbox of sorts.
Go to file
Kyle Isom b51e9456c6 misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
.vscode algotune: finish library. 2018-04-12 21:25:17 -07:00
adsep/chapter01 adsep: some lunch progress 2018-04-10 12:23:09 -07:00
bitwise bitwise: ion release doesn't need a different target name 2018-03-28 06:59:23 -07:00
blue-pill blue-pill: copying linker script over 2018-03-12 22:48:05 -07:00
data misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
default misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
django/mysite django: finish tutorial 2018-06-05 15:41:49 -07:00
doc misc/kforth: Add link to tag. 2018-06-05 15:41:47 -07:00
lpn Start chapter 6. 2018-01-25 17:57:27 -08:00
misc misc/numworks: add echelon script for numworks. 2018-06-05 15:41:49 -07:00
ods ods: update data automakefile 2018-03-07 16:03:01 -08:00
par par: add proplogic 2018-04-07 01:58:49 -07:00
pc misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
pio/nrf52/test01 pio: start platformIO projects 2018-04-27 07:54:33 -07:00
practical_prolog/1-db-design Add practical prolog start. 2018-02-07 07:24:57 -08:00
uc Initial import. 2018-01-16 09:46:44 -08:00
v1 misc/kforth: Move previous work to v1. 2018-06-05 15:41:30 -07:00
.gitignore django: starting the django tutorial 2018-06-05 15:41:49 -07:00
Makefile misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
README.md misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
README.rst Link to sketchbooks, devlog, and notebook. 2018-06-05 15:41:49 -07:00
__init__.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
actions.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
defs.h misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
eval.c misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
eval.h misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
kb.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
kf.c misc/kforth: Fix a bunch of bugs from part 0x08. 2018-06-05 15:41:42 -07:00
sample.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
stack.c misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
stack.h misc/kforth: Restart the world. 2018-06-05 15:41:35 -07:00
stats.txt misc/kforth: Adding stats. 2018-06-05 15:41:05 -07:00
test_actions.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
test_kb.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
util.py misc/aqe: Initial import. 2018-06-05 15:41:49 -07:00
word.c misc/kforth: Fix a bunch of bugs from part 0x08. 2018-06-05 15:41:42 -07:00
word.h misc/kforth: Fix a bunch of bugs from part 0x08. 2018-06-05 15:41:42 -07:00

README.md

AQE: A Query Engine

This is an implementation of a knowledge base, hacked together in Python 3 (it won't work in Python 2 for reasons of modules) for now to quickly iterate on ideas.

There are a few key points:

  • A KnowledgeBase contains facts.
  • A fact is a tuple: (relationship, subject, object). For example, ('is', 'sky', 'blue').
  • A KnowledgeBase has three core methods: ask, retract, and tell.
  • The ask method queries the KnowledgeBase to ascertain whether a fact is true. Either the subject or the object may be None, in which case all satisifiable facts are returned.
  • The retract method tells the KnowledgeBase that the fact is no longer true. If it's rainy, we might retract our fact about the sky being blue.
  • The tell method tells the KnowledgeBase that the fact is now true. For example, if it's rainy (and we've retracted the previous 'sky is blue' fact), we might tell the KnowledgeBase that ('is', 'sky', 'grey').
  • A KnowledgeBase can also perform substitutions.
  • An action contains positive and negative preconditions, retractions, and updates. The positive condition list contains facts that must be true for a knowledge base, and the negative condition list contains facts that must be false. If these preconditions hold, the retractions are applied, followed by the updates.
  • See test_actions.py for an example.

Limitations

  • Singleton facts aren't supported; that is, there is no way to make a KnowledgeBase assert that there is only one relationship → subject mapping. For example, the KnowledgeBase will admit that ('is', 'shrödingers cat', 'alive') and `('is', 'schrödingers cat', 'dead') are both true simultaneously.

TODO

  • Rewrite in C++?