⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helloworld.python.drl

📁 drools 一个开放源码的规则引擎
💻 DRL
字号:
<?xml version="1.0"?>

<rule-set name="helloworld"
          xmlns="http://drools.org/rules"
          xmlns:python="http://drools.org/semantics/python"
          xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
          xs:schemaLocation="http://drools.org/rules rules.xsd
                             http://drools.org/semantics/python python.xsd">

  <import>from java.lang import Object</import>
  <import>from java.lang import String</import>

  <python:functions>
    def helloWorld(hello):
        print "%s World" % hello

    def goodbyeWorld(goodbye):
        print "%s Cruel World" % goodbye
  </python:functions>

  <rule name="Hello World">
    <parameter identifier="hello">
      <class>String</class>
    </parameter>

    <python:condition>hello == 'Hello'</python:condition>

    <python:consequence>
      helloWorld(hello)
    </python:consequence>
  </rule>

  <rule name="Goodbye Cruel World">
    <parameter identifier="goodbye">
      <class>String</class>
    </parameter>

    <python:condition>goodbye == 'Goodbye'</python:condition>

    <python:consequence>
      goodbyeWorld(goodbye)
    </python:consequence>
  </rule>

  <rule name="Debug">
    <parameter identifier="object">
      <class>Object</class>
    </parameter>

    <python:consequence>
      print "Asserted object: %s" % object
    </python:consequence>
  </rule>

</rule-set>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -