So Many Rule Systems
- Logic programming (LP), from Prolog (early 70s)
- Production Rules (PR), OPS5/Rete (late 70s)
- Automated Theorem Proving (ATP), (resolution, 1965)
- app-specific rule systems (eg mail handling, access control)
- Business Rules (2001?)
It is a way of programming, and a way of not programming
Semantic Web Perspective
What does RIF do for the Semantic Web?
- A companion to RDFS and OWL -- another logic
- Can express different kinds of things
- A different way of thinking -- which many people want
- Data integration, ontology mapping, ad hoc reasoning
- ... even data processing (N3)
Business Rules Perspective
Thinking in terms of the business
- reduce vendor lock-in (portability)
- coordinating businesses, eg in a supply chain
- integrated decision support, eg in medical decisions
Diversity
Simple rule systems vs cutting-edge research
- Different traditions
- Different technologies
- Different kinds of problems
Dream vs Reality
The Plan
Start with a common core
- Find the thing that rule systems have in common (60%)
- Standardize that ("RIF Core")
- Then work on extensions
Core must be truly extensible
Some details
Focus on translating to/from RIF
- So it's fine to be verbose XML
- Implementation burden is on translators
Extensions may be incompatible
- Dialect == group of extensions that work well together
- Some standard, some non-standard
Thus "format" instead of "language"
The People Involved
- RuleML, cwm started Fall 2000
- W3C Submissions (2004-2005): SWRL, SWRL-FOL, SWSL, WRL
- Workshop (April 2005), ~80 people
- F2F1 (December 2005) ~50 people
- F2F5 (Feb 2007) ~ 20 people
- F2F13 (April 2009) ~ 15 people
Organizations
- Business rules vendors
- ILOG (chair), Fair Isaac, Oracle, TIBCO, JBoss...
- Commercial Research
- Non-Commercial Research
- NRC, Bolzano, DERI, MITRE, REWERSE, ...
- ... others
RIF: XML Syntax for Rules
<!DOCTYPE Document [
<!ENTITY ppl "http://example.com/people#">
<!ENTITY cpt "http://example.com/concepts#">
<!ENTITY dc "http://purl.org/dc/terms/">
<!ENTITY rif "http://www.w3.org/2007/rif#">
<!ENTITY func "http://www.w3.org/2007/rif-builtin-function#">
<!ENTITY pred "http://www.w3.org/2007/rif-builtin-predicate#">
<!ENTITY xs "http://www.w3.org/2001/XMLSchema#">
]>
<Document
xmlns="http://www.w3.org/2007/rif#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema#">
<payload>
<Group>
<id>
<Const type="&rif;iri">http://sample.org</Const>
</id>
<meta>
<Frame>
<object>
<Const type="&rif;local">pd</Const>
</object>
<slot ordered="yes">
<Const type="&rif;iri">&dc;publisher</Const>
<Const type="&rif;iri">http://www.w3.org/</Const>
</slot>
<slot ordered="yes">
<Const type="&rif;iri">&dc;date</Const>
<Const type="&xs;date">2008-04-04</Const>
</slot>
</Frame>
</meta>
<sentence>
<Forall>
<declare><Var>item</Var></declare>
<declare><Var>deliverydate</Var></declare>
<declare><Var>scheduledate</Var></declare>
<declare><Var>diffduration</Var></declare>
<declare><Var>diffdays</Var></declare>
<formula>
<Implies>
<if>
<And>
<formula>
<Atom>
<op><Const type="&rif;iri">&cpt;perishable</Const></op>
<args ordered="yes"><Var>item</Var></args>
</Atom>
</formula>
<formula>
<Atom>
<op><Const type="&rif;iri">&cpt;delivered</Const></op>
<args ordered="yes">
<Var>item</Var>
<Var>deliverydate</Var>
<Const type="&rif;iri">&ppl;John</Const>
</args>
</Atom>
</formula>
<formula>
<Atom>
<op><Const type="&rif;iri">&cpt;scheduled</Const></op>
<args ordered="yes">
<Var>item</Var>
<Var>scheduledate</Var>
</args>
</Atom>
</formula>
<formula>
<Equal>
<left><Var>diffduration</Var></left>
<right>
<External>
<content>
<Expr>
<op><Const type="&rif;iri">&func;subtract-dateTimes</Const></op>
<args ordered="yes">
<Var>deliverydate</Var>
<Var>scheduledate</Var>
</args>
</Expr>
</content>
</External>
</right>
</Equal>
</formula>
<formula>
<Equal>
<left><Var>diffdays</Var></left>
<right>
<External>
<content>
<Expr>
<op><Const type="&rif;iri">&func;days-from-duration</Const></op>
<args ordered="yes">
<Var>diffduration</Var>
</args>
</Expr>
</content>
</External>
</right>
</Equal>
</formula>
<formula>
<External>
<content>
<Atom>
<op><Const type="&rif;iri">&pred;numeric-greater-than</Const></op>
<args ordered="yes">
<Var>diffdays</Var>
<Const type="&xs;integer">10</Const>
</args>
</Atom>
</content>
</External>
</formula>
</And>
</if>
<then>
<Atom>
<op><Const type="&rif;iri">&cpt;reject</Const></op>
<args ordered="yes">
<Const type="&rif;iri">&ppl;John</Const>
<Var>item</Var>
</args>
</Atom>
</then>
</Implies>
</formula>
</Forall>
</sentence>
<sentence>
<Forall>
<declare><Var>item</Var></declare>
<formula>
<Implies>
<if>
<Atom>
<op><Const type="&rif;iri">&cpt;unsolicited</Const></op>
<args ordered="yes"><Var>item</Var></args>
</Atom>
</if>
<then>
<Atom>
<op><Const type="&rif;iri">&cpt;reject</Const></op>
<args ordered="yes">
<Const type="&rif;iri">&ppl;Fred</Const>
<Var>item</Var>
</args>
</Atom>
</then>
</Implies>
</formula>
</Forall>
</sentence>
</Group>
</payload>
</Document>
BLD Presentation Syntax
Document(
Prefix(ppl <http://example.com/people#>)
Prefix(cpt <http://example.com/concepts#>)
Prefix(dc <http://purl.org/dc/terms/>)
Prefix(rif <http://www.w3.org/2007/rif#>)
Prefix(func <http://www.w3.org/2007/rif-builtin-function#>)
Prefix(pred <http://www.w3.org/2007/rif-builtin-predicate#>)
Prefix(xs <http://www.w3.org/2001/XMLSchema#>)
(* "http://sample.org"^^rif:iri _:pd[dc:publisher -> "http://www.w3.org/"^^rif:iri
dc:date -> "2008-04-04"^^xs:date] *)
Group
(
Forall ?item ?deliverydate ?scheduledate ?diffduration ?diffdays (
cpt:reject(ppl:John ?item) :-
And(cpt:perishable(?item)
cpt:delivered(?item ?deliverydate ppl:John)
cpt:scheduled(?item ?scheduledate)
?diffduration = External(func:subtract-dateTimes(?deliverydate ?scheduledate))
?diffdays = External(func:days-from-duration(?diffduration))
External(pred:numeric-greater-than(?diffdays 10)))
)
Forall ?item (
cpt:reject(ppl:Fred ?item) :- cpt:unsolicited(?item)
)
)
)
Other Presentation Syntaxes
Nothing standard... room for experimentation
Prefix ppl <http://example.com/people#>
Prefix cpt <http://example.com/concepts#>
Prefix dc <http://purl.org/dc/terms/>
Prefix rif <http://www.w3.org/2007/rif#>
Prefix func <http://www.w3.org/2007/rif-builtin-function#>
Prefix pred <http://www.w3.org/2007/rif-builtin-predicate#>
Prefix xs <http://www.w3.org/2001/XMLSchema#>
(* lt;http://sample.org> { _:pd dc:publisher lt;http://www.w3.org/>;
dc:date "2008-04-04"^^xs:date] } *)
if cpt:perishable(?item) and
cpt:delivered(?item ?deliverydate ppl:John) and
cpt:scheduled(?item ?scheduledate) and
func:days-from-duration(?deliverydate - ?scheduledate) > 10
then cpt:reject(ppl:John ?item).
if cpt:unsolicited(?item)
then cpt:reject(ppl:Fred ?item).
Slippery slope to "real" rule languages.
A Family of Dialects
But...
Not all engines can implement every feature
Some features (retract and negation) are incompatible
Forward chaining, Backward chaining
So...
Core: common subset
BLD: (basic logic dialect) common subset of Prolog-style languages
PRD: (production rule dialect) common subset of Production Rule languages
Use Case: Vocabulary Mapping
if { ?x foaf:firstName ?first;
foaf:surname ?last }
then
{ ?x foaf:family_name ?last;
foaf:givenname ?first;
foaf:name func:string-join(?first " " ?last)
}
if { ?x foaf:name ?name } and
pred:contains(?name, " ")
then
{ ?x foaf:firstName func:string-before(?name, " ");
foaf:surname func:string-after(?name, " ")
}
Use Case: ad hoc Reasoning
if { ?p rdfs:range ?c.
?x ?p ?y }
then
{ ?y rdf:type ?c }
See OWL 2 RL in RIF
Syntactic Features
- Core
- Document, Group
- Import (location, profile)
- Forall, Implies, Exists, And, Or
- Atom, Frame
- Member
- Equal (for testing)
- Consts, symbol spaces (rif:iri, rif:local), all datatypes
- Expr, Var
- External (all builtins)
- id, meta
- BLD Only
- Subclass
- Equal (as assertion)
- Open Lists
- Function Terms (Constructors)
- PRD Only
- INeg
- Assert, Modify, Retract
- Execute
- New
Datatypes and Builtins
Most XML Schema 1.1 Datatypes (same subset as OWL 2)
Many xpath-functions, plus a few other things
- Numerics
- Strings
- Boolean
- XMLLiteral
- PlainLiteral
- Dates, Times, Duration
- Lists
Status
Planning for "Candidate Recommendation" this month
Expecting about a dozen implementation efforts
Planning for "W3C Recommendation" by end of year.
==> It's stable, but virtually no software yet.