Rules and the Semantic Web

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

21 Οκτ 2013 (πριν από 4 χρόνια και 18 μέρες)

94 εμφανίσεις

Rules and the Semantic Web
Michel Dufresne,
PhD.
Dufresne Consulting, LLC
©2007 Dufresne

Consulting, LLC

You can't get there by bus, only by hard work
and risk and by not quite knowing what
you're doing. What you'll discover will be
wonderful. What you'll discover will be
yourself.

Alan Alda
©2007 Dufresne

Consulting, LLC
2
Top Engine
The Semantic Web Engine for the Enterprise
Outline

Web Ontology Language (OWL)

Using Description Logic (DL) for modeling domain model

Description Logic and Logic programs

Rules on top of ontologies
Integrating OWL DL into a Model-Driven
Architecture (MDA)

RDF for representing domain model

Integration with Rule Engines
Building Web-based business applications

Generating Domain Model proxy classes from ontology

Querying the RDF graph
©2007 Dufresne

Consulting, LLC
3
Top Engine
The Semantic Web Engine for the Enterprise
Web Ontology Language
Web Ontology Language (OWL)

W3C Standard (http://www.w3.org/2004/OWL/):

OWL builds on RDF and RDF Schema and adds more vocabulary
for describing properties and classes: among others, relations
between classes (e.g. disjointness), cardinality (e.g. "exactly
one"), equality, richer typing of properties, characteristics of
properties (e.g. symmetry), and enumerated classes.”

OWL comes in three flavors:

OWL Lite / OWL DL (Description Logic) / OWL Full
©2007 Dufresne

Consulting, LLC
4
Top Engine
The Semantic Web Engine for the Enterprise
OWL DL
OWL DL is based on Description Logic

Provides maximum expressiveness without loosing computational
completeness (all entailments are computed) and decidability (computed in
a finite time).

A class describes the set of individuals with common characteristics
A sub-class is the sub-set of the individuals of the parent class:
A=5

B
A=5
B=2
A=3

B
X
One big difference between the
object-oriented (OO) and DL
formalisms is that in OO
derived classes can redefine
properties of the parent class.
©2007 Dufresne

Consulting, LLC
5
Top Engine
The Semantic Web Engine for the Enterprise
Description Logic is based on a formal Logic-
based semantics

Consider Class A and Class B

Union
; Class A
OR
B
(A

B)

Intersection
; Class A
AND
B
(A

B)

Complement
;
NOT
Class A
(
¬A)
A
B
A
B
B
A
A
B
Description Logic
©2007 Dufresne

Consulting, LLC
6
Top Engine
The Semantic Web Engine for the Enterprise
The basic building blocks of class axioms
OWL distinguishes six types of Class Descriptions:
1.

A class identifier (a URI reference) – known as a
Primitive Class
in DL
2.

An exhaustive enumeration of the individuals;
{a
i


a
n
}
3.

A property restriction

Value constraint

Existential constraint;
∃P(A)

Universal constraint;
∀P(A)

Cardinality constraint

Maximum cardinality;

n
P(A)

Minimum cardinality;

n
P(A)

Exact cardinality;
=
n
P(A)

Functional Property and Inverse Functional property restrictions
4.

The
intersection
of two or more Class Descriptio
ns;
(A
⊓ B)
5.

The
union
of two or more Class Descriptio
ns;
(A

B)
6.

The
complement
of a Class Descriptio
n;
(
¬
A)
Class Descriptions
©2007 Dufresne

Consulting, LLC
7
Top Engine
The Semantic Web Engine for the Enterprise
New classes can be defined from class expression

Consider Class D
as the members of Classes A
AND
B (
intersection
axiom)
D ≡ A ⊓ B
For example if:

Class A the set of
Late 19
th
century French painting style;


Class B the set of
Artifacts with paint strokes of unmixed colors;

Class D is the set of
Impressionism Paintings
Then we have:
(
Impressionism Paintings
)

(
Late 19
th
century French painting
style
)

(
Artifacts with paint strokes of unmixed colors
)
or:

The Impressionism Paintings are defined as the set of artifacts
with Late 19
th
century French painting style and strokes of
unmixed colors”
Class Constructors
©2007 Dufresne

Consulting, LLC
8
Top Engine
The Semantic Web Engine for the Enterprise
More complex expression can be build
Building on the previous example:

An Impressionism Art Collector is an Art Collector that has at least
one Impressionism painting”
which is express as:
(
Impressionism Art Collector
)
≡ (
Art Collector)


hasArtifact
(
Impressionism Paintings
)
and:
(
Impressionism Paintings
)

(
Late 19
th
century French painting
style
)

(
Artifacts with paint strokes of unmixed colors
)
Class Constructors
©2007 Dufresne

Consulting, LLC
9
Top Engine
The Semantic Web Engine for the Enterprise
Using a visual diagram
Artifact
Impressionism
Painting

An Impressionism Art Collector is an Art
Collector that has at least one
Impressionism painting”
Logical Entailment
OWL DL – Visual Example
Art Collector
hasArtifact(
Artifact
)
Impressionism Art Collector
(Art Collector) ⊓

hasArtifact(
ImpressionismPainting
)
©2007 Dufresne

Consulting, LLC
10
Top Engine
The Semantic Web Engine for the Enterprise
Impressionism Painting
{(Late 19
th
C. Painting style)

(Artifact with paint strokes of
unmixed color)}
Artifact
Late 19
th
C.
Painting style
Artifact with
paint strokes of
unmixed color
Logical Entailment

The Impressionism Paintings is
defined as the set of artifacts
with Late 19
th
century French
painting style and strokes of
unmixed colors”
OWL DL – Visual Example
Using a visual diagram
©2007 Dufresne

Consulting, LLC
11
Top Engine
The Semantic Web Engine for the Enterprise
Description Logic and Logic Programs

Description Logic (DL)

DL complies to
open-world semantics
:

OWL is a language for the web and cannot assume that the knowledge
in the KB is complete

DL is
monotonic
Logic Programs (LP)

LP complies to
closed-world semantics
:

Well known semantics used in relational databases

LP is
non-monotonic
Mapping between DL and LP exist

Mapping DL into LP is fairly straightforward
Benjamin N. Grosof, Ian Horrocks, Raphael Volz, and Stefan Decker. Description Logic Programs: Combining Logic Programs
with Description Logic. In Proc. 12th Intl. Conf. on the World Wide Web (WWW-2003). Budapest, Hungary, May 2003.
©2007 Dufresne

Consulting, LLC
12
Top Engine
The Semantic Web Engine for the Enterprise
Open-world
vs C
losed-world
Semantics

Open-world
semantics

Use the
classical negation
(
¬
) with
¬A means “A is
false


When A is unknown, neither A nor ¬A is
true
Closed-world
semantics

Use
negation-as-failure
(~) with ~A means “A is false or unknown”

A and ~A is always either
true
or
false

When information is added to the knowledge base, entailments need to
be recalculated as a consequence of the
non-monotonic
nature of
negation
©2007 Dufresne

Consulting, LLC
13
Top Engine
The Semantic Web Engine for the Enterprise
Rules on top of Ontologies

Ontology to define vocabulary primitives

Use a OWL DL reasoner to ensure the model is consistent with itself
Augment the ontology with rules

Use of
negation-as-failure
makes the model
non-monotonic

Care must be taken to avoid adding rules that are
Class Constructors or
Class Axioms

©2007 Dufresne

Consulting, LLC
14
Top Engine
The Semantic Web Engine for the Enterprise
RDF for Domain Model

RDF is an increasingly popular data structure

Very flexible data structure with
directed graph
properties

Well supported xml serialization

Support for most popular languages
Consider the following
asserted
triples
(
Mr Dupont
rdf:Type
'Art Collector')
(
Mr Dupont
hasArtifact
Boat Party
)
(
Boat Party
rdf:Type
'Impressionism Painting')
Mr Dupont
(Art Collector)
hasArtifact(
Boat Party
)
Boat Party
(Impressionism Painting)
(Artifact)
©2007 Dufresne

Consulting, LLC
15
Top Engine
The Semantic Web Engine for the Enterprise
Domain Model API

RDF API can be wrapped using domain-specific API

Domain-specific proxy classes can be generated using ontology

Complexities of RDF API is hidden
Asserting domain-specific triples becomes
ArtCollector
 collector = factory.createArtCollector(“Mr Dupont”);
Artifact
 painting = factory.createImpressionismPainting(“Boat Party”);
collector.setArtifact(painting);
Mr Dupont
(Art Collector)
hasArtifact(
Boat Party
)
Boat Party
(Impressionism Painting)
(Artifact)
©2007 Dufresne

Consulting, LLC
16
Top Engine
The Semantic Web Engine for the Enterprise
Inferring on Domain Model
Logical entailments from the Domain Model are
obtained using generated rules

Rules applying the logical entailments of the
Class Constructors
and
Class Axioms
of the ontology can be automatically generated
Recalling the previous example:

An Impressionism Art Collector is an Art Collector that has at
least one Impressionism painting”
or:
(
Impressionism Art Collector
)
≡ (
Art Collector)


hasArtifact
(
Impressionism Paintings
)
©2007 Dufresne

Consulting, LLC
17
Top Engine
The Semantic Web Engine for the Enterprise
Inferring on Domain Model
Asserted triples:
(
Mr Dupont
rdf:Type
'Art Collector')
(
Mr Dupont
hasArtifact
Boat Party
)
(
Boat Party
rdf:Type
'Impressionism Painting')
Generated rule:
(
?collector
rdf:Type 
'Art Collector').
(
?collector
hasArtifact 
?painting
).
(
?painting
rdf:Type
 
'Impressionism Painting')
=>
(
?collector 
rdf:Type
 
'Impressionism Art Collector')
Inferred triple:
(
Mr Dupont
rdf:Type
'Impressionism Art Collector')
©2007 Dufresne

Consulting, LLC
18
Top Engine
The Semantic Web Engine for the Enterprise
Accessing Inferred Domain Model
Generated proxies provide access to inferred triples
ArtCollector collector = factory.createArtCollector(“Mr Dupont”);
Artifact painting = factory.createImpressionismPainting(“Boat Party”);
collector.setArtifact(painting);
model.infer();
// compute logical entailments
if(factory.isImpressionismArtCollector(collector)) {
ImpressionismArtCollector icollector =
factory.asImpressionismArtCollector(collector);
// do stuff for Impressionism Art Collector
}
Mr Dupont
(Impressionism Art
Collector)
Boat Party
(Impressionism Painting)
(Artifact)
(Art Collector)
asserted types
©2007 Dufresne

Consulting, LLC
19
Top Engine
The Semantic Web Engine for the Enterprise
Querying the Domain Model
Application developers are familiar to query relational
databases

Navigating through RDF graph or domain model instances is cumbersome

Providing a relational view to the asserted and inferred triples recast the
Semantic Web approach to a well known paradigm
Consider the following SPARQL-like query:
SELECT 
?collector ?painting ?year ?artist
 FROM
(
?collector
 
rdf:Type
 
'Art Collector').
(
?collector
 
hasArtifact 
?painting
).
(
?painting
 
hasYear 
?year
).
(
?painting
 
hasArtist 
?artist
)
Would generate the following result set:
Row
?collector
?painting
?year
?artist
1
Mr Dupont
Boat Party
1881
Pierre-August Renoir
2
Mr Smith
Self Portrait
1889
Vincent Van Gogh
©2007 Dufresne

Consulting, LLC
20
Top Engine
The Semantic Web Engine for the Enterprise
Top Engine provide a fusion between Description Logic
and Logic Programs

Use OWL DL ontological definitions for vocabulary primitives

Provide OWL DL reasoning services to compute
satisfiability
,
subsumption
,
equivalence
, and
disjointness
of the ontology classes

Generate Logic Programs rules to retain class axioms from ontology

Ability to write rules on top of ontology with
closed-world
semantics

Inference engine in
C++
using
rete
-based algorithm with
forward
,
backward
, and
querying
capability (SPARQL-like syntax)

RDF graph for domain model with generated proxy classes in python and
java (soon)

Separation of
asserted
and
inferred
graphs to respect
non-monotonicity

of the
closed-world
semantics
Top Engine
The Semantic Web Engine for the Enterprise