212:– The programming model of KRL has identity as a core feature. KRL programs execute on behalf of a particular entity. The idea of entity is built into the underlying semantics of the language. The entity orientation of KRL is supported by the underlying KRE (Kynetx Rules Engine) and so is usable by any program running in the engine—even one not written in KRL. The next two features illustrate why identity is crucial to the programming model.
224:
Events are rarely addressed to a specific ruleset. Rather events are raised on behalf of a particular entity and thus any rule selected from the entity's installed rulesets runs on behalf of that same entity. This concept is called “salience.” An event is salient for a given entity if that entity has
238:
over the ruleset they are in, meaning that they are only visible to code executing within the ruleset. Application variables are stored for the ruleset and are available to any entity executing the ruleset. Entity variable values are only visible to the entity for whom they were stored. Application
394:
At its simplest, a rule is a conditional action. The action can be anything appropriate to the domain. For augmenting web pages, actions are page modifiers. In other domains, the action can be whatever the endpoint can consume. When a rule's action is taken, we say that the rule "fired." Note that
441:
Notifications are data transfers, not transfers of execution control. This is one of the hallmarks of evented systems that distinguishes them from other types of systems. Interrogatory-style systems use a request-response mode of interaction: “Will you do this?” Imperative-style systems use an
250:
Entity variables, in particular, are a very powerful concept since they provide KRL programmers with the ability to store persistent values without the headache of configuring, linking, and using a database for most things. Because a ruleset represents a closure over its entity variables, every
449:
Because they are declarative, event notifications impose the semantics of what an event means on the processor rather than a generator. The event generator doesn’t know how a given processor will interpret the event. What’s more, it is not even required that an event processor take any action
406:
The second stage of the conditional firing of the rule is testing its premise, which consists of a predicate that is used to test the context in which the rule is being evaluated. This check is done after the rule's prelude section, where values are declared, so that it has the benefit of any
345:
KRL events are raised by other rules of event generators commonly referred to as "endpoints". Events are commonly raised over HTTP using a model that conforms to the
Evented API, but KRL is transport agnostic. For example, events could be transported by email, SMS, MQTT, or any other system
407:
computation needed to create or manipulate the context. The predicate of the conditional is optional, so it is possible to write a rule that always fires because its selector always selects. However, most interesting rulesets will contain rules that only fire under certain circumstances.
221:– rules in KRL bind event patterns to actions. Event patterns are specified using event expressions. Events and actions are both extensible so that programmers are free to define events and actions that are relevant to their problem space.
402:
keyword in the rule. For example, in the web domain, this most often consists of a regular expression to match with the URL of the page being augmented. Thus, in the first stage the rule is selected only for certain web pages.
356:
An endpoint that generates an event may be observing some activity directly and reporting salient state changes or it might just be reporting or transforming event data from another source (e.g., a webhook).
276:– Conditions are similar to the safety of a gun. If the conditional expression does not return true, the rule does not fire. Just as a gun either shoots or doesn't shoot based upon the safety, there is no
147:
programming language for creating applications on the Live Web. KRL programs, or rulesets, comprise a number of rules that respond to particular events. KRL has been promoted as language for building
353:
KRL uses event channels to identify the entity for which the event is raised. An entity can have any number of event channels. Event channels are encoded in the URL for events transported over HTTP.
312:
rule <name> { select when <eventexpr> pre { <declarations> } if <expr> then <action> fired { <effects> } else { <effects> } }
234:– KRL has a class of variables called “persistent variables” or just “persistents”. There are two kinds of persistents: application variables and entity variables. Both are
450:
whatsoever. Each processor is free to interpret the event independently of other processors and generators in the system according to its context and particular purpose.
453:
The event generator “raises an event”; in other words, it sends a notification that a state change occurred. The event processor “listens for” or “handles” these events.
416:
This rule would send a “good morning” notification to visitors of any page in the archives of a web site (as denoted by the URL path) if it's morning where the user is.
228:
A single event can fire rules from multiple rulesets within the entity's execution environment. Which rules are selected and run depends on the rulesets installed.
391:
languages are all different, rule languages also require a different way of thinking. Consequently, writing a KRL ruleset is not a traditional programming task.
167:
47:
398:
In the first stage, the rule is either selected or not, based on the event pattern in the event expression. The event expression of a rule follows the
170:
at Kynetx, beginning in 2007. Development of the language has since expanded to include libraries and modules for a variety of web services, including
446:
mode of interaction: “Do this!” In contrast, event interactions are declarative, stating only that a specific state change happened: “This happened”.
270:– Events trigger specific things to occur. Events are like the trigger of the "gun"—the rule. Without the event to trigger the rule, nothing happens.
424:
Events are the notification of a detectable condition in a computer system. The detectable condition will typically be seen as a state change.
206:, events, a notification that something happened, control the flow of execution. KRL supports a programming model based on three key ideas:
379:
KRL is a deterministic rule language. This means that KRL programs consist of a set of rules that take an action when triggered. Just as
306:
section for global definitions. Each rule conforms to the pattern for ECA rule languages given above with some significant additions.
215:
Entity orientation requires that KRL execution environments support the notion of entity. Rulesets are installed for each entity.
290:– Actions are like the bullet coming out of the gun; they are the final result of the rule. A rule may have multiple actions.
627:
413:
rule good_morning { select when pageview url #example.com# if morning() then notify(“Welcome!”, “Good morning!”) }
111:
479:
370:
maintaining state to link separate interactions with the event processor together in meaningful ways to create context.
560:
657:
284:
postlude to trigger another event, or you can have a rule with a conditional which tests for the opposite case.
496:
384:
395:
the action is conditional: the action is taken only when the rule is selected and its premise is true.
235:
17:
518:
203:
323:
Declarations in the rule prelude allow values to be calculated and store for use later in the rule
388:
380:
260:
34:
581:
443:
263:
or ECA rule language because of the roles that those three fundamental parts of a rule play:
280:
statement on conditionals. If you want a rule to fire in the opposite case, you can use the
29:
8:
144:
346:
supporting push-style notifications. Because the
Evented API is a specialization of the
54:
475:
244:
195:
191:
155:
88:
329:
Actions can be either built-in or user defined and specify the action of the rule
42:
103:
240:
199:
148:
632:
651:
93:
81:
77:
72:
158:
project called KRE, for
Kinetic Rules Engine, developed by Kynetx, Inc.
532:
320:
statement declare the conditions under which the rule will be selected.
128:
350:
concept, any system that supports webhooks can raise events for KRL.
427:
These are three required parts of event detection and notification:
175:
641:
347:
171:
326:
Conditional expressions determine whether a selected rule fires.
636:
537:
179:
603:
294:
Besides a collection of rules, KRL rulesets also contain a
132:
251:
ruleset potentially represents a persistent data object.
302:
section for providing clues about event salience, and a
298:
section for specifying information about the ruleset, a
336:) affect persistent variables and raise further events.
367:
responding to directives from the event processor, and
437:
The process sends a notification of the state change
309:The basic structure of a KRL rule is as follows:
649:
410:The following example shows a simple KRL rule:
364:raising relevant events to the event processor,
225:installed a rule that listens for that event.
419:
635:, the open-source implementation hosted on
374:
254:
185:
469:
650:
474:. Course Technology PTR. p. 416.
561:"A Programming Model for the CloudOS"
516:
558:
519:"The Promise of the Personal Cloud"
340:
332:Statements in the rule's postlude (
239:variables are roughly analogous to
13:
601:
497:"The Internet of me and my things"
494:
434:A process notices the state change
14:
669:
621:
533:"Kinentic Rules Engine at GitHub"
517:Cobb, Jennifer (May 17, 2012).
595:
574:
552:
525:
510:
488:
463:
360:Endpoints are responsible for
1:
456:
243:. Entity variables are like
7:
604:"Evented API Specification"
10:
674:
420:Events and evented systems
161:
18:KRL (programming language)
15:
470:Windley, Phillip (2011).
316:Event expressions in the
127:
122:
117:
109:
99:
87:
71:
63:
53:
41:
28:
375:Rules and rule execution
204:event-driven programming
190:KRL is event-based with
16:Not to be confused with
582:"KRL Event Expressions"
644:at Phil Windley's blog
261:event condition action
255:Event-Condition-Action
232:Persistent data values
35:Event condition action
658:Programming languages
186:Philosophy and design
141:Kinetic Rule Language
24:Kinetic Rule Language
633:Kinetic Rules Engine
166:KRL was designed by
64:First appeared
25:
559:Windley, Phillip.
245:instance variables
210:Entity orientation
154:KRL is part of an
48:Phillip J. Windley
23:
628:KRL Documentation
431:A change of state
259:KRL is called an
196:single assignment
192:strict evaluation
138:
137:
104:KRL documentation
73:Typing discipline
665:
615:
614:
612:
610:
599:
593:
592:
590:
588:
578:
572:
571:
569:
567:
556:
550:
549:
547:
545:
529:
523:
522:
514:
508:
507:
505:
503:
492:
486:
485:
467:
341:Event generators
335:
319:
43:Designed by
26:
22:
673:
672:
668:
667:
666:
664:
663:
662:
648:
647:
642:Articles on KRL
624:
619:
618:
608:
606:
600:
596:
586:
584:
580:
579:
575:
565:
563:
557:
553:
543:
541:
531:
530:
526:
515:
511:
501:
499:
493:
489:
482:
468:
464:
459:
422:
414:
385:object-oriented
377:
343:
334:fired...else...
333:
317:
313:
257:
241:class variables
188:
164:
149:personal clouds
112:implementations
21:
12:
11:
5:
671:
661:
660:
646:
645:
639:
630:
623:
622:External links
620:
617:
616:
594:
573:
551:
524:
509:
487:
481:978-1133686682
480:
461:
460:
458:
455:
439:
438:
435:
432:
421:
418:
412:
376:
373:
372:
371:
368:
365:
342:
339:
338:
337:
330:
327:
324:
321:
311:
292:
291:
285:
271:
256:
253:
200:dynamic typing
187:
184:
163:
160:
136:
135:
125:
124:
120:
119:
115:
114:
107:
106:
101:
97:
96:
91:
85:
84:
75:
69:
68:
65:
61:
60:
57:
51:
50:
45:
39:
38:
32:
9:
6:
4:
3:
2:
670:
659:
656:
655:
653:
643:
640:
638:
634:
631:
629:
626:
625:
605:
602:Curren, Sam.
598:
583:
577:
562:
555:
540:
539:
534:
528:
520:
513:
498:
495:Searls, Doc.
491:
483:
477:
473:
466:
462:
454:
451:
447:
445:
436:
433:
430:
429:
428:
425:
417:
411:
408:
404:
401:
396:
392:
390:
386:
382:
369:
366:
363:
362:
361:
358:
354:
351:
349:
331:
328:
325:
322:
315:
314:
310:
307:
305:
301:
297:
289:
286:
283:
279:
275:
272:
269:
266:
265:
264:
262:
252:
248:
246:
242:
237:
233:
229:
226:
222:
220:
219:Event binding
216:
213:
211:
207:
205:
201:
197:
193:
183:
181:
177:
173:
169:
159:
157:
152:
150:
146:
142:
134:
130:
126:
123:Influenced by
121:
116:
113:
108:
105:
102:
98:
95:
92:
90:
86:
83:
79:
76:
74:
70:
66:
62:
58:
56:
52:
49:
46:
44:
40:
37:rule language
36:
33:
31:
27:
19:
607:. Retrieved
597:
585:. Retrieved
576:
564:. Retrieved
554:
542:. Retrieved
536:
527:
512:
500:. Retrieved
490:
472:The Live Web
471:
465:
452:
448:
440:
426:
423:
415:
409:
405:
399:
397:
393:
378:
359:
355:
352:
344:
308:
303:
299:
295:
293:
287:
281:
277:
273:
267:
258:
249:
231:
230:
227:
223:
218:
217:
214:
209:
208:
189:
168:Phil Windley
165:
153:
140:
139:
609:18 February
587:18 February
566:18 February
544:18 February
502:18 February
156:open-source
143:(KRL) is a
59:Kynetx, Inc
457:References
389:imperative
381:functional
274:Conditions
145:rule-based
129:JavaScript
282:not fired
55:Developer
652:Category
300:dispatch
176:Facebook
30:Paradigm
348:webhook
288:Actions
172:Twitter
162:History
100:Website
89:License
78:dynamic
637:GitHub
538:GitHub
478:
400:select
387:, and
318:select
304:global
268:Events
236:closed
198:, and
180:Twilio
178:, and
110:Major
202:. In
94:GPLv2
611:2013
589:2013
568:2013
546:2013
504:2013
476:ISBN
296:meta
278:else
133:Perl
82:weak
67:2007
444:RPC
118:KRL
654::
535:.
383:,
247:.
194:,
182:.
174:,
151:.
131:,
80:,
613:.
591:.
570:.
548:.
521:.
506:.
484:.
20:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.