From e0d1cbdf9ab13d550c689cdc78f4e22897a7539e Mon Sep 17 00:00:00 2001
From: patham9 <patham9@91dfdad4-c543-0410-b26a-7d79dded8189>
Date: Sun, 27 Jul 2014 12:39:08 +0000
Subject: [PATCH] do not add questions to derivation chain, they do not
 propagate truth value and it will lead to isses if a question is used as the
 task. todo: also analyze why second question does not work on issue30.

---
 nars_core_java/nars/storage/Memory.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nars_core_java/nars/storage/Memory.java b/nars_core_java/nars/storage/Memory.java
index 83c8986..5e561c4 100644
--- a/nars_core_java/nars/storage/Memory.java
+++ b/nars_core_java/nars/storage/Memory.java
@@ -317,7 +317,7 @@ public class Memory {
             }
             Stamp stamp = task.getSentence().getStamp();
             ArrayList<Term> chain = stamp.getChain();
-            if (currentBelief != null) {
+            if (currentBelief != null && currentBelief.isJudgment()) {
                 if(chain.contains(currentBelief.getContent())) {
                     chain.remove(currentBelief.getContent());
                 }
@@ -325,14 +325,14 @@ public class Memory {
                 
             }
             //workaround for single premise task issue:
-            if(currentBelief == null && single && currentTask != null) {
+            if(currentBelief == null && single && currentTask != null && currentTask.getSentence().isJudgment()) {
                 if(chain.contains(currentTask.getContent())) {
                     chain.remove(currentTask.getContent());
                 }
                 stamp.addToChain(currentTask.getContent());
             }
             //end workaround
-            if (currentTask != null && !single) {
+            if (currentTask != null && !single && currentTask.getSentence().isJudgment()) {
                 if(chain.contains(currentTask.getContent())) {
                     chain.remove(currentTask.getContent());
                 }
@@ -340,7 +340,7 @@ public class Memory {
             }
             if (!revised) { //its a inference rule, we have to do the derivation chain check to hamper cycles
                 for (Term chain1 : chain) {
-                    if (task.getContent() == chain1) {
+                    if (task.getSentence().isJudgment() && task.getContent().equals(chain1)) {
                         recorder.append("!!! Cyclic Reasoning detected: " + task + "\n");
                         return;
                     }
-- 
GitLab