June 13, 2003
WFLP'03, Valencia
1
On Integrating Rules into
the Semantic Web
Jan Maluszynski
Linköping University
Sweden
June 13, 2003
WFLP'03, Valencia
2
Overview
“Semantic Web” – do we need it? XML and web languages Rules on the web: the RuleML approach The W3C vision of the Semantic Web Towards typed rules Summary
June 13, 2003
WFLP'03, Valencia
3
Do we need ”Semantic Web”? Google query: FLP ?
gives ~170 000 answers: Forever Living Products Family Living Program Forest Legacy Program Finish Line Performance … I admit, the query is not smart…
Functional Logic Programming Conference ?
Michael Hanus
Conferences related to FLP …WFLP …
June 13, 2003
WFLP'03, Valencia
4
Adding semantics to the contents Annotate web content with a description of its meaning
=> metadata FLP – is a branch of CS
Workshop is a Conference Symposium is a Conference
Use metadata for reasoning/querying FLP conference / CS ? => WFLP, FLOPS
Logical foundations? Various web languages needed:
how to define them? what is their semantics?
June 13, 2003
WFLP'03, Valencia
5
Rules
Can a software agent plan my travel to WFLP ? Constraints/preferences expressed as rules?
Database views Bussiness rules …
Using them on the web?
June 13, 2003
WFLP'03, Valencia
6
Web needs standards Standard notation for data:
XML Standard for creating unique names:
Namespaces Standard for defining web languages
(sets of XML elements):
XML Schema, (DTD) …
June 13, 2003
WFLP'03, Valencia
7
XML <person age=“25” > <name>John Smith </name> <address> <street> Dalav. 21 </street> <city> Lund </city> </address></person>
person
address
street city
name
15
John Smith Dalav. 21 Lund
Tags, Attributes, Standard format facilitates:
•Definition of self-describing structured data
•Integration from various sources
June 13, 2003
WFLP'03, Valencia
8
Is XML element a term ?<CD price="10.90$" year="1985">
Empire Burlesque
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
</CD>
CD[&{price[10.90$],year[1985]},
Empire Burlesque,
artist[Bob Dylan],
country[USA],
company[Columbia]]
Arity of function symbols is not predefined; unordered subterms
June 13, 2003
WFLP'03, Valencia
9
Creating unique names Universal Resource Identifier: URI
identifies unique resource
special case: URL Used for creating unique names Namespaces
The URL may point to a description of the names
(unique meaning?).
<contact xmlns:work="http://www.liu.ida.se/"> <name>John Smith</name> <phone>013/175347</phone> <work:phone>013/281400</work:phone> </contact>
June 13, 2003
WFLP'03, Valencia
10
Defining a web language: syntax
Language: a set of XML elements Elements ~ trees
Define language as a tree-grammar (DTD), place on web
could we define language in XML? XML Schema language: elements are XML documents for any XML Schema document S:
The meaning of S is a set of XML documents L(S)
the function L is the semantics of XML Schema standard on-line validator can check whether any given XML
document is in L(S); The validator implements the semantics of the XML Schema
June 13, 2003
WFLP'03, Valencia
11
A flavour of XML Schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> < xsd: element name=“purchaseOrder” type=“POT” /> < xsd: complexType name=“POT”/> < xsd: sequence> < xsd: element name=“addr” type=“USAddress”/> < xsd: element name=“items” type=“Items”/> < /xsd: sequence> < xsd: attribute name=“orderDate” type=“xsd:date”/> < /xsd: complexType> …. < / xsd: schema> Roughly reflected by a rule: POT purchaseOrder(USAddress Items)
June 13, 2003
WFLP'03, Valencia
12
Regular tree grammars for XML languages
ERTG: Nonterminals X in N {POT, USAddr,…} Terminals t {pOrder, addr,…} /XML tags Start S in N POT Rules X t ( R) R - a regular expression over N
pOrder
addr…
items
it …
it
art …
qua …
<pOrder>
<addr>
...
</addr>
<items>
<it>
...
</it>
<it>
...
</it>
</items>
</pOrder>
POT pOrder( USAddr Items) USAddr addr( Mail Street ZIP City State) Items items( Item*)
Item it(Artno Quantity) ….
June 13, 2003
WFLP'03, Valencia
13
Regular tree languages RTG: each function symbol has fixed arity
ERTG: arguments of a function symbol defined by a regular expression
Regular tree language: a language defined by an RTG Regular tree languages are closed under:
intersection union …
Inclusion is decidable The same holds for languages defined by ERTG
June 13, 2003
WFLP'03, Valencia
14
Defining web languages: summary
XML schema S defines syntax of L L=L(S) S accessible by a URL A document x can be validated wrt S x
L ? XML Schema validators Operational semantics: an
interpreter for L accessible on the web Declarative semantics ?
June 13, 2003
WFLP'03, Valencia
15
RuleML: rules on the web Rule Markup Language Initiative: => Standardize mark-up for selected rule languages! A small family sufficient to embed various applications (?) Develop XML schema for XML encoding of a rule
language L e.g. for Datalog Put it on the web: URL
Operational semantics: rule engine(s) Declarative semantics,
XML schema for L
XML code XML code
L Rules in syntax 1
L Rules in syntax 2
June 13, 2003
WFLP'03, Valencia
16
Logic on the web
Define XML syntax for logic languages (different logics) Model-theoretic semantics, Automatic reasoners
Proposed logics include: Description logics (work in progress DAML+OIL, OWL) Datalog….
In a chosen logic: Provide a set of formulae (encoded in XML)
specific axioms Automatic reasoning system answers queries
June 13, 2003
WFLP'03, Valencia
17
W3C view of the Semantic Web Layers of tightly connected langugages.
XML provides the syntactic basis for all layers What are the connections between the layers?
XML + NS + XML Schema
Unicode
Rules
RDF Schema
RDF
URI
Ontology
June 13, 2003
WFLP'03, Valencia
18
RDF + RDF Schema
A (still evolving) notation encoded in XML [Beckett D. (ed.) 2002]
For modeling application domains Classes, Subclasses, Properties(Slots), Literals
Basic construct: sentence: Subject Predicate Object Encoded in XML, Can be seen as ground atomic formula, Represented as graph
Model theoretic semantics [P. Hayes (ed.) 2003] Editors, query tools exist
June 13, 2003
WFLP'03, Valencia
19
A flavour of RDF Schema
rdfs:Resource
xyz:MotorVehicle rdfs:Class
s s
t
t
xyz:Truck
s
t
xyz:PassengerVehicle
s = rdfs:subClassOf t = rdf:type
xyz:Van
s
s
xyz:MiniVan s
s
t
t
t
t
June 13, 2003
WFLP'03, Valencia
20
Description Logics
A family of KR formalisms, based on FOPL decidable, supported by automatic reasoning systems
Used for modelling of application domains Classification of concepts and individuals
concepts (unary predicates), subconcept (subsumption), roles (binary predicates), individuals (constants), constructors for building concepts, equality …
[Baader et al. 2002]
June 13, 2003
WFLP'03, Valencia
21
Example DL: ALR atomic role, A atomic concept
C,D A | (atomic concept)
T | (universal concept)
| (bottom concept)
A | (atomic negation)
C D | (intersection)
R.C |(value restriction)
R.T | limited ex. Quantification
Add more constructors: another DL
RI I I AI I
TI = I
I = Ø
(A)I = I \ AI
(CD)I = CIDI
( R.C)I =
{a I|b.(a,b) RIb CI }
( R.T)I = {a I| b.(a,b) RI}
June 13, 2003
WFLP'03, Valencia
22
Modelling with DLs A set of equational axioms T (terminology, T-box)
Woman Person Female Man Person Female
Automated check for (C, D concepts): Satisfiability of C:
is there a model I of T such that CI nonempty?
Man Woman ? Subsumption: CI DI for every model I of T ?
Reduces to unsatisfiability C D Add assertions about individuals: Man(Peter) …
Query the obtained knowledge base K. Ground membership query: Person(Peter)?
Find all the individuals in K that are instances of a given concept
June 13, 2003
WFLP'03, Valencia
23
W3C Ontology Language OWL
An expressive description logic Under development [Dean et al. (eds) 2002]
Encoded in XML Extending (?) RDFS
Some problems with that [Patel-Schneider, Fensel 2002] Ontology: a conceptual model of the application domain; OWL ontology: a set of OWL statements – XML encoding of a set of DL axioms
June 13, 2003
WFLP'03, Valencia
24
RDF Schema primitives in DL perspective
Class : Atomic concept
Property: Atomic role
A is a subclass of B: A B
P is a subproperty of R: P R
A is a range of R :
T R.A
A is a domain of R
T R-.A
A,B atomic concepts
P,R atomic roles,
T universal concept
( R.C)I =
{a I|b.(a,b) RIb CI }
R- inverse
June 13, 2003
WFLP'03, Valencia
25
Ontologies and XML Schema
Ontology: a conceptual model of the application domain Data will be represented in XML;
document structure must be imposed A systematic approach for translating an ontology into
a specific XML Schema [Klein, Fensel et al. 2000]: represent: a class C by an element definition; the properties of C correspond to subelements subclasses modelled by XML Schema extension multiple inheritance cannot be directly expressed
June 13, 2003
WFLP'03, Valencia
26
Modeling Ontology with RT Grammar ?
Man Person Woman Person Taxpayer PersonSTsexpartnertax
Person p(S (M|W)? T?)
TaxP p(S (M|W)? T)
M p( sex(m) W? T?)
W p( sex(f) M? T?)
T tax(#Pcdata)
S sex(m|f)
June 13, 2003
WFLP'03, Valencia
27
Adding rule level Should build-up on the ontology level
How ontologies relate to XML data on the web? What kind of rules?
Datalog, (extensions: negation, prioritized rules, fuzzy,…)
Query rules for XML-data
….. What kind of integration?
How to add rules on top of ontologies (RDFS, DLs) ? Integrate Description Logic(s) with Datalog
June 13, 2003
WFLP'03, Valencia
28
Integration of Datalog with DL (1)CARIN [Levy, Rousset 1998], a family of languagesTwo sets of axioms are provided:
(1) T-box in a description logic (2) Rules and ground facts:
p1(X1),…,pn(Xn) q(Y) Xi Y vectors of variables
concept predicates, role predicates, can be used in the body but not in the head; the other: ordinary predicates
all variables of the head appear in the body; no/limited recursion
Ground atomic queries only; special inference procedure needed/provided
June 13, 2003
WFLP'03, Valencia
29
Integration of Datalog with DL (2)
Description Logic Programs [Grosof et al. 2003]
A restricted DL language, where DL axioms can be transformed into logically equivalent Horn clauses., e.g. PQ Q(X) P(X)
The syntactic restrictions are somewhat complex DLP is less expressive than DAML+OIL but
can model a subset of RDFS
The advantage: use of LP engines for query answering; non-monotonic extensions possible
June 13, 2003
WFLP'03, Valencia
30
Typing Datalog with DLs Rationale:
An ontology describes classes of application data; Rules describe data manipulation;
Man Person Woman Person Taxpayer Personlives(X,M), couple(X,Y), interestpaid(Y,Z) taxdeduction(X,Z,M)
TYPES: lives: Person, Municipality couple: Man,Woman interestpaid: Person, Amount taxdeduction: Taxpayer, Amount, Municipality
X:Person X:ManCheck in DL : (Man Person) Taxpayer NO! Clear separation of reasoning in DL from answering Datalog queries;
June 13, 2003
WFLP'03, Valencia
31
Typechecking of rules
q1(X … Y) … qn(X … Y) r(X … Y)
T1(X)…T1(Y) Tn(X)…Tn(Y) T(X)…T(Y)
T(q1) T(qn) T(r)
T(X) = T1(X)…Tn(X)
T(Y) = T1(Y)…Tn(Y)
T(r(X …Y))
June 13, 2003
WFLP'03, Valencia
32
Conceptual vs. Concrete
Ontology
Datalog rules
XML Schema
XML rules ?
typed
XML encoding
typed
June 13, 2003
WFLP'03, Valencia
33
Towards a typed XML rule language Query and transformation rule:
q1,…, qn c
inproc[[ author[X],title[Y] ]], article[[ author[X],title[Y] ]] multi[X]
[[…]] – allows matching term to include additional subterms Xcerpt: Query and Transformation Language [Bry, Schaffert 2002]
Types: approximate the XML database by a regular tree language T : Matching qi ,c against T gives T(qi ), T(c) Matching : intersection of regular tree languages T(qi ) binds variables: T(Xi ) Compute T(X) =T(X1 ) …T(Xn), construct T’(c) Check T’(c) T(c)
June 13, 2003
WFLP'03, Valencia
34
Summary
A perspective of the ongoing development Research issues:
Integration of rules and ontologies Deriving XML schemata from ontologies Type checking of rules
Datalog rules typed by DLs XML transformation rules typed by RTLs
derived from XML schemata
June 13, 2003
WFLP'03, Valencia
35
ReferencesF.Baader, D. Calvanese, D. McGuiness, D.Nardi and P. Patel-Schneider (eds) The
Description Logic Handbook. Cambridge University Press, 2002.D. Beckett (ed.) RDF/XML Syntax Specification (Revised) W3C November 2002.F.Bry and S. Schaffert. Towards a Declarative Query and Transformation Language for
XML and Semistructured Data. Proc. ICLP2002H.Comon, M.Dauchet, R.Gilleron, F.Jacquemard, D.Lugiez, S.Tison and M. Tommasi. Tree
Automata Techniques and Applications. http://www.grappa.univ-lille3.fr/tataM.Dean, D.Connolly, F.van Harmelen, J.Hendler, I.Horrocks, D.L.McGuiness, P.F.Patel-
Scheider and L.A.Stein (Eds.). OWL Web Ontology Language, Reference Version 1.0, W3C,Working Draft November 2002
B. N. Grosof, I. Horrocks, R.Volz and S.Decker. Description Logic Programs: Combining Logic Programs with Description Logic. Proc. of WWW2003, Budapest.
P.Hayes (ed.) RDF Semantics, W3C Working Draft January 2003
M. Klein, D. Fensel, F. van Harmelen and I. Horrocks, The relation between ontologies and schema-languages: translating OIL specifications in XML Schema.Proc of the Workshop on Ontologies and Problem Solving Methods, ECAI 2000
A.Levy and M-C.Rousset. CARIN: A Representation Language Combining Horn rules and Description Logics. Artificial Intelligence 104(1-2), 1998, 165-209.
P.F. Patel-Schneider and D.Fensel. Layering the Semantic Web: Problems and Directions. Proc. ISWC2002, LNCS2342 pp. 16-29
Rule Markup Language Initiative. http://www.ruleml.org