Sandro Hawke
(sandro@w3.org), W3C /
MIT
RuleML 2009, 5 November 2009
http://www.w3.org/2009/Talks/1105-ruleml/
It's a diverse world
Can't control chaos
Interlingua
Translators
General outline:
My angle:
Plus Discussion
Produce:
... which together allow rules to be:
The Working Group will have to balance the needs of a diverse community
... specifying extensions for which it can:
RuleML initiative, TimBL's cwm/n3 (Fall 2000)
W3C Submissions (2004-2005): SWRL, SWRL-FOL, SWSL, WRL
Workshop (April 2005), ~80 people
F2F1 (December 2005) ~50 people
Use Cases and Requirements (2006)
F2F5, RIF Core WD1 (2007 Q1) ~ 20 people
Production Rules, Builtins, etc (2008)
F2F13, RIF Last Call (July 2009) ~ 15 people
Candidate Recommendation (October 2009)
Dialects (Core + Extensions)
Builtins
Works with RDF, OWL
Standard access to XML data: in development
Test Suite
Extensible
Datalog
Datatypes, Builtins
Aligned with RDF (as superset)
Same Datatypes, Builtins
Adds functions terms (Positive Horn Logic)
Adds open lists (like Prolog)
May add equality in conclusion (open issue)
Operational Semantics (not Model Theoretic)
Adds: Retract, Modify, Execute (Print)
Adds: New
Adds: ineg (true if fact is not in current KB)
<!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>
One used in BLD spec, another used in PRD spec
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) ) ) )
Room for something better.
Okay to use RIF rules on RDF
Okay to use with OWL (in all its variants)
Okay to implement OWL 2 RL with RIF Core
Draft (won't be a standard soon)
Access to XML / XML-like data from rules
Double-check the specs
Check mailing list, Wiki
Check the Framework for Logic Dialects
Okay to define your own dialects
What should non-implementing systems do?
If non-implementers should... | Your extension should... |
---|---|
ignore it | use annotations (metadata) |
stop | extend the syntax |
rewrite | [not yet supported] |
Add XML Elements, in your own namespace
Non-implementing systems will reject document
Document it, share on public-rif-dev@w3.org
Ideally, non-implementing systems could look up extension
Syntactic sugar -> perfect rewrites
Other rewrites have some "impact"
Proposed as XTAN, but not adopted in RIF
RIF implementations
Test Suite
It's time!
The Future:
You already believe in rule interchange
Relation to the Web?
Decentralization
Massive Scale
(My main use case for RIF)
Alice publishes an RDF web page:
She wants to say... | Her RDF (in Turtle) |
---|---|
I'm selling a 1st Generation Apple iPod Nano. | @prefix sales: <http://example.org/sales> @prefix apple: <http://apple.example.com/products> @prefix : <> :Alice sales:offering :item22. :item22 rdf:type apple:iPodNanoGen1. |
Charlie queries for:
?who sales:offering ?item. ?item rdf:type apple:iPodNanoGen1.
... and he see Alice's listing!
But really Charlie queries for:
?who sales:offering ?item. ?item rdf:type apple:iPod.
If he wants to see Alice's listing, he must:
And Apple must:
Apple's Content | Which means... |
---|---|
apple:iPodNanoGen1 rdfs:subClassOf apple:iPodNano. apple:iPodNano rdfs:subClassOf apple:iPod. |
Every Gen1 Nano is a Nano, every Nano is an iPod |
apply:iPodNanoGen1 rdfs:subClassOf [ rdf:type owl:Restriction; owl:onProperty apple:memorySizeMeg; owl:hasValue "1024"; ] |
Every Gen1 Nano has 1024M memory |
Implement "RL" subset of OWL
More expressive than OWL (eg builtins)
Especially vocabulary mapping
Some data currently in some computer:
A Shopping Scenario
Those are all things some computer knows about
It's a question of permissions
And the cost of data integration
Knowledge is Power (Information has Value)
Apps using data from unknown sources
IT Dashboard
A lot of apps are just queries
And the rest just add update?
MVC takes over...
All shared on Web
Application = pick one of each
Models * Views * Controllers = Ocean of Apps
Micro App is a bookmark, an ad hoc collection of these
(Someday.)
RIF is ready to try out. Pick your dialect.
Extend it as necessary
Rules are key to open data integration
The future is: