30
Application of Logic Application of Logic Programming and Updates Programming and Updates for the Semantic Web for the Semantic Web Luís Moniz Pereira Luís Moniz Pereira Dresden, November 2003

Application of Logic Programming and Updates for the Semantic Web

Embed Size (px)

DESCRIPTION

Application of Logic Programming and Updates for the Semantic Web. Luís Moniz Pereira. Dresden, November 2003. The Semantics Web. - PowerPoint PPT Presentation

Citation preview

Application of Logic Application of Logic Programming and Programming and

Updates for the Semantic Updates for the Semantic WebWeb

Luís Moniz PereiraLuís Moniz Pereira

Dresden, November 2003

The Semantics WebThe Semantics Web

"The Semantic Web is an extension of "The Semantic Web is an extension of the current web in which information the current web in which information is given well-defined meaning, better is given well-defined meaning, better

enabling computers and people to enabling computers and people to work in cooperation." [Berners-work in cooperation." [Berners-

Lee01]Lee01] Beyond Machine readable to Beyond Machine readable to Machine Machine

understandableunderstandable

Why it is crucialWhy it is crucial

Information OverloadInformation Overload Information on the Web currently aiming at Information on the Web currently aiming at

Human ConsumptionHuman Consumption

Information Consumption is too time consumingInformation Consumption is too time consuming

Search Engines fail more and moreSearch Engines fail more and more

Data Interchange growing (e.g. B2B)Data Interchange growing (e.g. B2B) XML provides common syntaxXML provides common syntax

Needs a common semanticsNeeds a common semantics

From XMLFrom XML to RDF to RDF

XML key idea: XML key idea: Separate structure from presentationSeparate structure from presentation

XML DTDs or Schema define document XML DTDs or Schema define document

structurestructure

Replace HTML with two thingsReplace HTML with two things A domain specific markup language (defined in A domain specific markup language (defined in

XML)XML) A map from that markup language to HTML A map from that markup language to HTML

(defined using XSLT)(defined using XSLT)

From XML From XML to RDFto RDF

RDF key idea:RDF key idea: Separate content from structureSeparate content from structure

RDF defines data models (set of triples RDF defines data models (set of triples

““ResourceResource has has PropertyProperty with with ValueValue”)”) Similar to taxonomy definitionSimilar to taxonomy definition

RDF Schema for definition of RDF Schema for definition of

Vocabularies and Ontologies for the data Vocabularies and Ontologies for the data

modelmodel

Beyond contentsBeyond contents

Conveying contents of documents is just a 1Conveying contents of documents is just a 1stst step for unfolding the potential of the Semantic step for unfolding the potential of the Semantic WebWeb

It is mandatory to be able to reason with and It is mandatory to be able to reason with and about information on the Web:about information on the Web:

““The challenge of the Semantic Web, therefore, is The challenge of the Semantic Web, therefore, is to provide a to provide a language that expresses both data language that expresses both data

and rulesand rules for reasoning about the data. for reasoning about the data.

Adding logic to the Web – Adding logic to the Web – the means to use rulesthe means to use rules to make inferences, choose courses of action to make inferences, choose courses of action and answer questionsand answer questions – is the task before the – is the task before the Semantic Web community at the moment.”Semantic Web community at the moment.”

Logic Programming for Logic Programming for the Webthe Web

Logic Programming is exactly about this: Logic Programming is exactly about this: expressing knowledge with rules, and making expressing knowledge with rules, and making inferences and answering queries.inferences and answering queries. It provides both a declarative reading (with well It provides both a declarative reading (with well

understood semantics) and an operational reading of understood semantics) and an operational reading of rules (with implementations)rules (with implementations)

State of the art in LP lift some of RDF limitationsState of the art in LP lift some of RDF limitationsRDFRDF is an assertional logic, in which each triple is an assertional logic, in which each triple

expresses a simple proposition. This imposes a expresses a simple proposition. This imposes a fairly strict monotonic discipline on the fairly strict monotonic discipline on the

language, so that it language, so that it cannot express closed-world cannot express closed-world assumptions, local default preferences, and assumptions, local default preferences, and

several other commonly used non-monotonic several other commonly used non-monotonic constructsconstructs..

Why LP – Theoretical Why LP – Theoretical issuesissues

Current proposals are based on classical logicCurrent proposals are based on classical logic Atoms are either true or false: no form of naturally Atoms are either true or false: no form of naturally

representing uncertainty (fuzzy, probabilistic, etc.).representing uncertainty (fuzzy, probabilistic, etc.). No default (non-monotonic) negation for representation No default (non-monotonic) negation for representation

of incomplete information.of incomplete information. No negation(s) for stating explicit negative information.No negation(s) for stating explicit negative information. No handling of contradiction/paraconsistency.No handling of contradiction/paraconsistency. No way of extending the language with new connectivesNo way of extending the language with new connectives

Most of the above is raised in the Semantic Web Most of the above is raised in the Semantic Web Activity Statement, and there are solutions to Activity Statement, and there are solutions to them in LPthem in LP

Why LP – Practical issuesWhy LP – Practical issues Current proposals seem not to address some Current proposals seem not to address some

important problems:important problems: What happens if a computation fails in the Web ?What happens if a computation fails in the Web ? What happens if a loop is introduced in the course What happens if a loop is introduced in the course

of distributed inference (positive or negative) ?of distributed inference (positive or negative) ? Can the computation safely proceed while Can the computation safely proceed while

answers do not arrive ?answers do not arrive ? How to share and avoid redundant How to share and avoid redundant

computations ?computations ? How to update knowledge (in the Web) ?How to update knowledge (in the Web) ? How to handle event-condition-action rules ?How to handle event-condition-action rules ?

LP based semantics and implementation LP based semantics and implementation technology have answers to these questions.technology have answers to these questions.

Which semantics for LP in Which semantics for LP in the Web?the Web?

Requirements:Requirements: Must be able to deal with incomplete knowledgeMust be able to deal with incomplete knowledge

Must be able to deal with inconsistenciesMust be able to deal with inconsistencies

Must always provide answers, even in inconsistent Must always provide answers, even in inconsistent casescases

Must be efficient, event at the cost of Must be efficient, event at the cost of expressivenessexpressiveness

Computation cannot be globalComputation cannot be global

Inference mechanisms must be query drivenInference mechanisms must be query driven

Must deal with (yet) unknown, or undefined, Must deal with (yet) unknown, or undefined, answersanswers

WFS seems to be the WFS seems to be the answeranswer

The adopted semantics for definite, acyclic and The adopted semantics for definite, acyclic and (locally) stratified logic programs.(locally) stratified logic programs.

Defined for every normal logic program.Defined for every normal logic program. Polynomial data complexity.Polynomial data complexity. Efficient existing implementations, namely the Efficient existing implementations, namely the

SLG-WAM engine implemented in XSB.SLG-WAM engine implemented in XSB. Good structural properties, namely Good structural properties, namely

supportedness and relevance.supportedness and relevance. A lot of extensions are built over WFS. A lot of extensions are built over WFS. It can be "combined" with DBMS, Prolog and It can be "combined" with DBMS, Prolog and

Stable Models engines.Stable Models engines. It has an undefined truth-value... It has an undefined truth-value...

More on the 3rd valueMore on the 3rd value The existence of an undefined logical value is The existence of an undefined logical value is

fundamental:fundamental: While waiting for answers to a remote goal it can While waiting for answers to a remote goal it can

be assumed that its truth-value is undefined, and be assumed that its truth-value is undefined, and proceed the computation locally.proceed the computation locally.

This is the way loops through negation are This is the way loops through negation are dealt within tabling (in XSB), via goal dealt within tabling (in XSB), via goal suspension and resume operations.suspension and resume operations. Tabling is the right, successful and available Tabling is the right, successful and available

implementation technique to ensure better implementation technique to ensure better termination properties and polynomial complexity.termination properties and polynomial complexity.

Tabling is also a good way to address distributed Tabling is also a good way to address distributed query evaluation of definite and normal logic query evaluation of definite and normal logic programs.programs.

What about What about Paraconsistency?Paraconsistency?

With the introduction of explicit negation, With the introduction of explicit negation, contradictions may arise in knowledge bases.contradictions may arise in knowledge bases.

We have defined a paraconsistent well-We have defined a paraconsistent well-founded semantics with explicit negation, founded semantics with explicit negation, where:where: contradiction is "propagated".contradiction is "propagated". we can detect dependency on contradictionwe can detect dependency on contradiction contradiction can be blocked by resorting to contradiction can be blocked by resorting to

normalized default rules.normalized default rules. there is a program transformation into WFS.there is a program transformation into WFS. there are polynomial inference procedures.there are polynomial inference procedures.

W4 projectW4 project

Well-founded semantics for WWWWell-founded semantics for WWW

Mission StatementMission Statement  

The W4 project aims at developing The W4 project aims at developing Standard Prolog interStandard Prolog inter--operable tools operable tools for supporting distributed, secure, for supporting distributed, secure, and integrated reasoning activities and integrated reasoning activities in the Semantic Web.in the Semantic Web.

W4- project GoalsW4- project Goals Development of Prolog technology for XML, RDFDevelopment of Prolog technology for XML, RDF,,

and RuleML. and RuleML. Development of a General Semantic framework for Development of a General Semantic framework for

RuleML including default and explicit negation, RuleML including default and explicit negation, supporting uncertain, incomplete, and supporting uncertain, incomplete, and paraconsistent reasoning. paraconsistent reasoning.

Development of distributed query evaluation Development of distributed query evaluation procedures for RuleMLprocedures for RuleML,, based on tabulation, based on tabulation, according to the previous semantics. according to the previous semantics.

Development of Dynamic Semantics for Development of Dynamic Semantics for evolution/update of Rule ML knowledge bases. evolution/update of Rule ML knowledge bases.

Integration of different semantics in Rule ML Integration of different semantics in Rule ML (namely, Well-founded Semantics, Answer Sets, (namely, Well-founded Semantics, Answer Sets, Fuzzy Logic Programming, Annotated Logic Fuzzy Logic Programming, Annotated Logic Programming, and Probabilistic Logic Programming).Programming, and Probabilistic Logic Programming).

W4 server architectureW4 server architectureXML based Communication Layer

EVOLP

Logic Programming Engines

DLP

RuleML interface

XML Parser & Generator

Our XML ToolsOur XML Tools Non-validating XML parser with support for XML Non-validating XML parser with support for XML

Namespaces, XML Base, complying with the Namespaces, XML Base, complying with the recommendations of XML Info Sets. It can read US-recommendations of XML Info Sets. It can read US-ASCII, UTF-8, UTF-16, and ISO-8859-1 encodings. ASCII, UTF-8, UTF-16, and ISO-8859-1 encodings.

Converter of XML to Prolog terms. Converter of XML to Prolog terms. RuleML compiler for the hornlog fragment of the RuleML compiler for the hornlog fragment of the

language extended with default and explicit language extended with default and explicit negation. negation.

Query evaluation procedures under the Query evaluation procedures under the Paraconsistent Well-founded Semantics with Paraconsistent Well-founded Semantics with Explicit Negation.Explicit Negation.

RDF(S) engineRDF(S) engine

A taxonomy in W4A taxonomy in W4• Mammals are animals

• Bats are mammals

• Birds are animals

• Penguins are birds

• Dead animals are animals

• Normally animals don’t fly

• Normally bats fly

• Normally birds fly

• Normally penguins don’t fly

• Normally dead animals don’t fly

Pluto is a mammalPluto is a mammal Joe is a penguinJoe is a penguin

Tweety is a birdTweety is a bird Dracula is a dead batDracula is a dead bat

The elements:The elements:

Dead bats don’t fly though bats doDead bats don’t fly though bats do Dead birds don’t fly though birds doDead birds don’t fly though birds do Dracula is an exception to the aboveDracula is an exception to the above In general, more specific information is preferredIn general, more specific information is preferred

The preferences:The preferences:

The taxonomyThe taxonomy

flies

animal

bird

penguin

mammal

bat

dead animal

plutotweety draculajoe

Absolute rulesDefault rulesDefault negated rules

Representation in Representation in RuleMLRuleML

% Mammals are animals % Mammals are animals

animal(X) <- mammal(X).animal(X) <- mammal(X).

% Normally animals don't fly % Normally animals don't fly

neg flies(X) <- animal(X), neg flying_animal(X), not flies(X)neg flies(X) <- animal(X), neg flying_animal(X), not flies(X)neg flying_animal(X) <- not flying_animal(X) neg flying_animal(X) <- not flying_animal(X)

% Normally birds fly % Normally birds fly

flies(X) <- bird(X), flying_bird(X), not neg flies(X) flies(X) <- bird(X), flying_bird(X), not neg flies(X) flying_bird(X) <- not neg flying_bird(X) flying_bird(X) <- not neg flying_bird(X)

The whole The whole rulebaserulebase... And let’s try this!... And let’s try this!

Extensions and Extensions and integrationintegration

With extensions to the RuleML/XML With extensions to the RuleML/XML syntax, existing LP engines can be syntax, existing LP engines can be used, integrating:used, integrating: Paraconsistent reasoningParaconsistent reasoning IncompletenessIncompleteness UncertaintyUncertainty PreferencesPreferences

This is simply based on work This is simply based on work developed in LP for this integration.developed in LP for this integration.

Evolution in the WebEvolution in the Web

The Semantic Web is a “living The Semantic Web is a “living organism” combining autonomously organism” combining autonomously evolving data sources/knowledge evolving data sources/knowledge repositories.repositories.

This requires (declarative) languages This requires (declarative) languages and mechanisms for specifying its and mechanisms for specifying its maintenance and evolution.maintenance and evolution.

When updating the rules defining, e.g., When updating the rules defining, e.g., data interchange policies, one does data interchange policies, one does not want to review the whole (maybe not want to review the whole (maybe distributed) set of previous rules!distributed) set of previous rules!

LP updates for the WebLP updates for the Web

Once again, there are ways of dealing Once again, there are ways of dealing with this within LPwith this within LP

It requires extension of the XML It requires extension of the XML syntax to cope with sequences of sets syntax to cope with sequences of sets of rules, and assertion of rules:of rules, and assertion of rules: This is already done in our XML toolsThis is already done in our XML tools

It requires the adaptation of the LP It requires the adaptation of the LP engines:engines: This is being developed nowThis is being developed now

An example of evolutionAn example of evolution Personal assistant for email where:Personal assistant for email where:

A XML/RuleML page stores rules defining behaviour A XML/RuleML page stores rules defining behaviour of the agentof the agent

This page may be dynamically updatedThis page may be dynamically updated Personal messages are stored in a XML pagePersonal messages are stored in a XML page Messages are received in the XML communication Messages are received in the XML communication

layer, as EVOLP eventslayer, as EVOLP events Either the sender sends the messages directly as “queries” Either the sender sends the messages directly as “queries”

to pageto page Or, preferably, an external process periodically checks for Or, preferably, an external process periodically checks for

messages in a mail server, and sends existing messages to messages in a mail server, and sends existing messages to the pagethe page

Messages to be sent are asserted, and an external Messages to be sent are asserted, and an external process periodically checks for those asserted facts, process periodically checks for those asserted facts, and sends the message via an smtp serverand sends the message via an smtp server

Email agentEmail agent Able to:Able to:

Perform basic actions of sending, receiving, Perform basic actions of sending, receiving, deleting messagesdeleting messages

Storing and moving messages between foldersStoring and moving messages between folders Filtering spam messagesFiltering spam messages Sending automatic replies and forwardingSending automatic replies and forwarding Notifying the user of special situationsNotifying the user of special situations

All of this dependent on user specified All of this dependent on user specified criteriacriteria

The specification may change dynamicallyThe specification may change dynamically

Some EVOLP rulesSome EVOLP rules By default, messages are stored in the inbox:By default, messages are stored in the inbox:

assert(msg(M,F,S,B,T)) assert(msg(M,F,S,B,T)) ←← newmsg(M,F,S,B), time(T), not newmsg(M,F,S,B), time(T), not delete(M).delete(M).

assert(in(M,inbox)) assert(in(M,inbox)) ←← newmsg(M,F,S,B), not delete(M). newmsg(M,F,S,B), not delete(M).

assert(not in(M,F)) assert(not in(M,F)) ←← delete(M), in(M,F). delete(M), in(M,F).

Spam messages are to be deletedSpam messages are to be deleteddelete(M) delete(M) ←← newmsg(M,F,S,B), spam(F,S,B). newmsg(M,F,S,B), spam(F,S,B).

The definition of spam can be done by LP The definition of spam can be done by LP rulesrulesspam(F,S,B) spam(F,S,B) ←← contains(S,credit). contains(S,credit).

This definition can later be updatedThis definition can later be updatednot spam(F,S,B) not spam(F,S,B) ←← contains(F,my_accountant). contains(F,my_accountant).

More EVOLP rulesMore EVOLP rules Messages can be automatically moved to other Messages can be automatically moved to other

folders. When so happens (not shown here) the user folders. When so happens (not shown here) the user wants to be notifiedwants to be notified notify(M) notify(M) ←← newmsg(M,F,S,B), assert(in(M,F)), not newmsg(M,F,S,B), assert(in(M,F)), not assert(in(M,inbox)).assert(in(M,inbox)).

When a message is marked both for deletion and When a message is marked both for deletion and automatically moving to another folder, the deletion automatically moving to another folder, the deletion should prevailshould prevailnot assert(in(M,F)) not assert(in(M,F)) ←← move(M,F), delete(M). move(M,F), delete(M).

The user is organizing a conference and assigns The user is organizing a conference and assigns papers to referees. After receiving the acceptance papers to referees. After receiving the acceptance of the referee, a new rule is to be added, which of the referee, a new rule is to be added, which forwards the referee all the messages about the forwards the referee all the messages about the corresponding paperscorresponding papersassert( send(R,S,B1) assert( send(R,S,B1) ← newmsg(M1,F,S,B1), contains(S,PId), ← newmsg(M1,F,S,B1), contains(S,PId), assign(PId,Ref) assign(PId,Ref) ))

←← newmsg(M2,Ref,PId,B2), contains(B2,accept).newmsg(M2,Ref,PId,B2), contains(B2,accept).

ConclusionsConclusions

The Semantic Web is an important, The Semantic Web is an important, and growing application domainand growing application domain

People working in this area are People working in this area are facing problems that were already facing problems that were already addressed by LPaddressed by LP

LP may be used for solving real LP may be used for solving real problems in the Semantic Webproblems in the Semantic Web We (LP-community) may have important We (LP-community) may have important

contributions for this domaincontributions for this domain

Conclusions (Cont)Conclusions (Cont)

Such contributions require:Such contributions require: Identification of the exact problems where LP Identification of the exact problems where LP

contribution makes sensecontribution makes sense Integration with other systems, where LP Integration with other systems, where LP

contribution is not neededcontribution is not needed Tools for putting LP to work in the WebTools for putting LP to work in the Web Specialized engines for the WebSpecialized engines for the Web (Most likely) some more work in LP to fulfill (Most likely) some more work in LP to fulfill

some needs of the Semantic Websome needs of the Semantic Web We are currently working on all these We are currently working on all these

issuesissues

Who also developed this Who also developed this workwork

In putting this material together:In putting this material together: Carlos Viegas DamásioCarlos Viegas Damásio José Júlio AlferesJosé Júlio Alferes

Who collaborated in work used by Who collaborated in work used by W4:W4: João AlcântaraJoão Alcântara António BrogiAntónio Brogi João LeiteJoão Leite Teodor PrzymusinskiTeodor Przymusinski Halina PrzymusinskaHalina Przymusinska