Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drools 调用kie api容器时如何使用激活组?_Drools_Jbpm_Rule Engine_Kie_Kie Workbench - Fatal编程技术网

Drools 调用kie api容器时如何使用激活组?

Drools 调用kie api容器时如何使用激活组?,drools,jbpm,rule-engine,kie,kie-workbench,Drools,Jbpm,Rule Engine,Kie,Kie Workbench,我一直试图使用激活组,但我不知道如何从Api rest调用激活组?请帮助我如何在下面的请求中添加激活组 package com.myteam.arduinodevre2; //from row number: 1 rule "Row 1 Rulduino" activation-group "gold" dialect "mvel" when f1 : ArduinoEntity( switchOn == true , voltaj >= 1000 ,

我一直试图使用激活组,但我不知道如何从Api rest调用激活组?请帮助我如何在下面的请求中添加激活组


package com.myteam.arduinodevre2;

//from row number: 1
rule "Row 1 Rulduino"
activation-group "gold"
    dialect "mvel"
    when
        f1 : ArduinoEntity( switchOn == true , voltaj >= 1000 , voltaj < 2000 )
    then
        modify( f1 ) {
                setLightOn( true )
        }
end

//from row number: 2
rule "Row 2 Rulduino"
activation-group "gold"
    dialect "mvel"
    when
        f1 : ArduinoEntity( switchOn == true , voltaj >= 5000.0 , voltaj < 10000.0 )
    then
        modify( f1 ) {
                setLightOn( false )
        }
end

//from row number: 3
rule "Row 3 Rulduino"
activation-group "gold"
    dialect "mvel"
    when
        f1 : ArduinoEntity( switchOn == false )
    then
        modify( f1 ) {
                setLightOn( false )
        }
end

//from row number: 4
rule "Row 4 Rulduino"
activation-group "silver"
    dialect "mvel"
    when
        f1 : ArduinoEntity( switchOn == true , voltaj >= 1.0 , voltaj < 3.0 )
    then
        modify( f1 ) {
                setLightOn( false )
        }
end


我如何使用这类东西来激活我的目标激活组->“激活所有规则”:“silver”,但我无法通过谷歌搜索找到有价值的答案。

你可以从KieSession获得激活组,而不是从KieScontainer获得激活组。您需要从KieSession容器创建KieSession,然后使用KieSession.getAgenda().getActivationGroup(“”.setfocus()方法获取ActivationGroup。您可以选中此项以检查方法返回类型以及与之相关的其他方法。

您可以从KieSession而不是KieScontainer获取ActivationGroup。您需要从KieSession容器创建KieSession,然后使用KieSession.getAgenda().getActivationGroup(“”.setfocus()方法获取ActivationGroup。您可以检查此项以检查方法返回类型以及与之相关的其他方法。

您不调用激活组。你可能指的是一个议程组。您可以在一个议程组上设置焦点,该议程组的所有规则都有资格被解雇

您可以进一步将激活组添加到您的规则中,这将导致该组中只有一个规则被触发

为了从REST API“调用”议程组,您需要如下设置焦点:

{
  "commands": [
    {
      "set-focus": "myAgendaGroup"
    },
    {
      "insert": {
        "object": {
          "com.myteam.arduinodevre2.ArduinoEntity": {
            "switchOn": true,
            "voltaj": 1100
          }
        }
      }
    },
    {
      "fire-all-rules": {}
    }
  ]
}

你不能呼叫激活组。你可能指的是一个议程组。您可以在一个议程组上设置焦点,该议程组的所有规则都有资格被解雇

您可以进一步将激活组添加到您的规则中,这将导致该组中只有一个规则被触发

为了从REST API“调用”议程组,您需要如下设置焦点:

{
  "commands": [
    {
      "set-focus": "myAgendaGroup"
    },
    {
      "insert": {
        "object": {
          "com.myteam.arduinodevre2.ArduinoEntity": {
            "switchOn": true,
            "voltaj": 1100
          }
        }
      }
    },
    {
      "fire-all-rules": {}
    }
  ]
}