Title: Rules and Ontologies in Flogic
1Rules and Ontologies in F-logic
- Michael Kifer
- State University of New York
- at Stony Brook
2Outline
- Introduction
- Overview of F-logic (with examples using the
FLORA-2 system) - F-logic/ FLORA-2 and ontologies
3What is F-Logic?
- An object-oriented first-order logic
- Extends predicate logic with
- Objects with complex internal structure
- Class hierarchies and inheritance
- Typing
- Encapsulation
- A basis for object-oriented logic programming and
knowledge representation - Background
- Basic theory Kifer Lausen SIGMOD-89,
Kifer,Lausen,Wu JACM-95 - Path expression syntax Frohn, Lausen, Uphoff
VLDB-84 - Semantics for non-monotonic inheritance Yang
Kifer, ODBASE 2002 - Meta-programming other extensions Yang
Kifer, Journal on Data Semantics 2003
O-O programming Relational
programming
F-logic
Predicate calculus
4F-logic and Logic Programming
- The flavors of F-logic
- First-order flavor
- Logic programming flavor
F-logic programming
Logic programming
FO F-logic
Predicate logic
5Relationship to Description Logic
FO F-logic
Description F-Logic
Description Logic OWL
Predicate logic
- A description logic subset exists within the
first-order variant of F-logic Balaban 1995,
The F-logic Approach for Description
Languages - But most known uses of F-logic are
in the rule-based (F-logic programming)
domain
6Relationship to Description Logic (contd)
- F-logic (rule-based flavor)
- Computationally complete
- Object-oriented
- Classes as object, reification of statements
- Can query data and schema in the same language
- Has useful tractable subsets (eg, function-free
rules) - Based on non-monotonic (non-classical) logic
- Description logic
- Has its own decidable subsets (but practically
questionable, since expressive versions are
exponential) - Can reason by cases
- Can represent existential information
- Based on monotonic, classical logic
7Applications of F-logic
- Semantic Web
- Ontology management
- Semantic Web Services
- Information integration
- Software engineering
- Intelligent agents
- Anything that requires manipulation of complex
structured or (especially) semi-structured data
8What is FLORA-2 ?
- F-LOgic tRAnslator (to XSB) a popular
implementation of F-logic (and more) - Realizes the vision of logic-based KR with
frames, meta-programming, and side-effects.
Based on - F-logic
- HiLog
- Transaction Logic
- Practical usable KR and programming environment
- Declarative
- Object-oriented
- Rule-based
- Open source http//flora.sourceforge.net/
9Other Major F-logic Based Languages
- Ontobroker commercial system from Ontoprise.de
- WSMO (Web Service Modeling Ontology) a large EU
project that developed an F-logic based language
for Semantic Web Services, WSML-Rule - SWSI (Semantic Web Services Initiative) an
international group that proposed an F-logic
based language SWSL-Rules (also for Semantic Web
Services) - FORUM a user group whose aim is to
standardize/web-ize the various flavors of
F-logic (FLORA-2, Ontobroker, WSML-Rule,
SWSL-Rules)
10F-logic Simple Examples
Single-valued attribute
Object Id
Object description johnname -gt John
Doe, phones -gtgt 6313214567, 6313214566,
children -gtgt bob, mary
maryname-gtMary Doe, phones -gtgt 2121234567,
2121237645, children -gtgt anne,
alice Structure can be nested
sallyspouse -gt johnaddress -gt 123 Main St.
Set-valued attribute
11Examples (contd)
- ISA hierarchy
- john person // class
membership - mary person
- alice student
- student person // subclass
relationship - student entityType
- person entityType
Class instance in different contexts
12Examples (contd)
- Methods like attributes, but take arguments
- PageAsOf(Year) -gt Age -
- Pperson, Pborn -gt B and
Age is YearB. - Attributes can be viewed as methods with no
arguments
Queries ? johnageAsOf(Y) -gt 30,
children -gtgt C and Cborn -gt B and
BgtY. Johns children who were born when he was
30 years old.
13Examples (contd.)
Browsing IsA hierarchy ?- john X.
// all superclasses of the object john ?-
student Y. // all superclasses of class
student Virtual class X redcar -
Xcar and Xcolor -gt red. Meta-query about
schema OattributesOf(Class) -gtgtA -
OA -gtV or A -gtgtV and VClass.
Rule that defines a virtual class of red cars
Rule that defines a method that returns
attributes whose range is class Class
14Type Signatures
- Type info is specified using statements like this
(called signatures) - personname gt string,
- spouse gt person,
- children gtgt person.
- gt means inheritable instance attribute (like
instance variable in Java) - Signatures are formulas in F-logic (just like the
data-level statement johnname -gt John Doe
is a formula) - The notion of well-typedness relates signatures
to data
15Semantics
- The FO F-logic semantics proof theory are
general, as in classical logic sound complete,
and are not limited to rules - But FLORA-2 is a programming language based on
F-logic. Hence it uses nonmonotonic,
non-classical semantics. So - - , not P,
- means true if cannot prove P so called
negation as failure. - The exact semantics for negation used in
FLORA-2 is derived from the Well-Founded
Semantics Van Gelder et al., JACM 1991,
http//citeseer.nj.nec.com/gelder91wellfounded.htm
l
16Semantics (contd)
- The Well-Founded semantics is 3-valued
- p - not q.
- r - not r.
- p is true, q false, but r is undefined
- And non-monotonic
- P Q does not imply P?P Q
- For instance
- p - not q implies p true.
- But
- q and p - not q implies p false.
- So, truth values dont grow monotonically. In
contrast, classical logic is both 2-valued and
monotonic
17Inheritance in F-logic
- Inheritance of structure vs. inheritance of
behavior - Structural inheritance inheritance of type
signatures of a method (will not discuss here) - Behavioral inheritance inheritance of the
definition of a method - Subtle problems arise when inference by
inheritance interacts with inference by rules
(illustrated next)
18Behavioral Inheritance Non-monotonicity
Elephantcolor -gt grey
Means default value
royalElephantcolor -gt white
fred
clyde
Overriding
Inherited fredcolor -gt grey
clydecolor -gt grey
white
?
19Behavioral Inheritance Problem with Rules
- Inheritance is hard to even define properly in
the presence of rules.
a
m -gt v
cm -gt w - bm -gt v
c
b
20Behavioural Inheritance Solutions
- Hard to define semantics for multiple inheritance
overriding rules - Several semantics might appear to look
reasonable - The original semantics in Kifer,Lausen,Wu
JACM-95 was one of the problematic reasonable
semantics - A number of other problematic semantics of
various degrees of reasonableness were proposed
over time - Problem solved in YangKifer ODBASE 2002,
2003 - Based on semantic postulates
- An extension of Van Gelders Well-Founded
Semantics for negation
21HiLog
- Allows certain forms of logically clean, yet
tractable, meta-programming - Syntactically appears to be higher-order, but
semantically is first-order and tractable - Chen,Kifer,Warren, HiLog A Foundation for
Higher-Order Logic Programming, J. of Logic
Programming, 1993
22Examples of HiLog
Variables over predicates and function symbols
p(X,Y) - X(a,Z), Y(Z(b)). Variables over
atomic formulas (reification) p(q(a)).
r(X) - p(X) and X. A use of HiLog in FLORA-2
(e.g., querying of schema)
OunaryMethods(Class) -gtgt M -
OM(Arg) -gt V or M(Arg) -gtgt V and VClass.
Meta-variable ranges over method names
23Reification (Another Application of HiLog to
F-logic)
- Reification making an object out of a formula
-
- johnbelieves -gtgt marylikes -gtgt bob
- Introduced in Yang Kifer, ODBASE 2002
- Rules can be reified, too!
Object made out of the formula marylikes -gtgt bob
24HiLog in FLORA-2
- Allows high degree of meta-programming purely in
logic - Variables can be bound to predicate and function
symbols and thus queried - Formulas can be represented as terms and
manipulated in flexible ways - Can mix frame syntax (F-logic) and predicate
syntax (HiLog) in the same query/program - ab -gt c, g(X,e) -gtgt d and p(f(X),a).
25Ontologies
- A typical ontology has three components
- A taxonomy (class hierarchy)
- No-brainer in F-logic Use and
- Concept definitions
- Use type signatures. For instance
- personname gt string, children gt person.
- Definitions of instances
- This is just specification of data that populates
ontologies. - Specified using rules and facts. For instance
- johnstudent.
- johnname -gt John Doe, address -gt 1 Main
St.. - Xgrandfather - Xpersonchildren -gt
Cchildren -gt GC.
26Example of Ontology
Domain Semantic Web Services Scenario
Finding travel services according to various
criteria (the Web service discovery
problem)
27Taxonomy
- germany, europe, etc. classes of cities
- newyork, vienna, etc. cities
- germany europe.
- austria europe.
- usa region.
- europe region.
- newyork usa.
- vienna austria.
- bonn germany.
- frankfurt germany.
- Rregion - R1region and RR1. // every
subclass of a region is a region - Llocation - LR and Rregion. // every
member of a region is also a location
28User Goals and Related Concepts
- Concepts
- goalrequestId gt request,
- request gt
travelSearchQuery, - result gtgt service.
- search(From,To,Date)
travelSearchQuery - - From
(region or location) and To (region or
location). - Instance
- g123
- requestId -gt 12345,
- request -gt search
(bonn,vienna,7/7/2005), - result -gtgt serv123
- .
29Service Concept Instance
- Concept
- servicename
gt string, - effect(travelSearchQuery) gt
formula, - mediators
gtgt mediator - .
- Instance
- serv123 name -gt Fly High
Travel, - effects(Input) -gt
- (itinerary(Req)from -gtFrom, to
-gtTo, date -gtDate - -
Input search(Fromgermany, Toaustria,
Date)) - ,
- usedMediators -gt med1
- .
30Having Fun with F-logic
- Working with F-logic is fun! FLORA-2 is a
full-fledged knowledge representation/logic
programming system. Has a range of other
interesting features - Module system with encapsulation
- Control flow constructs
- Aggregates
- Non-logical constructs for procedural diehards
- Debugging support
- Integration with databases, Web, Java, etc.
31Conclusion
- F-logic is an object-oriented extension of
predicate logic, which is particularly suitable
for representing ontologies on the Semantic Web - Based on the proven paradigm of rule-based logic
languages - Has a number of popular implementations,
including commercial ones - A basis for two W3C proposals in the semantic Web
services domain - Also proposed to W3C as the basis rule-based
languages for the Semantic Web - WRL
- SWSL-Rules
- In fact, the N3 language is also nothing but a
slightly altered syntax of F-logic, but with no
semantics