SlideShare a Scribd company logo
clara-rules
- Cybozu Startups, inc
- Write web apps with
Clojure/ClojureScript
- Since May 2016
- http://qiita.com/iku000888
- http://github.com/iku000888
- https://twitter.com/iku000888
- Rule Engines
- About
- Are good
- Clara-rules
- Facts
- defrule & defquery
- session
- serialization
- Use from Java
- RETE
- Application in UI dev
- http://www.clara-rules.org/
- [com.cerner/clara-rules "0.16.0"]
- Clojure(JVM)
- ClojureScript(Browser etc)
- Historical:
- Shortage of devs
- Let non devs code
domain logic
- Lisp!
- Prolog!
- Branch of AI!
- Failed or not
debate
App
Domain
Logic
Domain
Logic
- ANA case
- JBoss BRMS
- https://japan.zdnet.com/article/35107193/
- ‘作業時間を20〜40%削減’!!
- ‘スクラッチ開発と比較すると約3分の1の低コスト’!!
Layers of functions!
- Responsibility of each layer?
- Border line case?
- Change in function params?
- Brittle!
- Spaghetti!
Controller
DB View
External
Service
Controller
DB View
External
Service
Controller
DB
View
External
Service
session
QueriesRules
Insert Facts
Fire!
Q
u
e
r
y
Q
u
e
r
y
- Anything
- Typically record or Java Class
;; Clojure
(defrecord Item [item-name id price])
//Java
public Class Item{
String itemName etc...
}
- Match with fact(s) in session
- LFS => RHS
- Bind variables (LFS)
- Join with other facts (LFS)
- Create new facts (RHS)
(r/defrule tax-item
[Item (= ?n item-name) (= ?id id) (= ?p price)]
[Tax (= id ?id) (= ?t tax)]
=> (r/insert! (->TaxedItem ?n ?id (+ ?p (* ?p ?t)))))
- Can take parameter
- Accumulators
- Cator to result consumers
(require '[clara.rules.accumulators :as acc])
(r/defquery total
[] ;; Can accept parameter
[?total <- (acc/sum :taxed-price) :from [TaxedItem]])
- App interface
- Immutable: ops return new sessions
- Insert facts
- Fire
- Query Results
(-> (r/mk-session);;defsession also
(r/insert (->Item "fish" "001" 200))
(r/insert (->Tax "001" 0.08))
(r/insert (->Item "milk" "002" 150))
(r/insert (->Tax "002" 0.28))
(r/fire-rules)
(r/query total))
- Advanced
- e.g. Hot load rules from a remote
server
- e.g. Store working session in DB
- e.g. Validate rules with hash
Still write rules/queries in Clojure
Official website:
- Used by many rule engines
- Allows clara-rules to be fast
- RETEII, RETEIII
- ‘Dramatically faster’ for
complex problems
- Proprietary!
- Bummer!
- Makes code clean
- Query -> View(React)
- Events -> Facts
- Instances
- Precept
- Fact UI
clara-rules:
1. Helps keep your code clean
2. Can be used to build cool stuff
3. Compelling excuse to introduce
Clojure for Java/Scala/etc users
http://qiita.com/iku000888/items/72525cd34cd3c0b44b31
Talks:
Clarifying Rules Engines with Clara Rules - Mike Rodriguez
- https://www.youtube.com/watch?v=Q_k5MkZmd-o
"Retaking Rules for Developers" by Ryan Brush
- https://www.youtube.com/watch?v=Z6oVuYmRgkk
Midwest.io 2014 - Rules as a Control Structure - Ryan Brush
- https://www.youtube.com/watch?v=zs5Rueo42TA
clara-rules

More Related Content

PDF
Locarise,reagent and JavaScript Libraries
PDF
"Service Worker: Let Your Web App Feel Like a Native "
PDF
node.js and the AR.Drone: building a real-time dashboard using socket.io
PDF
Drones, Flying robots and Javascript
PDF
Advanced programming with #nodecopter
PDF
Будь первым
PDF
Scalable Angular 2 Application Architecture
PDF
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Locarise,reagent and JavaScript Libraries
"Service Worker: Let Your Web App Feel Like a Native "
node.js and the AR.Drone: building a real-time dashboard using socket.io
Drones, Flying robots and Javascript
Advanced programming with #nodecopter
Будь первым
Scalable Angular 2 Application Architecture
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...

What's hot (20)

PPT
Async programming on NET
KEY
Loadrunner
PDF
Présentation de HomeKit
PPTX
Creating Reusable Puppet Profiles
PDF
Introduction to asynchronous DB access using Node.js and MongoDB
PPTX
ECMAScript 6 and the Node Driver
PDF
Zenly - Reverse geocoding
PDF
非同期javascriptの過去と未来
PDF
Go Mobile with Apache Cordova, Zagreb 2014
PDF
ActionHeroJS Talk
PDF
Spark Jobserver
KEY
Devsumi2012 攻めの運用の極意
PPTX
Mage Titans - Workshop - UI Components
PDF
How to send gzipped requests with boto3
PDF
IoT Best practices
PDF
Map kit light
PPT
JS everywhere 2011
PDF
Building Distributed System with Celery on Docker Swarm
KEY
Node.js - Best practices
KEY
CocoaHeads Toulouse - Guillaume Cerquant - UIView
Async programming on NET
Loadrunner
Présentation de HomeKit
Creating Reusable Puppet Profiles
Introduction to asynchronous DB access using Node.js and MongoDB
ECMAScript 6 and the Node Driver
Zenly - Reverse geocoding
非同期javascriptの過去と未来
Go Mobile with Apache Cordova, Zagreb 2014
ActionHeroJS Talk
Spark Jobserver
Devsumi2012 攻めの運用の極意
Mage Titans - Workshop - UI Components
How to send gzipped requests with boto3
IoT Best practices
Map kit light
JS everywhere 2011
Building Distributed System with Celery on Docker Swarm
Node.js - Best practices
CocoaHeads Toulouse - Guillaume Cerquant - UIView
Ad

Similar to clara-rules (20)

PPTX
QSpiders - Installation and Brief Dose of Load Runner
PDF
Rhebok, High Performance Rack Handler / Rubykaigi 2015
PDF
Load testing with Blitz
PDF
[convergese] Adaptive Images in Responsive Web Design
PDF
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
PPTX
Sherlock Homepage - A detective story about running large web services - WebN...
PPTX
Sherlock Homepage - A detective story about running large web services - NDC ...
PPTX
Sherlock Homepage - A detective story about running large web services (VISUG...
PPTX
Sherlock Homepage (Maarten Balliauw)
PDF
Bringing the JAMstack to the Enterprise
PPTX
Where is my scalable api?
PDF
Advanced technic for OS upgrading in 3 minutes
PDF
Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014
PDF
Client Side Measurement & Performance With Rails
PDF
The Real World - Plugging the Enterprise Into It (nodejs)
PDF
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
PPT
Monitoring using Prometheus and Grafana
PPTX
Solving anything in VCL
PDF
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
PDF
Profiling PHP with Xdebug / Webgrind
QSpiders - Installation and Brief Dose of Load Runner
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Load testing with Blitz
[convergese] Adaptive Images in Responsive Web Design
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - NDC ...
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage (Maarten Balliauw)
Bringing the JAMstack to the Enterprise
Where is my scalable api?
Advanced technic for OS upgrading in 3 minutes
Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014
Client Side Measurement & Performance With Rails
The Real World - Plugging the Enterprise Into It (nodejs)
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
Monitoring using Prometheus and Grafana
Solving anything in VCL
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Profiling PHP with Xdebug / Webgrind
Ad

More from Ikuru Kanuma (20)

PDF
clj and deps.edn
PDF
Kukutei shinkoku with Clojure
PDF
ClojureScript@node
PDF
Welcome to ClojureScript
PDF
Clojure web dev history
PDF
Arachne Unweaved (JP)
PDF
Clojureでガラケーサイトを作る際の細かい話
PPTX
Web forms made easy (with formative)
PDF
サムネイルを作る話
ODP
Review June2015 Dec2015
ODP
Redmine on amazon ec2
ODP
Engineering Ethics (In Japanese)
ODP
First Real Pull Request Ever
ODP
Pyunit
ODP
Review june2014 june2015
ODP
Elementary vim tricks
ODP
Processors in a nutshell
ODP
Computer hardware, and network
ODP
Installing Japanese environment(mozc) on Debian 8 + Mate
ODP
Git for standalone use
clj and deps.edn
Kukutei shinkoku with Clojure
ClojureScript@node
Welcome to ClojureScript
Clojure web dev history
Arachne Unweaved (JP)
Clojureでガラケーサイトを作る際の細かい話
Web forms made easy (with formative)
サムネイルを作る話
Review June2015 Dec2015
Redmine on amazon ec2
Engineering Ethics (In Japanese)
First Real Pull Request Ever
Pyunit
Review june2014 june2015
Elementary vim tricks
Processors in a nutshell
Computer hardware, and network
Installing Japanese environment(mozc) on Debian 8 + Mate
Git for standalone use

Recently uploaded (20)

PPTX
assetexplorer- product-overview - presentation
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
history of c programming in notes for students .pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Download FL Studio Crack Latest version 2025 ?
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
assetexplorer- product-overview - presentation
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Autodesk AutoCAD Crack Free Download 2025
history of c programming in notes for students .pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
17 Powerful Integrations Your Next-Gen MLM Software Needs
CHAPTER 2 - PM Management and IT Context
Digital Systems & Binary Numbers (comprehensive )
Why Generative AI is the Future of Content, Code & Creativity?
Download FL Studio Crack Latest version 2025 ?
Odoo Companies in India – Driving Business Transformation.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
AutoCAD Professional Crack 2025 With License Key
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM

clara-rules