【问题标题】:Drools Collection IterationDrools 集合迭代
【发布时间】:2017-11-18 00:59:15
【问题描述】:

这条规则有什么问题。

rule "Organization Employee Rule"
    when

        $company: CompanyFact( $emp: /employeeList{organizationName== "XYZ"})

    then
        System.out.println("Employee in organization" +$emp);
end

我在尝试运行此规则时遇到此错误。

[ERR 102] 第 23:44 行规则“组织员工规则”中的输入“{”不匹配

CompanyFact 有 Employee 列表,而 Employee 有 String 组织名称。

【问题讨论】:

    标签: drools business-rules


    【解决方案1】:

    如果你使用 Drools 7.x,他们changed the OOPath syntax to make it closer to XPath

    尝试使用方括号而不是大括号:

    rule "Organization Employee Rule"
    when
        $company: CompanyFact( $emp: /employeeList[organizationName== "XYZ"])
    then
        System.out.println("Employee in organization" +$emp);
    end
    

    希望对你有帮助,

    【讨论】:

      猜你喜欢
      • 2011-04-25
      • 1970-01-01
      • 2021-10-22
      • 2015-12-17
      • 2012-07-07
      • 2017-03-10
      • 2012-04-02
      • 1970-01-01
      相关资源
      最近更新 更多