惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - lonecloud

联通云主机安装openclaw 可食用教程 win10 出现你的设备有工作或学校账户方面的问题,请再次登录以访问组织资源 解决MAC升级系统后,GIT报错missing xcrun Git 在Mac下的中文乱码问题 记一个使用fyne-cross编译的坑 windows gcc 遇到的问题解决 Git 提交界面中文乱码解决 WARNING: IPv4 forwarding is disabled. Networking will not work. postgresql数据类型 Mybatis源码-详解Mybatis日志设计 JDBC 规范中文版 4.2- 第五章 类和接口 JDBC 规范中文版 4.2 -第四章 概览 JDBC 规范中文版 4.2 -第三章 新特性 JDBC 规范中文版 4.2 -第二章 目标 JDBC 规范中文版 4.2 -第一章 简介 基础回顾-线程的几种状态 一文读懂BeanFactory和FactoryBean区别 IDEA技巧-自动导包(Auto import)以及自动优化包 Drools学习教程 - 3. 规则属性
Drools学习教程 - 2. 规则文件语法
lonecloud · 2020-02-22 · via 博客园 - lonecloud

规则文件内容

关键词

关键字 描述
package 包名,逻辑上的管理,在进行Kbase加载的时候可以使用到
import 规则引用问题,导入类或者方法
global 全局变量,使用时候需要单独定义变量类型
function 自定义函数
queries 查询
rule 规则开始,参数是规则的唯一名称
rule 规则属性,是rule与when之间的一些参数,为可选项
when 规则条件部分,默认为true
then 规则的结果部分
end 规则结束

绑定变量

由于在规则运行时可能需要绑定一些变量,而如果传递多个对象时候,如何进行一一绑定呢?那么该功能就出现了

rule "pattern-demo"
    when
      /**表示要符合才会执行**/
      $p1:Person(name=="小米") $p2:Person(name=="小明")
    then
       System.out.println($p1);
       System.out.println($p2);
end

语法: [绑定变量名:Object(Field约束)]

上面的说明:将Person中名字为小米的赋值给$p1变量

逻辑计算

  • 逻辑计算 :+ - * /
  • 取余计算注意需要使用括号包裹:%
  • contains |not contains :是否包含
  • memberOf |not memberOf 是否为某个集合中的一员
  • matches |not matches 正则匹配

注释

  • 单行注释 //
  • 多行注释 /***/