1 / 24

Using answer set programming to answer complex queries

Using answer set programming to answer complex queries. Chitta Baral (joint work with Michael Gelfond and Richard Scherl) Arizona State University Tempe, AZ 86287 chitta@asu.edu http://www.public.asu.edu/~cbaral. QUERIES. Queries and Answers.

wilma
Download Presentation

Using answer set programming to answer complex queries

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using answer set programming to answer complex queries Chitta Baral (joint work with Michael Gelfond and Richard Scherl) Arizona State University Tempe, AZ 86287 chitta@asu.edu http://www.public.asu.edu/~cbaral

  2. QUERIES

  3. Queries and Answers • Answering queries with respect to databases: various query languages • Relational databases: SQL3 • Object-Oriented Databases: OQL • Web databases, XML Databases: XML-QL • Prolog queries • Natural language queries • Often translated to one of the above • Complex Queries! • Need knowledge beyond that is present in the given data (or text) to answer. • Many can not be expressed in classical logics.

  4. Complex Query example – predictive query • Text/Data: John is at home in Boston and has not bought a ticket to Paris yet. • Query: • What happens if John tries to fly to Paris? • What happens if John buys a ticket to Paris and then tries to fly to Paris?

  5. Complex Query example: explanation query • Text/Data: On Dec 10th John is at home in Boston and has not bought a ticket to Paris yet. On Dec 11th he is in Paris. • Query: • Explain what might have happened in between. • Bought a ticket; gone to the airport; taken a flight to Paris.

  6. Complex Query Example: planning query • Text/Data: On Dec 10th John is at home in Boston and has not bought a ticket to Paris yet. • Query: What does John need to do to be in Paris on Dec 11th. • He needs to buy the ticket || get to the airport; fly to Paris.

  7. Complex Query Example:Counterfactual Query • Text/Data: On Dec 10th John is at home in Boston. He made a plan to get to Paris by Dec 11th. He then bought a ticket. But on his way to the airport he got stuck in the traffic. The Boston to Paris flight did not make it. • Query: What if John had not gotten stuck in the traffic?

  8. Complex Query Example: query about narratives • Text/Data: John, who always carries his laptop with him, took a flight from Boston to Paris on the morning of Dec 11th. • Queries: • Where is John on the evening of Dec 11th? • In which city is John’s laptop that evening?

  9. Complex Query Example: Causal queries • Text/Data: On Dec 10th John is at home in Boston. He made a plan to get to Paris by Dec 11th. He then bought a ticket. But on his way to the airport he got stuck in the traffic. He reached the airport late and his flight had left. • Queries: • What are the causes of John missing the flight?

  10. Our approach to answer such queries • Develop various knowledge modules in an appropriate knowledge representation and reasoning language. • Travel module (includes flying, driving) • Geography Module • Time module • Reasoning about actions module • Planning module • Explanation module • Counterfactual module • Cause finding module

  11. Knowledge Representation & Reasoning: AnsProlog

  12. What properties should an appropriate KR & R language have • Should be non-monotonic. So that the system can revise its earlier conclusion in light of new information. • Should have the ability to represent normative statements, exceptions, and default statements, and should be able to reason with them. • Should be expressive enough to express and answer problem solving queries such as planning queries, counterfactual queries, explanation queries and diagnostic queries. • Should have a simple and intuitive syntax so that domain experts (who may be non-computer scientists) can express knowledge using it. • Should have enough existing research (or building block results) about this language so that one does not have to start from scratch. • Should have interpreters or implementation of the language so that one can indeed represent and reason in this language. (I.e., it should not be just a theoretical language.) • Should have existing applications that have been built on this language so as to demonstrate the feasibility that applications can be indeed built using this language.

  13. AnsProlog – a suitable knowledge representation and reasoning language • AnsProlog – Programming in logic with answer sets • Syntax: Set of statements of the form: A0or … or Ak B1, …, Bm, not C1, … not Cn. • Intuitive meaning of the above statement: • If B1, …, Bm is known to be true and C1, …, Cn can be assumed to be false then at least one of A0 ,…, Akmust be true. • Semantics • A set of atoms A is an answer set of a program P if A is the minimal model of the program PA obtained by using A to remove all literals of the form not C. • If C is in A then remove that rule and if C is not in A then remove not C from that rule’s body • {a  not b; b  not a} {a} = {a }

  14. AnsProlog Program example: illustrating non-monotonicity T1 fly(X)  bird(X), not ab(X). T2 bird(X)  penguin(X). T3 ab(X)  penguin(X). T4 bird(tweety). {T1, T2, T3, T4} |= fly(tweety). {T1, T2,T3, T4, penguin(tweety)} |= ~ fly(tweety).

  15. Transitive Closure in AnsProlog ancestor(X,Y)  ancestor(X,Z), parent(Z,Y). ancestor(X,Y)  parent(X,Y). parent(a,b). parent(b,c). parent(c,d). parent(e,f).

  16. Planning using AnsProlog • initially ~f. initially ~g. b causes f if g. a causes g. finally f. a;b is a plan that achieves the goal. • Planning: All answer sets encode a plan. • Describing the initial state. ~ holds(f, 1). ~holds(g, 1). • Describing effect of actions. holds(f,T+1) occurs(b,T), holds(g,T). holds(g,T+1) occurs(a,T). • Describing what does not change. holds(f,T+1) holds(f,T), not ~holds(f,T+1). ~holds(f,T+1) ~holds(f,T), not holds(f,T+1). • Enumerating possible plans. other-occurs(A,T) occurs(B,T), A =\= B. occurs(A,T)  not other-occurs(A,T). • Eliminating answer sets which do not encode a plan. not holds(f, plan-length+1).

  17. AnsProlog vs Prolog • Differences: • Prolog is sensitive to ordering of rules and ordering of literals in the body of rules. • Inappropriate ordering leads to infinite loops. (Thus Prolog is not declarative; hence not a knowledge representation language) • Prolog stumbles with recursion through negation • Similarities: For certain subclasses Prolog can be thought of as a top-down engine for AnsProlog.

  18. AnsProlog vs other KR & R languages • AnsProlog has a simple syntax and semantics • Syntax has structure that allows defining sub-classes • More expressive than propositional and first-order logic; propositional AnsProlog is as expressive as default logic. Yet much simpler. • It has the largest body of support structure (theoretical results as well as implementations) among the various knowledge representation languages • Description logic comes close. But its focus is very narrow, namely representing and reasoning about ontologies. • …

  19. Building blocks for AnsProlog • Subclasses and their properties. • Definite, normal, extended, disjunctive. • Acyclic, signed, stratified, call-consistent, order-consistent. • Properties • Existence of consistent answer sets. • Existence of unique answer sets. • Complexity of entailment. • Expressibility of the entailment relation. • Relation between the literals in an answer set and the program

  20. Building blocks for AnsProlog- cont. • Transforming programs. • Equivalence of programs. • Formal relation with other languages. (classical logic, default logic, etc.) • Splitting programs – modular analysis, and computation of answer sets. • Systematic building of programs from components: program composition.

  21. Examples of specific properties • Expressibility • Function-free AnsProlog without disjunctions: P1P (Co-NP) • Function-free AnsProlog: P2 P. • AnsProlog: P11 • Relation between literals in an answer set and the program. • If ‘f’ is in an answer set ‘A’ of a program P, then there must be a rule in P such that … • If an answer set ‘A’ of a program P satisfies the body of a rule ‘r’ of P then, the head of that rule …

  22. Some existing AnsProlog applications • Reasoning • Reasoning with incomplete information, default reasonong. • Reasoning with preferences and priorities, inheritance hierarchies. • Declarative problem solving • Planning, job-shop scheduling, tournament scheduling. • Abductive reasoning, explanation generations, diagnosis. • Combinatorial graph problems. • Combinatorial optimizations, combinatorial auctions. • Product configuration. • Software Engineering: Specification is the program. (rapid prototyping)

  23. Ilustration of Complex Query Answering

More Related