Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. (defrule Deleting::ruleDeleteOneSynSoftgoal "This rule delete one synsoftagoal found in the basis of fact."
  2. (declare (salience 42))
  3. (printout t "Enter below the two softgoals field that want to be deleting:" crlf crlf
  4. "the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line." crlf crlf)
  5. (bind ?dsyntype (readline))
  6. (bind ?dsyntopic (readline))
  7. ?fact3 <- (synSoftgoal
  8. (ttId ?ttId3)
  9. (syntopic ?syntopic3)
  10. (syntype ?syntype3)
  11. )
  12. (test (and (eq ?dsyntopic ?syntopic3) (eq ?dsyntype ?syntype3)))
  13. =>
  14. (retract ?fact3
  15.  
  16. )
  17.  
  18. [PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.
  19.  
  20. ERROR:
  21. (defrule Deleting::ruleDeleteOneSynSoftgoal "This rule delete one synsoftagoal found in the basis of fact."
  22. (declare (salience 42))
  23. (printout t "Enter below the two softgoals field that want to be deleting:" crlf crlf "the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line." crlf crlf)
  24. (bind ?dsyntype (
  25.  
  26. CLIPS>
  27. (deftemplate synSoftgoal
  28. (slot ttId)
  29. (slot syntopic)
  30. (slot syntype))
  31. CLIPS>
  32. (deffacts initial
  33. (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  34. (synSoftgoal (ttId 2) (syntopic "A") (syntype "2"))
  35. (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  36. (synSoftgoal (ttId 4) (syntopic "B") (syntype "2")))
  37. CLIPS>
  38. (defrule QueryRule
  39. =>
  40. (printout t "Enter below the two softgoals field that want to be deleting:" crlf crlf
  41. "the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line." crlf crlf)
  42. (assert (dsyntype (readline)))
  43. (assert (dsyntopic (readline))))
  44. CLIPS>
  45. (defrule DeleteRule
  46. ?fact1 <- (dsyntype ?dsyntype)
  47. ?fact2 <- (dsyntopic ?dsyntopic)
  48. ?fact3 <- (synSoftgoal
  49. (ttId ?ttId3)
  50. (syntopic ?dsyntopic)
  51. (syntype ?dsyntype))
  52. =>
  53. (retract ?fact1 ?fact2 ?fact3))
  54. CLIPS> (reset)
  55. CLIPS> (facts)
  56. f-0 (initial-fact)
  57. f-1 (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  58. f-2 (synSoftgoal (ttId 2) (syntopic "A") (syntype "2"))
  59. f-3 (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  60. f-4 (synSoftgoal (ttId 4) (syntopic "B") (syntype "2"))
  61. For a total of 5 facts.
  62. CLIPS> (run)
  63. Enter below the two softgoals field that want to be deleting:
  64.  
  65. the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line.
  66.  
  67. 2
  68. A
  69. CLIPS> (facts)
  70. f-0 (initial-fact)
  71. f-1 (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  72. f-3 (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  73. f-4 (synSoftgoal (ttId 4) (syntopic "B") (syntype "2"))
  74. For a total of 4 facts.
  75. CLIPS> (clear)
  76. CLIPS>
  77. (deftemplate synSoftgoal
  78. (slot ttId)
  79. (slot syntopic)
  80. (slot syntype))
  81. CLIPS>
  82. (deffacts initial
  83. (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  84. (synSoftgoal (ttId 2) (syntopic "A") (syntype "2"))
  85. (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  86. (synSoftgoal (ttId 4) (syntopic "B") (syntype "2")))
  87. CLIPS>
  88. (defrule QueryAndDeleteRule
  89. =>
  90. (printout t "Enter below the two softgoals field that want to be deleting:" crlf crlf
  91. "the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line." crlf crlf)
  92. (bind ?dsyntype (readline))
  93. (bind ?dsyntopic (readline))
  94. (do-for-all-facts ((?f synSoftgoal)) (and (eq ?f:syntopic ?dsyntopic) (eq ?f:syntype ?dsyntype))
  95. (retract ?f)))
  96. CLIPS> (reset)
  97. CLIPS> (facts)
  98. f-0 (initial-fact)
  99. f-1 (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  100. f-2 (synSoftgoal (ttId 2) (syntopic "A") (syntype "2"))
  101. f-3 (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  102. f-4 (synSoftgoal (ttId 4) (syntopic "B") (syntype "2"))
  103. For a total of 5 facts.
  104. CLIPS> (run)
  105. Enter below the two softgoals field that want to be deleting:
  106.  
  107. the synonyms of the <[TYPE]QUALITY ATTRIBUTE> and the <[TOPIC]SUBJECT/OBJECT LAL> need to be entered one per line.
  108.  
  109. 2
  110. A
  111. CLIPS> (facts)
  112. f-0 (initial-fact)
  113. f-1 (synSoftgoal (ttId 1) (syntopic "A") (syntype "1"))
  114. f-3 (synSoftgoal (ttId 3) (syntopic "B") (syntype "1"))
  115. f-4 (synSoftgoal (ttId 4) (syntopic "B") (syntype "2"))
  116. For a total of 4 facts.
  117. CLIPS>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement