CLIPS - 如何在创建 defrule 时关联 2 种不同的 detemplates 类型

CLIPS - How to relate 2 different deftemplates types when creating a defrule

我正在使用 CLIPS 6.3 开发一个简单的生产管理算法。 目前我有一个用于产品订单的 detemplate,另一个用于产品详细信息。

(deftemplate orderSheets
  (slot orderID (type INTEGER))
  (slot orderDate (type INTEGER))
  (slot product (type STRING))
  (slot quantity (type INTEGER))
  (slot deliverDate (type INTEGER))
)

(deftemplate productInfoSheets
  (slot productID (type STRING))
  (slot productStock (type INTEGER))
  (slot prodTime (type INTEGER))
  (slot maximumProduction (type INTEGER))
)

我的疑问是如何创建一个规则来关联产品订单数量(在 orderSheets 中可用)与可用库存(在 productInfoSheets 中可用。

感谢您的支持, 琼

这是一个将订单数量与可用库存进行比较的示例规则:

(defrule not-enough
   (orderSheets (quantity ?quantity))
   (productInfoSheets (productStock ?stock))
   (test (> ?quantity ?stock))
   =>)