KnowQA

AI-based Document Question Answering · Knowledge Base + rule inference · no NLP, no RAG

Load a document

TXT/MD files are loaded as text, but must use the controlled syntax in “Design & Syntax” (ordinary prose is not understood). CSV tables are also accepted (first column = entity, headers = attributes). Use one fact or rule per line; parse warnings appear below after building.

Knowledge Base

Facts (triples)

Rules & declarations

Ask a question

Evaluate the system

Each test is {"q": question, "a": [expected answers]}. Answers are compared as sets; yes/no/unknown are used for yes/no and unanswerable questions. Edit the JSON to test your own document.

Chosen AI techniques & justification

Knowledge representation: a semantic network of (subject, relation, object) triples with explicit negation, plus if–then rules (Horn-style, with variables). Inference: forward chaining to a fixpoint (transitivity, symmetry, inverse relations, user rules) and default inheritance with exceptions over the is-a hierarchy (nearest ancestor wins, so “penguins cannot fly” overrides “birds can fly”). Search: breadth-first search for the nearest inheriting ancestor, for “how is X related to Y”, and exhaustive search for superlatives.

Why not NLP / RAG? The brief forbids them. This system uses no tokenisation pipelines, stemming, tagging, embeddings, TF-IDF, language models or retrieval-and-generate. Text is mapped to triples by exact template matching on a controlled syntax, and questions are matched to a fixed set of question templates; answers are produced from the symbolic result with answer templates. Symbolic reasoning gives explainable, verifiable answers: every answer carries a proof tree, and the system answers “Unknown” instead of guessing.

Limitations: the document must follow the controlled syntax; questions must fit a supported pattern; conflicting facts at the same inheritance level are not resolved.

Pipeline

Document ─► line/sentence template matching ─► triples + rules ─► forward chaining (closure) ─► Knowledge Base
Question ─► question-template matching ─► query (lookup / inherit / search / compare) ─► answer + proof tree

Document syntax

Dog is a mammal.            (is-a)
Penguin is not a fish.      (negation)
Bird can fly. / Penguin cannot fly.
Mammal has fur.
The capital of France is Paris.
Paris is the capital of France.
Mars has a diameter of 6779 km.
@relation orbits | also: orbit
@relation is part of | transitive
@relation parent of | inverse: child of
@scale diameter | larger, largest | smaller, smallest
@closed     (absent facts are false)
If ?x is a bird then ?x can lay eggs.
If ?x eats ?y and ?y is a fish then ?x is a carnivore.

Question patterns

Is X a Y? · Can X do Z? · Does X have Z?
What is the R of X? · What is X's R?
What/Who <relation> Y? · Which <class> <relation> Y?
What does X <relation>? · Is X <relation> Y?
Is X larger than Y? · Which <class> has the largest R?
What is the largest <class>?
List all <class>s · How many <class>s are there?
How is X related to Y? · What is X?
Why …?  (same as the question; proof always shown)

Evaluation criteria

Exact-match accuracy, precision / recall / F1 over answer sets, coverage (share of questions answered rather than “unknown”), abstention accuracy (unanswerable questions correctly answered “unknown”), and average response time.