300 likes | 388 Views
Application of Logic Programming and Updates for the Semantic Web. Luís Moniz Pereira. Dresden, November 2003. The Semantics Web.
E N D
Application of Logic Programming and Updates for the Semantic Web Luís Moniz Pereira Dresden, November 2003
The Semantics Web "The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation." [Berners-Lee01] • Beyond Machine readable to Machine understandable
Why it is crucial • Information Overload • Information on the Web currently aiming at Human Consumption • Information Consumption is too time consuming • Search Engines fail more and more • Data Interchange growing (e.g. B2B) • XML provides common syntax • Needs a common semantics
From XML to RDF • XML key idea: • Separate structure from presentation • XML DTDs or Schema define document structure • Replace HTML with two things • A domain specific markup language (defined in XML) • A map from that markup language to HTML (defined using XSLT)
From XML to RDF • RDF key idea: • Separate content from structure • RDF defines data models (set of triples “Resource has Property with Value”) • Similar to taxonomy definition • RDF Schema for definition of Vocabularies and Ontologies for the data model
Beyond contents • Conveying contents of documents is just a 1st step for unfolding the potential of the Semantic Web • It is mandatory to be able to reason with and about information on the Web: “The challenge of the Semantic Web, therefore, is to provide a language that expresses both data and rules for reasoning about the data. Adding logic to the Web – the means to use rules to make inferences, choose courses of action and answer questions – is the task before the Semantic Web community at the moment.”
Logic Programming for the Web • Logic Programming is exactly about this: expressing knowledge with rules, and making inferences and answering queries. • It provides both a declarative reading (with well understood semantics) and an operational reading of rules (with implementations) • State of the art in LP lift some of RDF limitations RDF is an assertional logic, in which each triple expresses a simple proposition. This imposes a fairly strict monotonic discipline on the language, so that it cannot express closed-world assumptions, local default preferences, and several other commonly used non-monotonic constructs.
Why LP – Theoretical issues • Current proposals are based on classical logic • Atoms are either true or false: no form of naturally representing uncertainty (fuzzy, probabilistic, etc.). • No default (non-monotonic) negation for representation of incomplete information. • No negation(s) for stating explicit negative information. • No handling of contradiction/paraconsistency. • No way of extending the language with new connectives • Most of the above is raised in the Semantic Web Activity Statement, and there are solutions to them in LP
Why LP – Practical issues • Current proposals seem not to address some important problems: • What happens if a computation fails in the Web ? • What happens if a loop is introduced in the course of distributed inference (positive or negative) ? • Can the computation safely proceed while answers do not arrive ? • How to share and avoid redundant computations ? • How to update knowledge (in the Web) ? • How to handle event-condition-action rules ? • LP based semantics and implementation technology have answers to these questions.
Which semantics for LP in the Web? • Requirements: • Must be able to deal with incomplete knowledge • Must be able to deal with inconsistencies • Must always provide answers, even in inconsistent cases • Must be efficient, event at the cost of expressiveness • Computation cannot be global • Inference mechanisms must be query driven • Must deal with (yet) unknown, or undefined, answers
WFS seems to be the answer • The adopted semantics for definite, acyclic and (locally) stratified logic programs. • Defined for every normal logic program. • Polynomial data complexity. • Efficient existing implementations, namely the SLG-WAM engine implemented in XSB. • Good structural properties, namely supportedness and relevance. • A lot of extensions are built over WFS. • It can be "combined" with DBMS, Prolog and Stable Models engines. • It has an undefined truth-value...
More on the 3rd value • The existence of an undefined logical value is fundamental: • While waiting for answers to a remote goal it can be assumed that its truth-value is undefined, and proceed the computation locally. • This is the way loops through negation are dealt within tabling (in XSB), via goal suspension and resume operations. • Tabling is the right, successful and available implementation technique to ensure better termination properties and polynomial complexity. • Tabling is also a good way to address distributed query evaluation of definite and normal logic programs.
What about Paraconsistency? • With the introduction of explicit negation, contradictions may arise in knowledge bases. • We have defined a paraconsistent well-founded semantics with explicit negation, where: • contradiction is "propagated". • we can detect dependency on contradiction • contradiction can be blocked by resorting to normalized default rules. • there is a program transformation into WFS. • there are polynomial inference procedures.
W4 project • Well-founded semantics for WWW Mission Statement The W4 project aims at developing Standard Prolog inter-operable tools for supporting distributed, secure, and integrated reasoning activities in the Semantic Web.
W4- project Goals • Development of Prolog technology for XML, RDF, and RuleML. • Development of a General Semantic framework for RuleML including default and explicit negation, supporting uncertain, incomplete, and paraconsistent reasoning. • Development of distributed query evaluation procedures for RuleML, based on tabulation, according to the previous semantics. • Development of Dynamic Semantics for evolution/update of Rule ML knowledge bases. • Integration of different semantics in Rule ML (namely, Well-founded Semantics, Answer Sets, Fuzzy Logic Programming, Annotated Logic Programming, and Probabilistic Logic Programming).
W4 server architecture XML based Communication Layer RuleML interface XML Parser & Generator EVOLP DLP Logic Programming Engines
Our XML Tools • Non-validating XML parser with support for XML Namespaces, XML Base, complying with the recommendations of XML Info Sets. It can read US-ASCII, UTF-8, UTF-16, and ISO-8859-1 encodings. • Converter of XML to Prolog terms. • RuleML compiler for the hornlog fragment of the language extended with default and explicit negation. • Query evaluation procedures under the Paraconsistent Well-founded Semantics with Explicit Negation. • RDF(S) engine
A 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 The elements: • Pluto is a mammal • Joe is a penguin • Tweety is a bird • Dracula is a dead bat The preferences: • Dead bats don’t fly though bats do • Dead birds don’t fly though birds do • Dracula is an exception to the above • In general, more specific information is preferred
The taxonomy Absolute rules flies Default rules Default negated rules animal bird mammal dead animal penguin bat joe tweety pluto dracula
Representation in RuleML • % Mammals are animals animal(X) <- mammal(X). • % Normally animals don't fly neg flies(X) <- animal(X), neg flying_animal(X), not flies(X)neg flying_animal(X) <- not flying_animal(X) • % Normally birds fly flies(X) <- bird(X), flying_bird(X), not neg flies(X) flying_bird(X) <- not neg flying_bird(X) • The whole rulebase... And let’s try this!
Extensions and integration • With extensions to the RuleML/XML syntax, existing LP engines can be used, integrating: • Paraconsistent reasoning • Incompleteness • Uncertainty • Preferences • This is simply based on work developed in LP for this integration.
Evolution in the Web • The Semantic Web is a “living organism” combining autonomously evolving data sources/knowledge repositories. • This requires (declarative) languages and mechanisms for specifying its maintenance and evolution. • When updating the rules defining, e.g., data interchange policies, one does not want to review the whole (maybe distributed) set of previous rules!
LP updates for the Web • Once again, there are ways of dealing with this within LP • It requires extension of the XML syntax to cope with sequences of sets of rules, and assertion of rules: • This is already done in our XML tools • It requires the adaptation of the LP engines: • This is being developed now
An example of evolution • Personal assistant for email where: • A XML/RuleML page stores rules defining behaviour of the agent • This page may be dynamically updated • Personal messages are stored in a XML page • Messages are received in the XML communication layer, as EVOLP events • Either the sender sends the messages directly as “queries” to page • Or, preferably, an external process periodically checks for messages in a mail server, and sends existing messages to the page • Messages to be sent are asserted, and an external process periodically checks for those asserted facts, and sends the message via an smtp server
Email agent • Able to: • Perform basic actions of sending, receiving, deleting messages • Storing and moving messages between folders • Filtering spam messages • Sending automatic replies and forwarding • Notifying the user of special situations • All of this dependent on user specified criteria • The specification may change dynamically
Some EVOLP rules • By default, messages are stored in the inbox: assert(msg(M,F,S,B,T)) ← newmsg(M,F,S,B), time(T), not delete(M). assert(in(M,inbox)) ← newmsg(M,F,S,B), not delete(M). assert(not in(M,F)) ← delete(M), in(M,F). • Spam messages are to be deleted delete(M) ← newmsg(M,F,S,B), spam(F,S,B). • The definition of spam can be done by LP rules spam(F,S,B) ← contains(S,credit). • This definition can later be updated not spam(F,S,B) ← contains(F,my_accountant).
More EVOLP rules • Messages can be automatically moved to other folders. When so happens (not shown here) the user wants to be notified notify(M) ← newmsg(M,F,S,B), assert(in(M,F)), not assert(in(M,inbox)). • When a message is marked both for deletion and automatically moving to another folder, the deletion should prevail not assert(in(M,F)) ← move(M,F), delete(M). • The user is organizing a conference and assigns papers to referees. After receiving the acceptance of the referee, a new rule is to be added, which forwards the referee all the messages about the corresponding papers assert( send(R,S,B1) ← newmsg(M1,F,S,B1), contains(S,PId), assign(PId,Ref) ) ← newmsg(M2,Ref,PId,B2), contains(B2,accept).
Conclusions • The Semantic Web is an important, and growing application domain • People working in this area are facing problems that were already addressed by LP • LP may be used for solving real problems in the Semantic Web • We (LP-community) may have important contributions for this domain
Conclusions (Cont) • Such contributions require: • Identification of the exact problems where LP contribution makes sense • Integration with other systems, where LP contribution is not needed • Tools for putting LP to work in the Web • Specialized engines for the Web • (Most likely) some more work in LP to fulfill some needs of the Semantic Web • We are currently working on all these issues
Who also developed this work • In putting this material together: • Carlos Viegas Damásio • José Júlio Alferes • Who collaborated in work used by W4: • João Alcântara • António Brogi • João Leite • Teodor Przymusinski • Halina Przymusinska