{"action":"created","issue":{"url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/12","labels_url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/12/comments","events_url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/12/events","html_url":"https://github.com/pcarbonn/pyDatalog/issues/12","id":117638866,"number":12,"title":"wikipedia datalog example fails in pydatalog","user":{"login":"earney","id":1158898,"avatar_url":"https://avatars.githubusercontent.com/u/1158898?v=3","gravatar_id":"","url":"https://api.github.com/users/earney","html_url":"https://github.com/earney","followers_url":"https://api.github.com/users/earney/followers","following_url":"https://api.github.com/users/earney/following{/other_user}","gists_url":"https://api.github.com/users/earney/gists{/gist_id}","starred_url":"https://api.github.com/users/earney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earney/subscriptions","organizations_url":"https://api.github.com/users/earney/orgs","repos_url":"https://api.github.com/users/earney/repos","events_url":"https://api.github.com/users/earney/events{/privacy}","received_events_url":"https://api.github.com/users/earney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-18T17:33:30Z","updated_at":"2015-11-18T17:56:44Z","closed_at":null,"body":"This example on datalog's wikipedia page https://en.wikipedia.org/wiki/Datalog#Example fails in pyDatalog:\r\n\r\n```\r\n parent(bill, mary).\r\n parent(mary, john).\r\nancestor(X,Y) :- parent(X,Y).\r\n ancestor(X,Y) :- parent(X,Z),ancestor(Z,Y).\r\n?- ancestor(bill,X).\r\n```\r\nI translate this to:\r\n```\r\nfrom pyDatalog import pyDatalog\r\n\r\npyDatalog.create_terms('parent,bill,mary,john,ancestor,X,Y,Z')\r\n\r\nparent(bill, mary)\r\nparent(mary, john)\r\n\r\nancestor(X,Y) <= parent(X,Y)\r\nancestor(X,Y) <= parent(X,Z), ancestor(Z,Y)\r\n\r\nprint(ancestor(bill,X))\r\n```\r\nand I get the following error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 11, in <module>\r\n    print(ancestor(bill,X))\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 134, in __str__\r\n    return util.cast_to_str(self.__unicode__())\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 604, in __unicode__\r\n    return LazyListOfList.__unicode__(self)\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 118, in __unicode__\r\n    if self.data in (True, [], [()]): return util.unicode_type(self._data)\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 93, in data\r\n    self.todo.ask()\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 577, in ask\r\n    self._data = Body(self.pre_calculations, self).ask()\r\n  File \"/usr/local/lib/python3.4/dist-packages/pyDatalog/pyParser.py\", line 693, in ask\r\n    self._data = literal.lua.ask()\r\n  File \"pyDatalog\\pyEngine.py\", line 511, in pyDatalog.pyEngine.Literal.ask (pyDatalog/pyEngine.c:18496)\r\n  File \"pyDatalog\\pyEngine.py\", line 801, in pyDatalog.pyEngine.Subgoal.search (pyDatalog/pyEngine.c:27510)\r\nAttributeError: Predicate without definition (or error in resolver): parent/2\r\n```\r\nI guess I need to define parent?  If so, what is the best way?\r\n\r\nAny help is greatly appreciated!\r\nBilly\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/comments/157802003","html_url":"https://github.com/pcarbonn/pyDatalog/issues/12#issuecomment-157802003","issue_url":"https://api.github.com/repos/pcarbonn/pyDatalog/issues/12","id":157802003,"user":{"login":"pcarbonn","id":440681,"avatar_url":"https://avatars.githubusercontent.com/u/440681?v=3","gravatar_id":"","url":"https://api.github.com/users/pcarbonn","html_url":"https://github.com/pcarbonn","followers_url":"https://api.github.com/users/pcarbonn/followers","following_url":"https://api.github.com/users/pcarbonn/following{/other_user}","gists_url":"https://api.github.com/users/pcarbonn/gists{/gist_id}","starred_url":"https://api.github.com/users/pcarbonn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcarbonn/subscriptions","organizations_url":"https://api.github.com/users/pcarbonn/orgs","repos_url":"https://api.github.com/users/pcarbonn/repos","events_url":"https://api.github.com/users/pcarbonn/events{/privacy}","received_events_url":"https://api.github.com/users/pcarbonn/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T17:56:44Z","updated_at":"2015-11-18T17:56:44Z","body":"To assert a fact in pyDatalog, you need to prefix it with `+` (use`-` to retract it).  See [reference page](https://sites.google.com/site/pydatalog/reference) for all the syntax rules."}}