Semantic Web Techniques

woodruffpassionateInternet και Εφαρμογές Web

21 Οκτ 2013 (πριν από 3 χρόνια και 5 μήνες)

234 εμφανίσεις

Semantic Web Techniques

-

Lecture Notes
-

Harold Boley

Bruce Spencer

NRC
-
IIT Fredericton
University of New Brunswick


CS 6905 SWT

17 September 2003

17
-
Sep
-
03

CS6905 Semantic Web Techniques

1

Introduction to the Semantic Web

17
-
Sep
-
03

CS6905 Semantic Web Techniques

2

National Research Council

Research Institutes and Facilities across Canada


17 research institutes


4 innovation centres


3,500 employees; 1,000 guest workers


National science facilities

S&T information for industry and scientific community



CISTI: Canadian Inst. for Science and Tech
Information

Network of technology advisors supporting SME



IRAP: Industrial Research Assistance Program

17
-
Sep
-
03

CS6905 Semantic Web Techniques

3

Institute for Information Technology


There are two aspects to IIT


A mature research organization of ~80 people in Ottawa


New labs being developed in four cities in New
Brunswick and Nova Scotia involving ~60 new people


The whole organization is evolving to
accommodate our new distributed nature

17
-
Sep
-
03

CS6905 Semantic Web Techniques

4

NRC’s plans for New Brunswick


What?


NRC is building an e
-
business research team in New Brunswick


E
-
business includes e
-
learning, e
-
government, e
-
health.


Using information and communication technology to help us to
educate, govern and take care of ourselves, to create wealth.



New Brunswick and Canadian companies already have strengths
in all three areas


NB’s communications infrastructure and interested telco


Bilingual workforce

17
-
Sep
-
03

CS6905 Semantic Web Techniques

5

Bruce


MMath 83, BNR 83
-
86, Waterloo PhD 86
-
90, UNB
prof 90
-
01, NRC 01
-
now


Automated reasoning


data structures in theorem proving


eliminate redundant searching


smallest proofs


deductive databases


Java in curriculum since 1997


17
-
Sep
-
03

CS6905 Semantic Web Techniques

6

Harold


Harold joined NRC
-
IIT Fredericton as a research officer in Sept. 2002.
Before that, he was a senior researcher at the German Research Center
for Artificial Intelligence (DFKI), where he acted as the W3C Advisory
Committee Representative and led the EU project Clockwork on Web
-
based knowledge management for collaborative engineering. He also
was a senior lecturer of computer science and mathematics at the
University of Kaiserslautern, where he conceived AI
-
oriented XML and
RDF courses. His focus has been XML
-
based knowledge markup and
RDF
-
based Semantic Web techniques.


He was a visiting researcher in
the Knowledge Modeling Group at Stanford University in 1999.


Before

that, he led several government and industrial projects in knowledge
representation, compilation, and evolution. He received his PhD and
Habilitation degrees in computer science from the Universities of
Hamburg and Kaiserslautern, respectively.


He developed the Relational
-
Functional Markup Language (RFML) and, together with Said Tabet,
launched the Rule Markup Initiative (RuleML).


17
-
Sep
-
03

CS6905 Semantic Web Techniques

8

Overview and Course Mindmap


Increasing demand for
formalized knowledge

on the Web:
AI’s
chance!


XML
-

& RDF
-
based
markup languages
provide a 'universal'
storage
/
interchange

format for such
Web
-
distributed knowledge
representation


Course introduces
knowledge markup &
resource semantics
:
we show how to marry
AI representations (e.g.,
logics and frames) with
XML & RDF [incl. RDF
Schema]

DTDs

XML

RDF[S]

Namespaces

Stylesheets

CSS

XSLT

XQL

Queries

XML
-
QL

Transformations

Acquisition

Protégé

Agents

Frames

Rules

SHOE

HornML

RuleML

DAML

XQuery

TopicMaps

RACSA

17
-
Sep
-
03

CS6905 Semantic Web Techniques

9

The Semantic Web Activity

of the W3C

“The
Semantic Web

is a vision: the idea of having

data on the Web defined and linked

in a way that

it
can be used by machines

not just for display purposes,

but
for



automation,



integration and



reuse of data across various applications
.



(
http://www.w3.org/2001/sw/Activity
)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

10

What your computer sees in HTML

<b>Joe’s Computer Store

</b>

<br>

365 Yearly Drive

What your computer sees in XML

<location>

<name>Joe’s Computer Store

</name>

<address> 365 Yearly Drive

</address>

</location>

Presentation
information



Content
description

(less ambiguous)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

11

What a computer could understand

<mail:address xmlns:mail=“http://www.canadapost.ca”>


<mail:name>Joe’s Computer Store </mail:name>


<mail:street> 365 Yearly Drive </mail:street>

</mail:address>



www.canadapost.ca
could

define
address, name, street, …


Search engines
could then

identify mail addresses


Consider shopbots being able to find


price, quantity, feature, model number, supplier, serial number,
acquisition date


Assumes that namespaces will be used consistently

17
-
Sep
-
03

CS6905 Semantic Web Techniques

12

Semantic Web


Semantics = meaning


Good Idea: Dictionary


Create a dictionary of terms


Put it on the web


Mark up web pages so that terms are linked to these
dictionary
-
entries


This allow more precise matching


Better idea: Thesaurus


has hierarchies of terms


shades of meaning


Best idea: Ontology


hierarchy of terms and logic conditions

17
-
Sep
-
03

CS6905 Semantic Web Techniques

13

Semantic Web


An agent
-
enabled resource


“information in machine
-
readable form, creating a
revolution in new applications, environments and B2B
commerce”


W3C Activity launched Feb 9, 2001


DAML: DARPA Agent Markup Language


US Gov funding to define languages, tools


16 project teams


OIL is Ontology Inference Layer


DAML+OIL is joint DARPA
-
EU




Knowledge Representation is a natural choice

17
-
Sep
-
03

CS6905 Semantic Web Techniques

14





17
-
Sep
-
03

CS6905 Semantic Web Techniques

15






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

17
-
Sep
-
03

CS6905 Semantic Web Techniques

16


Gravalax is the intersection of
Cured and Salmon, but not
Smoked






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

Gravalax

17
-
Sep
-
03

CS6905 Semantic Web Techniques

17


Lox is Smoked, Cured Salmon


Gravalax is the intersection of
Cured and Salmon, but not
Smoked






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

Gravalax

Lox

17
-
Sep
-
03

CS6905 Semantic Web Techniques

18




A search for keywords
Salmon and Cured
should return pages that
mention Gravalax, even if
they don’t mention
Salmon and Cured



A search for Salmon and
Smoked will return
smoked salmon, should
also return Lox, but not
Gravalax

Smoked Salmon

Lox

Gravalax

The Semantic Web is about having the Internet use
common sense.

17
-
Sep
-
03

CS6905 Semantic Web Techniques

19

OWL


Smoked Salmon

Lox

Gravalax

17
-
Sep
-
03

CS6905 Semantic Web Techniques

20

Tim Berners
-

Lee’s Semantic Web


17
-
Sep
-
03

CS6905 Semantic Web Techniques

21

RDF Resource Description Framework


Beginning of Knowledge Representation influence
on Web


Akin to Frames, Entity/Relationship diagrams, or
Object/Attribute/Value triples

17
-
Sep
-
03

CS6905 Semantic Web Techniques

22

RDF Example

<rdf:ProductSpecs about=


“http://www.lemoncomputers.ca/model_2300”>

<specs:colour>yellow</specs:colour>

<specs:size>medium</specs:size>

</rdf:ProductSpecs>

model_2300

size

medium

colour

yellow

17
-
Sep
-
03

CS6905 Semantic Web Techniques

23

RDF Class Hierarchy


All lemon laptops get
packed in cardboard
boxes


Allows one to
customize existing
taxonomies


Example: palmtop
computers still get
packed in boxes

lemon_palmtop_
20000

is_a

model_2300

size

medium

colour

yellow

17
-
Sep
-
03

CS6905 Semantic Web Techniques

24

Tim Berners
-

Lee’s Semantic Web

17
-
Sep
-
03

CS6905 Semantic Web Techniques

25

Ontology Web Language: W3C


Previously known as DAML+OIL


US: DARPA Agent Markup Language


EU: Ontology Interchange Layer (Language)



Composed of a hierarchy with additional conditions



Based on Description logic, limited expressivenss


Reasoning procedures are well
-
behaved


Just enough power

17
-
Sep
-
03

CS6905 Semantic Web Techniques

26

Identifying Resources


URL/URI


Uniform resource locator / identifier



Information sources, goods and services


financial instruments


money, options, investments, stocks,
etc.


“Where do you want to go today?”


becomes “What do you want to find?”

17
-
Sep
-
03

CS6905 Semantic Web Techniques

27

Ontology


Branch of philosophy dealing with the theory of being


Tarski’s assumption:


individuals, relationships and functions


“A common vocabulary and agreed
-
upon meanings to
describe a subject domain”


What real
-
world objects do my tags refer to?


How are these objects related?


Communication requires shared terms


others can join in

17
-
Sep
-
03

CS6905 Semantic Web Techniques

28

Ontology Layer


Widens interoperability and interconversion


knowledge representation


More meta
-
information


Which attributes are transitive, symmetric


Which relations between individuals are 1
-
1,

1
-
many, many
-
many


Communities exist


DL, OIL, SHOE (Hendler)


New W3C working group

17
-
Sep
-
03

CS6905 Semantic Web Techniques

29

Transitive, Subrole example


One wants to ask about modes of transportation
from Sydney to Fredericton


“connected by Acadian Lines bus” is a role in a
Nova Scotia taxonomy


“connected by SMT bus” from New Brunswick


Both are subroles of “connected”


“connected” is transitive


Note that ontologies can be combined at runtime

17
-
Sep
-
03

CS6905 Semantic Web Techniques

30

Combining Rich Ontologies


Only these facts are
explicit


in separate ontologies


“Connected by bus”


is superset


is symmetric and
transitive


Route from Sydney to
Fredericton is inferred

Connected by Acadian Lines

Connected by Acadian Lines

Sydney

Truro

Amherst

Fredericton

Connected by SMT Lines

Sussex

Connected by SMT Lines

Amherst

17
-
Sep
-
03

CS6905 Semantic Web Techniques

31

Tim Berners
-

Lee’s Semantic Web

17
-
Sep
-
03

CS6905 Semantic Web Techniques

32

Logic Layer


Clausal logic encoded in XML


RuleML, IBM CommonRules


Special cases of first
-
order logic


Horn Clauses for if
-
then type reasoning and integrity
constraints


Standard inference rules based on Resolution


Various implementations: SQL, KIF, SLD (Prolog), XSB


J
-
DREW reasoning tools in Java.


Modus operandi
: build tractable reasoning systems


trade away expressiveness, gain efficiency

17
-
Sep
-
03

CS6905 Semantic Web Techniques

33

Logic Architecture Example


Contracting parties integrate e
-
businesses via rules

Business

Rules

Business

Rules

OPS5

Prolog

Contract Rules

Interchange

Seller E
-
Storefront

Buyer’s ShopBot

17
-
Sep
-
03

CS6905 Semantic Web Techniques

34

Negotiation via rules

usualPrice:

price(per
-
unit, ?PO, $60)


purchaseOrder(?PO, supplierCo, ?AnyBuyer)


shippingDate(?PO, ?D)

(?D


24April2001).


volumeDiscountPrice:

price(per
-
unit, ?PO, $55)


purchaseOrder(?PO, supplierCo, ?AnyBuyer)


quantityOrdered(?PO, ?Q)

(?Q


1000)


shippingDate(?PO, ?D)

(?D


24April2001).


overrides(volumeDiscount, usualPrice).




17
-
Sep
-
03

CS6905 Semantic Web Techniques

35

Hot Research Topics:


Tools to create ontologies


Ontolingua


Prot
é
g
é
-
2000 (Stanford)


OILED





Tools to learn ontologies from a large corpus such
as corporate data


Merging / aligning two different ontologies from different
sources on the same topic


Searching
cum

reasoning tools


SHOE


17
-
Sep
-
03

CS6905 Semantic Web Techniques

36

Eventual Goal of these Efforts


Agents locate goods, services


use ontologies


unambiguous


business rules


expressive language but reasoning tractable


combine from various sources


Gives rise to need of trust, privacy and security


e.g. semantic web project to determine eligibility of
patients for a clinical trial

17
-
Sep
-
03

CS6905 Semantic Web Techniques

37

Extensible Markup Language

17
-
Sep
-
03

CS6905 Semantic Web Techniques

38

General Advantages of XML for KR

(1)

Definition of self
-
describing data in worldwide
standardized, non
-
proprietary format


(2)

Structured data and knowledge exchange for
enterprises in various industries


(3)

Integration of information from different sources
(into uniform documents)

XML offers new general possibilities, from which

AI knowledge representation (KR) can profit:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

39

Specific Advantages of XML for KR

XML provides the most suitable infrastructure for
knowledge bases on the Web (incl. for W3C languages
such as RDF)


Additional special KR uses of XML are:


Uniform storage of knowledge bases


Interchange of knowledge bases between
different AI languages


Exchange between knowledge bases and
databases, application systems, etc.

Even transformation/compilation of AI source programs
using XML markup and annotations is possible

17
-
Sep
-
03

CS6905 Semantic Web Techniques

40

Address Example: External to HTML

Xaver M. Linde

Wikingerufer 7

10555 Berlin

<em>
Xaver M. Linde
</em>

<br>

Wikingerufer 7

<br>

<strong>
10555 Berlin
</strong>

External Presentation:

HTML Markup:

HTML tags are still

presentation
-
oriented

17
-
Sep
-
03

CS6905 Semantic Web Techniques

41

Address Example: HTML to XML

<em>
Xaver M. Linde
</em>

<br>

Wikingerufer 7

<br>

<strong>
10555 Berlin
</strong>

HTML Markup:

XML tags are chosen for

content
-
structuring

needs

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>

</address>

XML Markup:

While not conveying

any formal semantics
:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

42

Address Example: XML to External

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>

</address>

XML Markup:

Xaver M. Linde

Wikingerufer 7

10555 Berlin

External Presentations:

XML stylesheets are,

e.g., usable to generate

different

presentations

X
aver
M
.
L
inde

Wikingerufer 7

10555 Berlin

. . .

17
-
Sep
-
03

CS6905 Semantic Web Techniques

43

<address>


<name>
Xaver M. Linde
</name>


<place>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>


</place>

</address>

Address Example: XML to XML

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>

</address>

XML Markup 1:

XML Markup 2:

XML stylesheets are

also usable to
transform

XML representations

17
-
Sep
-
03

CS6905 Semantic Web Techniques

44

Address Example: Some Stylesheets Will
Contain Term
-
(Tree
-
)Rewriting Rules

address

N

S

T

name

street

town

address

name

street

town

place

N

S

T

17
-
Sep
-
03

CS6905 Semantic Web Techniques

45

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>

</address>

WHERE


<address>


<name>
Xaver M. Linde
</name>


<street>
$s
</street>



<town>
$t
</town>


</address>

CONSTRUCT


<binding>


<s>
$s
</s>


<t>
$t
</t>


</binding>

Address Example: XML Queries

XML Markup:

XML Query (XML
-
QL):

XML queries can

select subelements

of XML elements

e
l
e
m
e
n
t

s

subelements


<binding>


<s>
Wikingerufer 7
</s>


<t>
10555 Berlin
</t>


</binding>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

46

address(


name(
"Xaver M. Linde"
),


street(
"Wikingerufer 7"
),


town(
"10555 Berlin"
)

)

Address Example: Prolog Queries

Prolog Term:

Prolog Query:

Prolog queries can

select substructures

of Prolog structures

S

= "Wikingerufer 7"

T

= "10555 Berlin"

s
t
r
u
c
t
u
r
e

s

substructures

address(


name(
"Xaver M. Linde"
),


street(
S
),


town(
T
)

)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

47

Address Example: The Element Tree

address(


name(
"Xaver M. Linde"
),


street(
"Wikingerufer 7"
),


town(
"10555 Berlin"
)

)

Prolog Term:

s
t
r
u
c
t
u
r
e

s

substructures

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>

</address>

XML Markup:

e
l
e
m
e
n
t

s

subelements

Node
-
Labeled, (Left
-
to
-
Right
-
)Ordered Element Tree:

address

Xaver M. Linde

Wikingerufer 7

10555 Berlin

name

street

town

s
u
b
t
r
e
e
s

tree

17
-
Sep
-
03

CS6905 Semantic Web Techniques

48

Address Example:

Document Type Definition and Tree (1)

<!ELEMENT
address

(
name
,
street
,
town
) >

<!ELEMENT
name

(#
PCDATA
) >

<!ELEMENT
street

(#
PCDATA
) >

<!ELEMENT
town

(#
PCDATA
) >

Document Type Definition (DTD):

Document Type Tree:

address

PCDATA

PCDATA

PCDATA

name

street

town

address
::=

name

street

town

name
::=


PCDATA

street
::=


PCDATA

town
::=


PCDATA

Extended Backus
-
Naur Form (EBNF):

17
-
Sep
-
03

CS6905 Semantic Web Techniques

49

Address Example:

Document Type Definition and Tree (2)

Document Type Tree:

<!ELEMENT
address

(
name
,
place
) >

<!ELEMENT
place

(
street
,
town
) >

<!ELEMENT
name

(#
PCDATA
) >

<!ELEMENT
street

(#
PCDATA
) >

<!ELEMENT
town

(#
PCDATA
) >

Document Type Definition (DTD):

address

PCDATA

PCDATA

PCDATA

name

street

town

place

17
-
Sep
-
03

CS6905 Semantic Web Techniques

50

Well
-
Formedness and Validity


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


Match the constraints listed
in the DTD (or, generate
from DTD as linearized
derivation tree, as shown
later)

XML principles for a
document being
well
-
formed
:

XML principle for
a document being
valid

with respect to (w.r.t.) a DTD

:

Checked by

validators

such as
http://www.stg.brown.edu/s
ervice/xmlvalid/

17
-
Sep
-
03

CS6905 Semantic Web Techniques

51

Mail
-
Box Example: Address Variant

Node
-
Labeled, (Left
-
to
-
Right
-
)Ordered Element Tree:

address(


name(
"Xaver M. Linde"
),


box(
"2001"
),


town(
"10555 Berlin"
)

)

Prolog Term:

<address>


<name>
Xaver M. Linde
</name>


<box>
2001
</box>



<town>
10555 Berlin
</town>

</address>

XML Markup:

address

Xaver M. Linde

2001

10555 Berlin

name

box

town

17
-
Sep
-
03

CS6905 Semantic Web Techniques

52

"|"
-
Disjoined Street/Mail
-
Box Example:

Document Type Definition and Tree

Document Type Tree:

<!ELEMENT
address

(
name
, (
street
|
box
),
town
) >

<!ELEMENT
name

(#
PCDATA
) >

<!ELEMENT
street

(#
PCDATA
) >

<!ELEMENT
box

(#
PCDATA
) >

<!ELEMENT
town

(#
PCDATA
) >

Document Type Definition (DTD):

address

PCDATA

PCDATA

PCDATA

name

street

town

PCDATA

box

"|": Choice

The above box address
and the original street

address are valid w.r.t.

this "|"
-
DTD

17
-
Sep
-
03

CS6905 Semantic Web Techniques

53

Phone & Fax Example: Address Variant

Node
-
Labeled, (Left
-
to
-
Right
-
)Ordered Element Tree:

address(


name(
"Xaver M. Linde"
),


street(
"Wikingerufer 7"
),


town(
"10555 Berlin"
),


phone(
"030/1234567"
),


phone(
"030/1234568"
),


fax(
"030/1234569"
)

)

Prolog Term:

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>


<phone>
030/1234567
</phone>


<phone>
030/1234568
</phone>


<fax>
030/1234569
</fax>

</address>

XML Markup:

address

Xaver M. Linde

Wikingerufer 7

10555 Berlin

name

street

town

030/1234567

030/1234569

030/1234568

phone

phone

fax

17
-
Sep
-
03

CS6905 Semantic Web Techniques

54

"+"/"*"
-
Repetitive
-
Phone &
-
Fax Example:

Document Type Definition and Tree

Document Type Tree:

<!ELEMENT
address

(
name
,
street
,
town
,

phone
+,
fax
*) >

<!ELEMENT
name

(#
PCDATA
) >

<!ELEMENT
street

(#
PCDATA
) >

<!ELEMENT
town

(#
PCDATA
) >

<!ELEMENT
phone

(#
PCDATA
) >

<!ELEMENT
fax


(#
PCDATA
) >

Document Type Definition (DTD):

address

PCDATA

PCDATA

PCDATA

name

street

town

PCDATA

phone

PCDATA

fax

"+"/"*": One/Zero or More


The above two
-
phone/one
-
fax
address is valid w.r.t. this
"+"/"*"
-
DTD but the
original no
-
phone/no
-
fax
address is not (

1 phone!)


17
-
Sep
-
03

CS6905 Semantic Web Techniques

55

Country Example: Address Variant

Node
-
Labeled, (Left
-
to
-
Right
-
)Ordered Element Tree:

address(


name(
"Xaver M. Linde"
),


street(
"Wikingerufer 7"
),


town(
"10555 Berlin"
),


country(
"Germany"
)

)

<address>


<name>
Xaver M. Linde
</name>


<street>
Wikingerufer 7
</street>



<town>
10555 Berlin
</town>


<country>
Germany
</country>

</address>

XML Markup:

address

Xaver M. Linde

Wikingerufer 7

10555 Berlin

name

street

town

Germany

country

Prolog Term:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

56

"?"
-
Optional
-
Country Example:

Document Type Definition and Tree

Document Type Tree:

<!ELEMENT
address

(
name
,
street
,
town
,
country
?) >

<!ELEMENT
name

(#
PCDATA
) >

<!ELEMENT
street

(#
PCDATA
) >

<!ELEMENT
town

(#
PCDATA
) >

<!ELEMENT
country

(#
PCDATA
) >

Document Type Definition (DTD):

address

PCDATA

PCDATA

PCDATA

name

street

town

PCDATA

country

"?": One or Zero

The above country
address and the
original countriless

address are valid w.r.t.

this "?"
-
DTD

17
-
Sep
-
03

CS6905 Semantic Web Techniques

57

Country Address: A Complete XML
Document Referring to an External DTD

<?xml version="1.0" standalone="no"?>

<!DOCTYPE address SYSTEM "country
-
address.dtd">

<address>


<name>Xaver M. Linde</name>


<street>Wikingerufer 7</street>


<town>10555 Berlin</town>


<country>Germany</country>

</address>

XML Document (just ASCII, e.g. stored in a file):

The
XML declaration

uses standalone attribute with "no" value: DTD import


The
DOCument TYPE declaration

names the
root element

address and, after
the
SYSTEM keyword
, refers to an
external DTD

"country
-
address.dtd"
(or, at some absolute URL, to an "http://www.test.org/country
-
address.dtd")

17
-
Sep
-
03

CS6905 Semantic Web Techniques

58

Horn Logic Markup Languages

17
-
Sep
-
03

CS6905 Semantic Web Techniques

59

Herbrand Terms: Individual Constants,

Variables, Flat Ground Structures, ...


Individual constant

for channel
-
tunnel between Britain and
France: element
<ind>
channel
-
tunnel
</ind>



Ground structure


undersea
-
connection(britain,france)


is
<struc>
element with embedded element for constructor,
followed by elements for argument terms:

Representation of Herbrand terms in XML as

<ind>

and

<struc>

elements (
<var>
similar):

<struc>


<constructor>
undersea
-
connection
</constructor>


<ind>
britain
</ind>


<ind>
france
</ind>

</struc>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

60

Herbrand Terms: ...,

Nested Ground Structures

service
-
tunnel(


undersea
-
connection(


britain,


surrounded
-
country(


belgium,


luxembourg,


germany,


switzerland,


italy,


spain)))

<struc>


<constructor>
service
-
tunnel
</constructor>


<struc>


<constructor>
undersea
-
connection
</constructor>


<ind>
britain
</ind>


<struc>


<constructor>
surrounded
-
country
</constructor>


<ind>
belgium
</ind>


<ind>
luxembourg
</ind>


<ind>
germany
</ind>


<ind>
switzerland
</ind>


<ind>
italy
</ind>


<ind>
spain
</ind>


</struc>


</struc>

</struc>

Embedded
<struc>

elements:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

61

Interim Discussion: Tag and Type


In Prolog not clear, in isolation, that channel
-
tunnel is
individual constant, whereas service
-
tunnel is constructor



In XML, as in strongly typed LP languages, made explicit
-

however at every occurrence of a symbol



Example gives impression of self
-
description advantage
-

but
also ‘space requirement’
-

of this generous application of
“syntactic sugar”

17
-
Sep
-
03

CS6905 Semantic Web Techniques

62

Horn Clauses: Relation Symbol
Applications

Predicate or
relation symbol

in XML is
<relator>

element.

For example, relation symbol travel is

<relator>
travel
</relator>


Relation symbol application to terms

is labeled with

<relationship>

element.

Application travel(john,channel
-
tunnel)

on two individual constants thus is


<relationship>


<relator>
travel
</relator>


<ind>
john
</ind>


<ind>
channel
-
tunnel
</ind>

</relationship>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

63

Horn Clauses: Facts

Hence, Horn fact can be asserted as
<hn>

element that
possesses
<relationship>

elements as subelements


In the example, the Prolog fact


travel(john,channel
-
tunnel).


becomes


<hn>


<relationship>


<relator>
travel
</relator>


<ind>
john
</ind>


<ind>
channel
-
tunnel
</ind>


</relationship>

</hn>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

64

Horn Clauses: Rules

Then, Horn rule is asserted as
<hn>

Element

that has a

head
<relationship>

element followed by at least one

body
<relationship>

element

So, above example generalized to Prolog rule


travel(Someone,channel
-
tunnel) :
-

carry(eurostar,Someone).


<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>

</hn>

and rewritten as

17
-
Sep
-
03

CS6905 Semantic Web Techniques

65

Attributes for Extended Logics

Nested elements
-

trees
-

allow representation of

arbitrary information, but in some situations lead

to unnecessarily deeply/widely nested representations


Therefore XML
attributes
:

Start
-
Tag is ‘attributed’ with
n

attribute
-
value pairs
a
i
=
v
i

Element:
<
tag

a
1
=
v
1

...
a
n
=
v
n
>

. . .
</
tag
>



Helpful Prolog uses of XML attributes are arity labelings of

relation symbols such as our binary relation symbol travel:

Prolog’s travel/2 in XML with an arity attribute becomes

<relator

arity="2"
>
travel
</relator>


Analogously, annotations become possible on arbitrary

element levels: mode declarations for logic variables,

determinism specifications for clauses or procedures,

and context conditions for entire knowledge bases

17
-
Sep
-
03

CS6905 Semantic Web Techniques

66

ID

and IDREF

Attribute types ID and IDREF for naming and

referencing of elements


ID
-
typed value must uniquely identify an element

and IDREF
-
typed value must occur as ID value of

an element


E.g., clause can be named
(in a hypothesis knowledge base)
:


<hn

id="john
-
channel"
>


<relationship>


<relator>
travel
</relator>


<ind>
john
</ind>


<ind>
channel
-
tunnel
</ind>


</relationship>

</hn>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

67

Now a “modal Prolog fact”


belief(mary,travel(john,channel
-
tunnel)).


can access the "john
-
channel" assertion:


<hn>


<relationship>


<relator>
belief
</relator>


<ind>
mary
</ind>


<prop

idref="john
-
channel"
/>


</relationship>

</hn>


Propositional argument of the belief operator written as
<prop

idref="john
-
channel"
/>

(XML abbreviation of
empty elements
<
tag

...
>

</
tag
>

to
<
tag

...
/>
)


Also disbelief fact has "john
-
channel" access with
idref: ID/IDREF “break out of the tree” and enable
‘sharing’

ID and
IDREF

17
-
Sep
-
03

CS6905 Semantic Web Techniques

68

Up to now:

Examples for Horn Logic in XML etc.

Now:


General language definition


XML's
Document type definitions (DTDs)

initially only as
ELEMENT declarations

for
non
-
attributed elements


For nonterminals:

DTD


ordinary context
-
free grammar
in modified (EBNF) notation


For terminals:

Usually arbitrary permutations of the base
alphabet ("PCDATA'') instead of fixed terminal sequences


DTD grammar derives context
-
free word patterns:

derivation trees themselves
-

linearized through brackets
-

as generated result


XML element is
valid

with respect to DTD:

can be generated from DTD as linearized derivation tree

DTDs: Elements as Derivation Trees

17
-
Sep
-
03

CS6905 Semantic Web Techniques

69

Syntactic ELEMENT declaration of Horn logic as a
knowledge base (kb) of zero or more Horn clauses (hn*):


<!ELEMENT kb





(hn*) >


<!ELEMENT hn





(relationship, relationship*) >


<!ELEMENT relationship

(relator, (ind | var | struc)*) >


<!ELEMENT struc




(constructor, (ind | var | struc)*) >


<!ELEMENT relator



(#PCDATA) >


<!ELEMENT constructor

(#PCDATA) >


<!ELEMENT ind





(#PCDATA) >


<!ELEMENT var





(#PCDATA) >

DTDs: Defining Horn Logic in XML

Note

struc

recursion!

17
-
Sep
-
03

CS6905 Semantic Web Techniques

70

(Start
-
)symbol kb brackets derived clause(s) as linearized

start
-
tag/end
-
tag
-
tree representation
<kb>

. . .
</kb>
:


kb


<kb>

hn*
</kb>

. . .

<kb> <hn>

relationship relationship
</hn> </kb>

. . .

<kb>


<hn>


<relationship>


<relator>
#PCDATA
</relator> <var>
#PCDATA
</var> <ind>
#PCDATA
</ind>


</relationship>


<relationship>


<relator>
#PCDATA
</relator> <ind>
#PCDATA
</ind> <var>
#PCDATA
</var>


</relationship>


</hn>

</kb>

DTDs:

Generation of the Example Rule (1)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

71

<kb>


<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>


</hn>

</kb>

DTDs:

Generation of the Example Rule (2)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

72

DTDs for
attributed elements
:
ATTLIST declarations
, which
associate element name with an attribute name plus attribute type
and possible occurrence indication


1st Example:

declare the relator attribute arity as CDATA
-
typed
(cf. #PCDATA) and occurring optionally (#IMPLIED):


<!ATTLIST relator arity CDATA #IMPLIED >


2nd Example (Preparation):

define the extended Horn logic
with (named hn clauses and) embedded propositions:


<!ELEMENT relationship

(relator, (ind|var|struc|prop)*) >


<!ELEMENT prop EMPTY >

Attribute DTDs (1)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

73

2nd Example (Execution):

Append an ATTLIST declaration that
specifies, for the hn respectively prop elements, the attributes

id
-

as optional ID type
-

respectively

idref
-

as mandatory IDREF type:


<!ATTLIST hn



id



ID



#IMPLIED >


<!ATTLIST prop


idref

IDREF

#REQUIRED >


With entire DTD now, e.g., earlier "john
-
channel"
-
named fact and
its accessing facts can be generated

Attribute DTDs (2)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

74

Assume fact:


<hn>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>





carry(eurostar,fred).


<ind>
fred
</ind>


</relationship>

</hn>


A Horn
-
logic interpreter can use it to answer this query:


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>






carry(eurostar,Someone)


<var>
someone
</var>

</relationship>


by binding


<var>
someone
</var>






Someone


to

<ind>
fred
</ind>








fred


Horn Queries in XML Notation

17
-
Sep
-
03

CS6905 Semantic Web Techniques

75

With carry basis fact



















carry(eurostar,fred).


a rule is usable to dynamically derive travel assertions as
needed, without having to store them all
-
inclusively and
statically:



travel(Someone,channel
-
tunnel) :
-

carry(eurostar,Someone).



That is, its earlier XML version is useable by a Horn
-
logic
interpreter for inferential queries like



travel(fred,Where)


carry(eurostar,Someone)


true

Horn Inferences in XML Notation (1)

Someone=fred


Where=channel
-
tunnel


Where=channel
-
tunnel

17
-
Sep
-
03

CS6905 Semantic Web Techniques

76

Rule:

<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>

</hn>

Horn Inferences in XML Notation (2)

<relationship>


<relator>
travel
</relator>


<ind>
fred
</ind>


<var>
where
</var>

</relationship>

<relationship
someone="fred"

where="channel
-
tunnel"
>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>

</relationship>


<ind
where="channel
-
tunnel"
>


true

</ind>


Fact:

<hn>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<ind>
fred
</ind>


</relationship>

</hn>

3
-
Step Animation:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

77

Rule:

<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>

</hn>

Horn Inferences in XML Notation (2)

<relationship>


<relator>
travel
</relator>


<ind>
fred
</ind>


<var>
where
</var>

</relationship>

Fact:

<hn>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<ind>
fred
</ind>


</relationship>

</hn>

3
-
Step Animation:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

78

Rule:

<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>

</hn>

Horn Inferences in XML Notation (2)

Fact:

<hn>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<ind>
fred
</ind>


</relationship>

</hn>

3
-
Step Animation:

<relationship
someone="fred"

where="channel
-
tunnel"
>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>

</relationship>

17
-
Sep
-
03

CS6905 Semantic Web Techniques

79

Rule:

<hn>


<relationship>


<relator>
travel
</relator>


<var>
someone
</var>


<ind>
channel
-
tunnel
</ind>


</relationship>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<var>
someone
</var>


</relationship>

</hn>

Horn Inferences in XML Notation (2)

Fact:

<hn>


<relationship>


<relator>
carry
</relator>


<ind>
eurostar
</ind>


<ind>
fred
</ind>


</relationship>

</hn>

3
-
Step Animation:


<ind
where="channel
-
tunnel"
>


true

</ind>


17
-
Sep
-
03

CS6905 Semantic Web Techniques

80

Horn Inferences: SLD
-
Resolution,

XML
-
QL Implementation, Open World


This inference is carried out as an SLD
-
resolution step


The procedural semantics of SLD
-
resolution can be used


An XML
-
QL implementation seems possible as for queries


A functional
-
logic generalization of HornML is
RFML



If distribution of the clauses over different documents in the

Web is assumed, in this “open world” logical completeness,

in particular, can hardly still be asked for

17
-
Sep
-
03

CS6905 Semantic Web Techniques

81

The Java Deductive Reasoning Engine
for the Web

17
-
Sep
-
03

CS6905 Semantic Web Techniques

82

Train people to build the Rule
-
based
web services


Courses on systems employing rule engines
and Internet applications


Writing deduction engines in Java/C/C++


Interfacing with Internet API


Old techniques (Prolog 30 years ago)


New techniques from CADE System Competition


Meier and Warren’s book: Programming in
Logic, 1988


Updated in Java?


Specific to Prolog at low level

17
-
Sep
-
03

CS6905 Semantic Web Techniques

83

Will such a course work?


No


Guts of Prolog, Internet API’s, how to program in logic


At least three courses here


Yes


Students understand recursion


How to build a tree

how to search a space


Propositional theorem prover


how to interface to Internet

17
-
Sep
-
03

CS6905 Semantic Web Techniques

84

This talk


Architecture for building deduction systems


first order


easily configured


forward or backward


embedded


supports calls to and from rest of system


Tour of internals


backward & forward engines


tree/proof


terms


bindings


discrimination tree


Prototypes


17
-
Sep
-
03

CS6905 Semantic Web Techniques

85

Choose the right abstractions


Goal, Unifier, ProofTree


use Java iterators: pay as you go


for finding the next proof


Make every Goal responsible for its list of
matching clauses


hasNextMatchingClause()


attachNextMatchingClause()


Place Goals in stack of backtrack points


popped in reverse chronological order

17
-
Sep
-
03

CS6905 Semantic Web Techniques

88

Propositional Prover

initially proofTree has an open Goal

loop


if(proofTree.hasNoOpenGoal())


halt('success');


else


Goal g = proofTree.selectOpenGoal();


g.createMatchingClauseList();


if(g.hasMoreMatchingClauses())


DefiniteClause c = g.nextClause();




g.attachClause(c);


choicePoints.push(g);


else


chronologicalBacktrack();

Java Iterator

chronologicalBacktrack


while(choicePoints.nonEmpty())


Goal g = choicePoints.pop();


g.removeAttachedClause();


if(g.hasMoreClauses())


return;


halt('failure')


Create bindings

Remove bindings

17
-
Sep
-
03

CS6905 Semantic Web Techniques

89

Tree with initial goal p(Z)

p(X) :
-

q(X), r(X).

q(g(X)).

q(k).

r(g(h))

p(Y1) :
-

q(Y1), r(Y1)

?:
-
p(Z)

a

a

ChoicePoints

b

Z/Y1

q(g(Y2))

r(g(h))

b

c

c

Y1/g(Y2)

Y2/h

q(k)

Y1/k

b’

b’

17
-
Sep
-
03

CS6905 Semantic Web Techniques

90

Moving to First Order Logic


Students struggle with variables


Unification


Composition of substitutions


Unbinding on backtracking



Can we hide the hard stuff?


Powerful abstraction

17
-
Sep
-
03

CS6905 Semantic Web Techniques

92

Shallow or deep variables?


Deep


variable binding is a list of replacements


traverse list for each lookup


undoing: remove most recent replacements

{X


f(Y)}


{Y


a}



Shallow


an array of (all) variables and their current values

[X


f(a)


Y


a


…]


undoing: pop stack of previous values (trail)


17
-
Sep
-
03

CS6905 Semantic Web Techniques

94

Goal Tree and flatterms


Each node has head and
body atoms


Body atoms form goals


attach children


resolved
p
1

from


d


p
1
, …, p
m

against
q
from


q


q
1
, …, q
n


resolved
p
m

a
gainst
r

.

p

q

q
1

q
n

r

N

C

D

p
1

p
m

17
-
Sep
-
03

CS6905 Semantic Web Techniques

95

Flatterms to represent atoms


j
-
DREW uses flatterms


Array of pairs:


symbol table ref


length of subterm


Not structure sharing


Flatterms save theorem
provers time and space
(de Nivelle, 1999)


Data transfer between
deduction engine and
rest of application


17
-
Sep
-
03

CS6905 Semantic Web Techniques

96

Variables are clause
-
specific


Variables use
negative

indexes


Bindings are
references to
flatterm &

position




Unifier

X



g
2

Y



f(g
2
)

W


h(g
2
)

Z



f(g
2
)


17
-
Sep
-
03

CS6905 Semantic Web Techniques

97

Composing and undoing Bindings


Local shallow bindings currently do not allow
composition


bindings must be done to a flatterm


new binding on a new flatterm



Backtracking is integrated with unbinding


for quick unbinding, we use a stack of flatterms for
each goal.

17
-
Sep
-
03

CS6905 Semantic Web Techniques

99

Discrimination trees


Given a goal we want to access matching clauses
quickly


Every
-
argument addressing


unlike Prolog’s first argument addressing


Useful for RDF triples


a pattern may have variable in first argument


rdf(X, ownedby, ‘Ora Lassila’)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

100

Discrimination trees


Given a goal, want to access
input clauses with matching
heads quickly


Index into clauses via a
structure built from heads


Replace vars by *


imperfect discrimination


merge prefixes as much as
possible


a tree arises




*

p

q

r

f

g
1

h

*

h

h

g
1

*

f

g
2

*


We added

p(f(g
1

),h(g
2

),g
1

)

p(f(h(

X

)),h(Y

),f(Z, Z))




17
-
Sep
-
03

CS6905 Semantic Web Techniques

101

Finding heads for goal p(X,h(g
2
),Y)


replace vars in goal by *



p(*,h(g
2
),*)



Find instances of goal


* in goal, skip subtree




Find generalizations of goal


* in tree, skip term in goal



p(f(g
1

),h(g
2

),g
1

)

p(f(h(

X

)),h(Y

),f(Z, Z))


p

q

r

f

g
1

h

*

h

h

g
1

*

f

g
2

*


Find unifiable


combination of both

17
-
Sep
-
03

CS6905 Semantic Web Techniques

102

Iterator for matching clauses


We use Java idioms where possible


Java’s iterators give access to sequence


next()


hasNext()


Used for access to sequence of matching clauses


used in discrimination tree for access to roots leaves of
skipped tree

(McCune’s term: jump
-
list)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

103





17
-
Sep
-
03

CS6905 Semantic Web Techniques

104






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

17
-
Sep
-
03

CS6905 Semantic Web Techniques

105


Gravalax is the intersection of
Cured and Salmon, but not
Smoked






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

Gravalax

17
-
Sep
-
03

CS6905 Semantic Web Techniques

106


Lox is Smoked, Cured Salmon


Gravalax is the intersection of
Cured and Salmon, but not
Smoked






SmokedSalmon is the intersection
of Smoked and Salmon


Smoked Salmon

Gravalax

Lox

17
-
Sep
-
03

CS6905 Semantic Web Techniques

107




A search for keywords
Salmon and Cured should
return pages that mention
Gravalax, even if they don’t
mention Salmon and Cured



A search for Salmon and
Smoked will return pages
with smoked salmon, should
also return pages with Lox,
but not Gravalax

Smoked Salmon

Lox

Gravalax

The Semantic Web vision is to make information on
the web “understood” by computers, for searching,

categorizing, …

17
-
Sep
-
03

CS6905 Semantic Web Techniques

108


Smoked Salmon

Lox

Gravalax

17
-
Sep
-
03

CS6905 Semantic Web Techniques

109

One possible encoding

Search criteria:

retrieve(P) :
-



about(P, cured),


about(P, salmon).


Ontology:

about(P, cured) :
-


about(P, gravalax).

about(P, salmon) :
-


about(P, gravalax).

A search for keywords
Salmon and Cured
should return pages
that mention Gravalax,
even if they don’t
mention Salmon and
Cured.

about(p1, gravalax).


retrieve(p1) succeeds

17
-
Sep
-
03

CS6905 Semantic Web Techniques

110



retrieve(P) :
-



about(P, smoked),


about(P, salmon).


about(P, cured) :
-


about(P, lox).

about(P, salmon) :
-


about(P, lox).

about(P, smoked) :
-


about(P, lox).

about(P, cured) :
-


about(P, gravalax).

about(P, salmon) :
-


about(P, gravalax).

A search for Salmon
and Smoked will
return pages with
smoked salmon,
should also return
pages with Lox, but
not Gravalax.

about(p1, gravalax).

about(p2, lox).


retrieve(p1) fails

retrieve(p2) succeeds

17
-
Sep
-
03

CS6905 Semantic Web Techniques

111

Working Prototypes:


Basic Prolog Engine


Accepts RuleML, or Prolog, or mixture


Iterator for instances of the top goal


Main loop is same code as propositional theorem prover
(shown earlier)


Builds, displays deduction tree


available to rest of system


Negation as failure

17
-
Sep
-
03

CS6905 Semantic Web Techniques

112

More working prototypes:

Variants of Top
-
Down Engine


User directed


User selects goals


User chooses clauses


keeps track of clauses still left to try


Good teaching tool


Bounded search


iteratively increase bound


every resolution in search space will eventually be tried


a fair selection strategy


Original variable names supplied


particularly important for RuleML

17
-
Sep
-
03

CS6905 Semantic Web Techniques

116

Bottom
-
Up / Forward Chaining


Set of support prover for definite clauses


Facts are supports



Theorem: Completeness preserved when
definite clause resolutions are only between
first negative literal and fact.


Proof: completeness of lock resolution (Boyer’s PhD)


Use standard search procedure to reduce
redundant checking (next)


Unlike OPS/Rete, returns proofs and uses first
order syntax for atoms

17
-
Sep
-
03

CS6905 Semantic Web Techniques

117

Theorem Prover’s Search Procedure


Priority queue


new facts


Discrimination
trees:


used facts


rules, indexed on

first goal

main loop


select new fact


for each matching rule


resolve


process new result



add to old facts

process new result(C)


if C is rule


for each old fact matching first goal


resolve


process new result


add C to rules


else


add C to new facts



17
-
Sep
-
03

CS6905 Semantic Web Techniques

118

Event


Condition
-

Action


Suppose theorem prover saturates


may need datalog, subsumption


Then a new fact is added from


push process


Java event listener


adding a fact restarts saturation


could generate new Java events


ECA interaction with Java 1.1 events

17
-
Sep
-
03

CS6905 Semantic Web Techniques

119

j
-
DREW sound and complete


Sound unification


Search complete variant


fair search procedure rather than depth
-
first


uses increasing bounds


Sound negation


delay negation
-
as
-
failure subgoals


until ground or until only NAF goals remain

17
-
Sep
-
03

CS6905 Semantic Web Techniques

120

Related Work


j
-
DREW compared to Prolog


j
-
DREW not compiled


More flexible


Dynamic additions


Web
-
ized


Programmer’s API


Performance requirements different


j
-
DREW unlikely to yield megalips

17
-
Sep
-
03

CS6905 Semantic Web Techniques

122

Summary


Architecture for Java
-
based reasoning engines


forward & backward


Backward: variable binding/unbinding automatic



tied with choicepoints


configurable


Integrated with other Java APIs


Small footprint


Depolyed as thread, on server, on client, mobile


Dynamic additions to rules


Integration of RuleML and Prolog rules in same proofs


Proofs available

17
-
Sep
-
03

CS6905 Semantic Web Techniques

123

The Rule Markup Language

17
-
Sep
-
03

CS6905 Semantic Web Techniques

124

Motivation (I)


Rules in (and for) the Web have become a
mainstream topic since


inference rules

were


marked up for E
-
Business


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


Web Services

17
-
Sep
-
03

CS6905 Semantic Web Techniques

125

Motivation (II)


The
Rule Markup Initiative

has taken initial steps towards
defining a shared
Rule Markup Language (RuleML)
for
interoperation between the currently 34

Participant Groups

around the world


RuleML permits rules in XML & RDF/DAML+OIL for


derivation,
query
, transformation
(stable DTDs/Schemas)


integrity checking
(still regarded as special queries)


reactive behavior
(currently as translators to, e.g., Jess)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

126

Semantic Web and Web Services

Use Databases and Rule Systems

Databases: SQL

(Integration of) Schemas & Dictionaries


(Distributed) Transaction Processing


Triggers & Events

Rule Systems: RuleML

Derivation Rules


Transformation Rules


Reaction Rules

Category
-
Based Search Engines

& Document Retrieval


Formal Ontologies

& Metadata Repositories


First
-
Order Logic

& Knowledge Representation

Semantic Web: DAML+OIL

Mediator Agents

& Information Integration


Interface Descriptions

& CGI Scripts


Communication Protocols

& Remote Procedure Calls

Web Services : WSDL

17
-
Sep
-
03

CS6905 Semantic Web Techniques

127

Merchant
1

Merchant
m

. . .

Customer or Company

publish

rulebase
1

publish

rulebase
m

compare, instantiate,

and run rulebases

Rule Systems

for

Web
-
Based B2C

or

B2B Rule Exchange

translate to

standard format

(e.g., RuleML)

17
-
Sep
-
03

CS6905 Semantic Web Techniques

128

From Natural Language to Horn Logic

Prolog
-
like formalization (syntax generated from XML):

''The
discount

for a
customer

buying a
product

is
5.0
percent

if the
customer

is
premium

and the
product

is
regular
.''

''The
discount

for a
customer

buying a
product

is
7.5
percent

if the
customer

is
premium

and the
product

is
luxury
.''

. . .

English Business Rules:

17
-
Sep
-
03

CS6905 Semantic Web Techniques

129

RuleML: Markup and Tree

''The
discount

for a
customer

buying a
product

is
5.0
percent

if the
customer

is
premium

and the
product

is
regular
.''


<
imp
>


<_head>


<
atom
>


<_opr><rel>
discount
</rel></_opr>


<var>customer</var>


<var>product</var>


<ind>
5.0 percent
</ind>


</
atom
>


</_head>


<_body>


<and>


<
atom
>


<_opr><rel>
premium
</rel></_opr>


<var>customer</var>


</
atom
>


<
atom
>


<_opr><rel>
regular
</rel></_opr>


<var>product</var>


</
atom
>


</and>


</_body>


</
imp
>

imp


head


atom


opr rel
discount


var customer


var product


ind
5.0 percent





body


and


atom


opr rel
premium


var customer



atom


opr rel
regular


var product





17
-
Sep
-
03

CS6905 Semantic Web Techniques

130

Intertranslating RuleML and RFML

''The
discount

for a
customer

buying a
product

is
5.0
percent

if the
customer

is
premium

and the
product

is
regular
.''


<
imp
>


<_head>


<
atom
>


<_opr><rel>
discount
</rel></_opr>


<var>customer</var>


<var>product</var>


<ind>
5.0 percent
</ind>


</
atom
>


</_head>


<_body>


<and>


<
atom
>


<_opr><rel>
premium
</rel></_opr>


<var>customer</var>


</
atom
>


<
atom
>


<_opr><rel>
regular
</rel></_opr>


<var>product</var>


</
atom
>


</and>


</_body>


</
imp
>


<
hn
>



<
pattop
>


<con>
discount
</con>


<var>customer</var>


<var>product</var>


<con>
5.0 percent
</con>


</
pattop
>





<
callop
>


<con>
premium
</con>


<var>customer</var>


</
callop
>


<
callop
>


<con>
regular
</con>


<var>product</var>


</
callop
>




</
hn
>

ruleml2rfml.xsl

rfml2ruleml.xsl

17
-
Sep
-
03

CS6905 Semantic Web Techniques

131

Structure of the RuleML DTD Hierarchy


Our system of DTDs (current version: 0.8) 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 (conformance
“lattice”) corresponds to a specific RuleML
sublanguage:


‘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


17
-
Sep
-
03

CS6905 Semantic Web Techniques

132

The Module Hierarchy of RuleML DTDs

urc
-
bin
-
data
-
ground
-
fact

urc
-
bin
-
data
-
ground
-
log

urc
-
bin
-
datalog

bin
-
datalog

urc
-
datalog

ur
-
datalog

ur
-
hornlog

ur
-
equalog

hornlog

equalog

datalog

ur

Rooted DAG will be extended with

branches for further sublanguages

URL/URI
-
like

‘ur’
-
objects

ruleml

RDF
-
like triples

ur
-
datalog =
join(ur,datalog)