Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.83 KB | None | 0 0
  1. -----------------------------------------
  2. Performing Query: Likes[p,ComputerScience]
  3.   query_or(Likes[p,ComputerScience], {})
  4.   -----------------------------
  5.   Rule(premises=[Likes[x,Programming], Likes[x,Math]], conclusion=Likes[x,ComputerScience])
  6.     query_and([Likes[x,Programming], Likes[x,Math]], {'x': 'p'})
  7.       query_or(Likes[p,Programming], {'x': 'p'})
  8.       Rule(premises=[], conclusion=Likes[Steve,Programming])
  9.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Steve'}]
  10.     rest: [Likes[x,Math]]
  11.       query_and([Likes[x,Math]], {'x': 'p', 'p': 'Steve'})
  12.         query_or(Likes[p,Math], {'x': 'p', 'p': 'Steve'})
  13.         Rule(premises=[], conclusion=Likes[Sally,Math])
  14.         query_or(Likes[p,Math], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  15.       rest: []
  16.         query_and([], {'x': 'p', 'p': 'Sally'})
  17.         query_and([], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  18.       query_and([Likes[x,Math]], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  19.     query_and([Likes[x,Programming], Likes[x,Math]], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Sally'}]
  20.     query_and([Likes[x,Programming], Likes[x,Math]], {'x': 'p', 'p': 'Steve'})
  21.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'})
  22.       Rule(premises=[], conclusion=Likes[Steve,Programming])
  23.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Steve'}]
  24.     rest: [Likes[x,Math]]
  25.       query_and([Likes[x,Math]], {'x': 'p', 'p': 'Steve'})
  26.         query_or(Likes[p,Math], {'x': 'p', 'p': 'Steve'})
  27.         Rule(premises=[], conclusion=Likes[Sally,Math])
  28.         query_or(Likes[p,Math], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  29.       rest: []
  30.         query_and([], {'x': 'p', 'p': 'Sally'})
  31.         query_and([], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  32.       query_and([Likes[x,Math]], {'x': 'p', 'p': 'Sally'}) return: [{'x': 'p', 'p': 'Sally'}]
  33.     query_and([Likes[x,Programming], Likes[x,Math]], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Sally'}]
  34.   -----------------------------
  35.   Rule(premises=[Likes[x,Programming], Plays[x,ComputerGames]], conclusion=Likes[x,ComputerScience])
  36.     query_and([Likes[x,Programming], Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'})
  37.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'})
  38.       Rule(premises=[], conclusion=Likes[Steve,Programming])
  39.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Steve'}]
  40.     rest: [Plays[x,ComputerGames]]
  41.       query_and([Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'})
  42.         query_or(Plays[p,ComputerGames], {'x': 'p', 'p': 'Steve'})
  43.         query_or(Plays[p,ComputerGames], {'x': 'p', 'p': 'Steve'}) return: []
  44.       query_and([Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'}) return: []
  45.     query_and([Likes[x,Programming], Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'}) return: []
  46.     query_and([Likes[x,Programming], Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'})
  47.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'})
  48.       Rule(premises=[], conclusion=Likes[Steve,Programming])
  49.       query_or(Likes[p,Programming], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Steve'}]
  50.     rest: [Plays[x,ComputerGames]]
  51.       query_and([Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'})
  52.         query_or(Plays[p,ComputerGames], {'x': 'p', 'p': 'Steve'})
  53.         query_or(Plays[p,ComputerGames], {'x': 'p', 'p': 'Steve'}) return: []
  54.       query_and([Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'}) return: []
  55.     query_and([Likes[x,Programming], Plays[x,ComputerGames]], {'x': 'p', 'p': 'Steve'}) return: []
  56.   query_or(Likes[p,ComputerScience], {'x': 'p', 'p': 'Steve'}) return: [{'x': 'p', 'p': 'Sally'}, {'x': 'p', 'p': 'Sally'}]
  57. Result: [{'p': 'Sally'}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement