clips

CLIPS accessing a property of a property

二次信任 提交于 2020-01-07 00:56:09
问题 I read in this SO answer that it is better to explicitly retrieve the slot value by matching it rather than using the slot accessor as this will cause the condition to be reevaluated whenever the slot value changes What if I want to access the property of a property? For example, given two instances a and b of classes A and B , respectively. a has a property called ref_to_b which is a reference to b . b has a property called some_prop_of_b . How do I match the following: a with ref_to_b equal

How exactly (refresh) works in the clips?

 ̄綄美尐妖づ 提交于 2020-01-06 15:10:14
问题 I want to rematch the rule when using CLIPS. But the refresh command doesn't work well every time. So I did some test but still confused about it. Q1: can (refresh) work with those rules modifing facts? I create a .CLP: > (defglobal ?*lock* = 0) > > (deftemplate counter > (slot number)) > > (deffacts initial-data > (counter (number 0))) > > (defrule rule-1 > ?f<-(counter (number ?x)) > (test (= ?*lock* 0)) > => > (printout t "counter number1" crlf) > (bind ?*lock* (+ ?*lock* 10)) > (modify ?f

get FACT_ADDRESS data type when get fact list from CLIPS

自闭症网瘾萝莉.ら 提交于 2020-01-06 08:18:13
问题 I embed CLIPS into C Language. and have code: main{ DATA_OBJECT factlist; int end,i; void *multifieldPtr; char *tempPtr; InitializeEnvironment(); Load("constructs.clp"); Reset(); GetFactList(&factlist,NULL);//send facts from clips to c application. end=GetDOEnd(factlist); printf("end=%d\n",end); printf("Lengthis%d\n",GetDOLength(factlist)); multifieldPtr=GetValue(factlist); printf("%d\n",end); for (i = GetDOBegin(factlist); i <= end; i++){ printf("i=%d\n",i); if (GetMFType(multifieldPtr,i) ==

CLIPS Error:Template xxx does not exist for assert

半腔热情 提交于 2020-01-06 05:46:09
问题 CLIPS version: 6.31 language: c++ clips C API Why am I getting this error? How should I fix this error? [FACTRHS1] Template be-contact-model.riskLevel does not exist for assert. Function load-facts encountered an error The process is as follows: Firstly, I create a CLIPS environment from the full clips rule code using the ClipsEnvLoadFromString function, I will get a normal result in this CLIPS environment using the EnvLoadFactsFromString function.Next I want to copy more than one CLIPS

expected the beginning of a construct error

匆匆过客 提交于 2019-12-25 16:57:49
问题 When I run system, it shows error "expected the beginning of a construct" .. how can I correct this mistake my rules look like this (defrule UFP (not (repair ?)) ?f <- (rule1) => (retract ?f) (printout t "Finish UFP (y/n) yes> go to rule 10 - Advise : Select your major No> go to rule 2 - Advise : please finish all the levels of UFP to enter your major q>Exit system" crlf) (bind ?response (check-YNoptions-input)) (if (eq ?response y) then (assert (rule10)) ) (if (or(eq ?response q) (eq

CLIPS Expected beginning of construct

与世无争的帅哥 提交于 2019-12-25 10:57:08
问题 I have the next code: (deftemplate person (multislot name) (multislot stazh-raboty) (multislot date-of-birth) (multislot dekretny-otpusk) (slot kategoriya) (multislot dolzhnost) (multislot date-attestacii) (multislot date-kvalifikacii) (slot kvalif-uroven)) (deftemplate na-attestaciyu (slot name) ) (deftemplate real-date (multislot rdate) ) (assert (person (name "Abramova Elena Viktorovna")(stazh-raboty 2017 3 2)(date-of-birth 1991 1 16)(dekretny-otpusk 2017 3 2)(kategoriya "specialist")

CLIPS: Unable to proceed after inputting choice

孤街醉人 提交于 2019-12-25 07:39:42
问题 I'm trying to create a diagnosis expert system. I have managed to create the menu and submenu but after inputting my choice(e.g 1). The question that supposed to be asked after the submenu does not appear. Hence not being able to continue. I would like to ask whether is there anything wrong with what I did? If there is, what is the proper way to do it? Here's a part of the code for reference: CLIPS> ;; MainMenu (defrule Menu (not (iffoundChoice ?)) => (printout t crlf crlf crlf "Choose one of

CLIPS constant compiler directive

≯℡__Kan透↙ 提交于 2019-12-25 00:37:52
问题 Similar to the compiler directive for constants in C, is there a way I can do the following in CLIPS? #define INFINITY 1000000000 (deftemplate foo (slot num (type INTEGER) (default INFINITY)) ) ... (defrule bar (foo (num INFINITY)) => ... ) 回答1: You can define a global variable and treat it as a constant: CLIPS> (defglobal ?*INFINITY* = 1000000000) CLIPS> (deftemplate foo (slot num (type INTEGER) (default ?*INFINITY*))) CLIPS> (defrule bar (foo (num ?num&:(eq ?num ?*INFINITY*))) =>) CLIPS>

When embedding CLIPS into C Language, what function can used to modify the fact from C program

自闭症网瘾萝莉.ら 提交于 2019-12-24 03:22:37
问题 I have embedded CLIPS into C Language program, I want to modify the facts for example change a certain slot value, which function can I use from C language Program. Otherwise I have to clean all the facts and assert new facts to implement my goal. Thanks for any idea and suggestions 回答1: Section 4.4 of the Advanced Programming Guide, http://clipsrules.sourceforge.net/OnlineDocs.html, has a list of functions that can be used on facts. The fact-set queries and distributed actions in section 12

Checking the input to match fact in Clips

懵懂的女人 提交于 2019-12-13 21:26:08
问题 I have a problem with trying to get an input and fact-check it with symptoms in the asserted facts. (deftemplate disease (slot name) (multislot symptom )) (assert (disease (name nitro-def) (symptom stunted-growth pale-yellow reddish-brown-leaf))) (assert (disease (name phosphor-def) (symptom stunted-root-growth spindly-stalk purplish-colour))) (assert (disease (name potassium-def) (symptom purple-colour weakened-stems shriveled-seeds))) (defrule reading-input (disease (name ?name1) (symptom