LHS、OR/AND 运算符中值的可变顺序
我试图通过这种形式定义一个规则:
;Plantilla Ficha de paciente
(deftemplate FichaPaciente
(multifield Nombre)
(field Casado)
(field Direccion))
;Plantilla DatosExploración
(deftemplate DatosExploracion
(multifield Nombre)
(multifield Sintomas)
(field GravedadAfeccion))
;Regla para diagnóstico de Eccema
(defrule DiagnosticoEccema
(DatosExploracion
(and
(Nombre $?Nombre)
(or
(Sintomas $? picor $? vesiculas $?)
(Sintomas $? vesiculas $? picor $?)
)
)
)
(FichaPaciente
(Nombre $?Nombre))
=>
(printout t "Posible diagnóstico para el paciente " $?Nombre ": Eccema " crlf)
)
目标是,如果 DatosExploracion 事实具有带有值 (... picor ... vesicula ...) 或 (... vesicula . ..图)。囊泡和picor的顺序并不重要。
我正在尝试使用“and”和“or”运算符,但收到错误:相应的 deftemplate“DatosExploracion”中未定义无效的插槽“and”。
1 - 为什么 CLIPS 不能像我想要的那样识别 AND 和 OR 运算符?
2 - 是否有更好或更有效的方法来获取Sintomas字段上的值的顺序,这并不重要?
提前致谢。
I'm trying to define a rule by this form:
;Plantilla Ficha de paciente
(deftemplate FichaPaciente
(multifield Nombre)
(field Casado)
(field Direccion))
;Plantilla DatosExploración
(deftemplate DatosExploracion
(multifield Nombre)
(multifield Sintomas)
(field GravedadAfeccion))
;Regla para diagnóstico de Eccema
(defrule DiagnosticoEccema
(DatosExploracion
(and
(Nombre $?Nombre)
(or
(Sintomas $? picor $? vesiculas $?)
(Sintomas $? vesiculas $? picor $?)
)
)
)
(FichaPaciente
(Nombre $?Nombre))
=>
(printout t "Posible diagnóstico para el paciente " $?Nombre ": Eccema " crlf)
)
The goal is that it was not important if a DatosExploracion fact has the field Sintomas with values (... picor ... vesicula ...) or (... vesicula ... picor). Vesicula and picor order it's not important.
I'm trying with the "and" and "or" operators, but i receive the error: Invalid slot 'and' not defined in corresponding deftemplate 'DatosExploracion'.
1 - Why CLIPS don't recognize the AND and OR operators like i wanted?
2 - Is there a better or more efficient way of getting that the order of values on field Sintomas it's non important?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一种方法:
另一种方法是使用辅助函数来减少出现多种症状时的打字量:
Here's one way you can do it:
And another which uses a helper function to reduce the amount of typing when there are multiple symptoms:
我已经通过这种方式达到了目标
,但是如果它是多字段Sintomas的3,4或5个值的无序组合,那就太乏味了。我想是否有更好的方法来使用连接词 |或&以更有效的方式。
I've getted the goal on this way
But if it was a unordered combination of 3,4 or 5 Values for multifield Sintomas, it would be too tedious. I would like if there is a better way to get this using the connectives | or & in a more efficient way.