From 792ad6fbfaeffd38cb799dbd8cf222337ea6f701 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Thu, 21 Aug 2025 15:02:03 +0100 Subject: [PATCH] Strong suspicion I've made the same changes on Ploughwright and on Mason But I'll get them all into Git then sort them out. --- test/dengine/test_kb.clj | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/dengine/test_kb.clj b/test/dengine/test_kb.clj index d341ba5..4ee74a4 100644 --- a/test/dengine/test_kb.clj +++ b/test/dengine/test_kb.clj @@ -2,7 +2,7 @@ "Knowledge base to use in testing." (:require [arboretum.dengine.case :refer [make-case]] - [arboretum.dengine.core :refer [add-dtree! add-feature!]] + [arboretum.dengine.core :refer [add-dtree!]] [arboretum.dengine.feature :refer [make-feature]] [arboretum.dengine.kb :refer [!kb]] [arboretum.dengine.node :refer [make-node]] @@ -12,7 +12,7 @@ (def testkb (KBImpl. {:case-1 - (make-case :case-1 "Mrs Norah Trellis" + (make-case :case-1 "Mrs Norah Trellis" {:married {:value true :authority :user :reason "I have been told that married is true of Mrs Norah Trellis"} @@ -37,7 +37,20 @@ (reset! !kb testkb) -(add-feature! "Is entitled to Widows' Allowance" :is-entitled-to-widows-allowance false nil) +;; TODO: +;; we can't add a node in `add-feature!` since creating the root node requires +;; that the feature already exists. So the 'rootnode' argument to `add-feature` +;; and make-feature is not useful and should be deleted. We also need to test +;; when adding a dtree to an existing feature that the rootnode references that +;; feature. + +;; OK, it's worse than that. We can't persist and restore a knowledge base in +;; which features are directly linked from DTree nodes, since then we would +;; (probably) create multiple copies of the feature when reloading. So probably +;; the node should only hold the id of the feature, not a direct link. + +;; This does mean, however, that the node could be made at feature creation +;; time. (add-dtree! :is-entitled-to-widows-allowance (make-node :is-entitled-to-widows-allowance false @@ -65,7 +78,7 @@ "Although your late husband's contributions were sufficient, we understand you have a pension.") (list (make-node :under-pension-age-when-bereaved true "Because you were under pensionable age when bereaved, you are entitled to Widows' Allowance") - (make-node :husband-not-entitled-to-cata-rp true - "Because your husband was not entitled to a Category A Retirement Pension, you are entitled to Widows' Allowance"))))))) + (make-node :husband-not-entitled-to-cata-rp true + "Because your husband was not entitled to a Category A Retirement Pension, you are entitled to Widows' Allowance"))))))) (pp/pprint @!kb)