The Rule Markup Initiative

advertisement
The Rule Markup Initiative:
KR Principles and DTD Modularization
Harold Boley
(joint work with
Benjamin Grosof and
Said Tabet)
23th Meeting of the DFKI
Scientific Advisory Board
February 19-21, 2001
Motivation (I)

Rules in (and for) the Web have become a
mainstream topic since
–
inference rules were


–
marked up for E-Commerce
identified as a Design Issue of the Semantic Web
transformation rules were used for document
generation from central XML repository
• Rule interchange is becoming more important in
Knowledge Representation (KR), especially in
– Intelligent Agents
– AI shells for knowledge-based systems
1
DFKI
RuleML KR & DTD
Motivation (II)


The Rule Markup Initiative has taken initial steps
towards defining a shared Rule Markup Language
(RuleML) for interoperation between Participants
RuleML permits forward (bottom-up) and backward
(top-down) rules in XML for
–
–
–

2
deduction
rewriting
further inferential-transformational tasks
Current version uses backward notation, which can
be applied in both directions
DFKI
RuleML KR & DTD
Initial Example: Forward-Rule Notation
Challenge hypertext as one XHTML paragraph:
<p>If you want to review rule principles, you may look at
<a href="http://www.cs.brandeis.edu/...">Rule-Based Systems</a></p>
Original RuleML markup with XHTML in prem/conc
(English premise and semiformal conclusion):
3
<rule>
<prem>
<p>You want to review rule principles</p>
</prem>
<conc>
<p>You may look at
<a href="http://www.cs.brandeis.edu/...">Rule-Based Systems</a>
</p>
</conc>
</rule>
DFKI
RuleML KR & DTD
Initial Example: Backward-Rule Notation
Further formalized RuleML markup (still unanalyzed
English relation and individual-constant names):
4
<if>
<atom>
conclusion
<rel>may look at</rel>
<var>you</var>
<ur label="Rule-Based Systems">http://www.cs.brandeis.edu/...</ur>
</atom>
<atom>
<rel>want to review</rel>
premise
<var>you</var>
<ind>rule principles</ind>
</atom>
</if>
DFKI
RuleML KR & DTD
RuleML Elements of Datalog DTD:
Clocksin/Mellish Sample Prolog Clauses
5
Rule (Non-unit clause):
Fact (Unit clause):
<if>
<atom>
<rel>likes</rel>
likes(
<ind>John</ind>
john,
<var>x</var>
X)
</atom>
:<atom>
<rel>likes</rel>
likes(
<var>x</var>
X,
<ind>wine</ind>
wine ) .
</atom>
</if>
DFKI RuleML KR & DTD
<if>
<atom>
<rel>likes</rel>
<ind>Mary</ind>
<ind>wine</ind>
</atom>
<and/> Empty ‘and’ 
true premise 
</if>
factual rule
likes(mary,wine).
RuleML Element of UR-Hornlog DTD:
Proposed W3C-Page Authentication Rule
Tim Berners-Lee: Any person who was some time in the last 2 months an employee of
an organization which was some time in the last 2 months a W3C member may register
6
<atom>
<if>
<atom>
<rel>member in</rel>
<atom>
<rel>employee in</rel>
<var>org</var>
<rel>may register</rel> <var>any</var>
<ur label="W3C">http://
<var>any</var>
<var>org</var>
www.w3.org/</ur>
</atom>
<cterm>
<cterm>
<and>
<ctor>last</ctor>
<ctor>last</ctor>
<atom>
<cterm>
<cterm>
<rel>person</rel>
<ctor>month</ctor>
<ctor>month</ctor>
<var>any</var>
<ind>2</ind>
<ind>2</ind>
</atom>
</cterm>
</cterm>
<atom>
</cterm>
</cterm>
<rel>organization</rel> </atom>
</atom>
<var>org</var>
</and>
</atom>
</if>
DFKI RuleML KR & DTD
RuleML Elements of UR-Equalog DTD:
Equations for URI Expansion
uriexp(daml) = http://www.daml.org/
URLs/URIs or URs
as 1st-class citizens
<if>
<eq>
uriexp(oil) = http://www.ontoknowledge.org/oil/
<nano>
<fun>uriexp</fun>
<if>
<ind>daml</ind>
<eq>
</nano>
<nano>
<ur>http://www.daml.org/</ur> <fun>uriexp</fun>
</eq>
<ind>oil</ind>
<and/>
</nano>
</if>
<ur>http://www.ontoknowledge.org/oil/</ur>
7
</eq>
<and/>
</if>
Empty ‘and’ 
true premise 
unconditional
equation
DFKI
RuleML KR & DTD
. . .
RuleML Element of URC-Bin-Data-Ground-Fact DTD:
RDF Triple as Very Special Rule
RDF triple
(predicate, subject, object) as atom
predicate(subject, object) or rel(ur, ur|ind)
"http://www.w3.org/Home/Lassila has creator Ora Lassila."
(Creator, http://www.w3.org/Home/Lassila, Ora Lassila)
8
<if>
<atom>
<rel>Creator</rel>
<ur>http://www.w3.org/Home/Lassila</ur>
<ind>Ora Lassila</ind>
</atom>
<and/>
</if>
DFKI
RuleML KR & DTD
Modularization of DTDs: XHTML and KR
Advantages:
• Leads to reusable subDTDs and DTD interoperation
• Complex DTDs built with 'plug-and-play' technology
• (RuleML) Sublanguages determined by validations!
• For (rulebase) export find most precise sublanguage!
Modular DTDs still mostly used outside KR:
• First used for XHTML and described in XML Bible
• W3C Working Draft 5 January 2000
Building XHTML[tm] Modules
• W3C Candidate Recommendation 20 October 2000
Modularization of XHTML[tm]
9
DFKI
RuleML KR & DTD
Structure of the RuleML DTD Hierarchy



Our system of DTDs (current version: 0.7) uses a
modularization approach similar to XHTML in order
to accomodate the various rule subcommunities
The evolving hierarchy of RuleML DTDs forms
a partial order with ruleml as the greatest element
(a ruleml-rooted DAG) -- many ‘smallest’ elements
Each DTD node in the hierarchy corresponds to a
specific RuleML sublanguage:
–
–
10
‘Union’ (join) of sublanguages reached via outgoing links:
to smaller or equal nodes below
‘Intersection’ (meet) of sublanguages via incoming links:
from greater or equal nodes above
DFKI
RuleML KR & DTD
The Module Hierarchy of RuleML DTDs
ruleml
ur-equalog
ur-hornlog
equalog
ur-datalog
hornlog
Rooted DAG will be extended with
branches for further sublanguages
ur-datalog =
join(ur,datalog)
datalog
ur
urc-datalog
URL/URI-like
‘ur’-objects
11
bin-datalog
urc-bin-datalog
urc-bin-data-ground-log
urc-bin-data-ground-fact
DFKI
RuleML KR & DTD
RDF-like triples
DTDs: From Well-Formedness to Validity
XML principles for a
document being wellformed:







12
Open and close all tags
Empty tags end with />
There is a unique root
element
Elements may not overlap
Attribute values are quoted
< and & are only used to
start tags and entities
Only the five predefined
entity references are used
DFKI
XML principle for
a document being valid
with respect to a DTD :

RuleML KR & DTD
Matches the type-like
constraints listed in the
DTD (or, can be generated
from DTD as linearized CF
grammar-derivation tree)
Checked by
validators such as
http://www.stg.brown.edu/s
ervice/xmlvalid/
A Relational Language:
ruleml-datalog.dtd (I)
<!-- An XML DTD for a Datalog RuleML Sublanguage -->
<!-- Last Modification: 2001-01-25 -->
<!-- ENTITY Declarations -->
<!-- in this ruleml-datalog.dtd, parameter entities set two *.module switches to INCLUDE -->
<!ENTITY % datalog.module "INCLUDE">
<!ENTITY % datalog-and-hornlog.module "INCLUDE">
<!-- hence all conditional sections "<![%*.module;[" . . . "]]>" activate their content; -->
<!-- in a stand-alone use of the current DTD "<![%*.module;[" and "]]>" are thus no-ops -->
<![%datalog-and-hornlog.module;[
<!-- a conclusion and premise will be usable within 'if' implications -->
<!-- in datalog and hornlog, conc element uses an atomic formula -->
<!-- in datalog and hornlog, prem element uses an atomic formula or an 'and' -->
<!ENTITY % conc "atom">
<!ENTITY % prem "(atom | and)">
13
]]>
DFKI
RuleML KR & DTD
A Relational Language:
ruleml-datalog.dtd (II)
<!-- ELEMENT and ATTLIST Declarations -->
<!-- 'rulebase' root element uses 'if' implications as top-level rules -->
<!-- label attribute allows naming of an entire individual rulebase; -->
<!-- e.g., this can help enable forward inferencing of selected rulebase(s) -->
<!-- direction attribute indicates the intended direction of rule inferencing; -->
<!-- it is a preliminary design choice and has a 'neutral' default value -->
<!ELEMENT rulebase (if*)>
<!ATTLIST rulebase label CDATA #IMPLIED>
<!ATTLIST rulebase direction (forward | backward | bidirectional) "bidirectional">
<!-- 'if' implications are usable as top-level rules -->
<!-- 'if' element uses a conclusion followed by a premise -->
<!-- "<if>conc prem</if>" stands for "conc if prem", i.e., "conc is true if prem is true" -->
<!-- label attribute is a handle for the rule: for various uses, including editing -->
<!ELEMENT if (%conc;, %prem;)>
<!ATTLIST if label CDATA #IMPLIED>
14
DFKI
RuleML KR & DTD
A Relational Language:
ruleml-datalog.dtd (III)
<![%datalog-and-hornlog.module;[
<!-- an 'and' is usable within premises -->
<!-- 'and' uses zero or more atomic formulas -->
<!-- "<and>atom</and>" is equivalent to "atom"-->
<!-- "<and></and>" is equivalent to "true"-->
<!ELEMENT and (atom*)>
]]>
<![%datalog.module;[
<!-- atomic formulas are usable within conc's, prem's, and 'and's -->
<!-- atom element uses rel(ation) symbol followed by a sequence of -->
<!-- zero or more arguments, which may be ind(ividual)s or var(iable)s -->
<!ELEMENT atom (rel, (ind | var)*)>
15
]]>
DFKI
RuleML KR & DTD
A Relational Language:
ruleml-datalog.dtd (IV)
<!-- there is one kind of fixed argument -->
<!-- individual constant, as in predicate logic -->
<!ELEMENT ind (#PCDATA)>
<!-- there is one kind of variable argument -->
<!-- logical variable, as in logic programming -->
<!ELEMENT var (#PCDATA)>
<!-- there are only fixed (first-order) relations -->
<!-- relation or predicate symbol -->
<!ELEMENT rel (#PCDATA)>
16
DFKI
RuleML KR & DTD
A URL/URI Language:
ruleml-ur.dtd
<!-- An XML DTD for a 'UR' RuleML Sublanguage -->
<!-- Last Modification: 2001-01-23 -->
<!-- ENTITY Declarations -->
<!-- a Uniform Resource Identifier is currently PCDATA, but see W3C's [RFC2396] -->
<!ENTITY % URI "#PCDATA">
<!-- ELEMENT and ATTLIST Declarations -->
<!-- there is an additional kind of fixed argument -->
<!-- objects (resources) use a URL/URI as their OID, as in SHOE or RDF (cf. URML) -->
<!-- however, unlike for XHTML anchors etc. URI used as content, not as attribute -->
<!-- 'label' attribute, unlike URI, need not be unique -->
<!-- if no 'label' attribute is given, browser must highlight the URI itself -->
<!ELEMENT ur (%URI;)>
<!ATTLIST ur label CDATA #IMPLIED>
17
DFKI
RuleML KR & DTD
The Join Language:
ruleml-urdatalog.dtd
<!-- An XML DTD for a 'UR' Datalog RuleML Sublanguage -->
<!-- Last Modification: 2001-01-23 -->
<!-- ENTITY Declarations -->
<!ENTITY % urdatalog.module "INCLUDE">
<!ENTITY % datalog.module "IGNORE">
<!ENTITY % datalog SYSTEM "ruleml-datalog.dtd">
%datalog;
<!ENTITY % ur SYSTEM "ruleml-ur.dtd">
%ur;
<!-- ELEMENT and ATTLIST Declarations -->
<![%urdatalog.module;[
<!-- atomic formulas are usable within conc's, prem's, and 'and's -->
<!-- atom element uses rel name followed by three kinds of arguments -->
<!ELEMENT atom (rel, (ur | ind | var)*)>
18
]]>
DFKI
RuleML KR & DTD
Conclusions




19
RuleML DTD 0.7, a system of 12 DTDs, is
available at http://www.dfki.de/ruleml/indtd.html
Sample files -- each referring to the most
specific DTD still validating them -- are at
http://www.dfki.de/ruleml/exa
Further rule categories (e.g. ICs and triggers)
and DTD updates will be available via main
RuleML page at http://www.dfki.de/ruleml
Distributed KR can already be based on
current DTDs -- using (XSLT) transformations
to reach follow-up and Participants’ DTDs
DFKI
RuleML KR & DTD
Download