{"action":"opened","issue":{"url":"https://api.github.com/repos/RDFLib/FuXi/issues/14","labels_url":"https://api.github.com/repos/RDFLib/FuXi/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/RDFLib/FuXi/issues/14/comments","events_url":"https://api.github.com/repos/RDFLib/FuXi/issues/14/events","html_url":"https://github.com/RDFLib/FuXi/issues/14","id":110722506,"number":14,"title":"Rules appear not to be properly constructed","user":{"login":"doriantaylor","id":1181000,"avatar_url":"https://avatars.githubusercontent.com/u/1181000?v=3","gravatar_id":"","url":"https://api.github.com/users/doriantaylor","html_url":"https://github.com/doriantaylor","followers_url":"https://api.github.com/users/doriantaylor/followers","following_url":"https://api.github.com/users/doriantaylor/following{/other_user}","gists_url":"https://api.github.com/users/doriantaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/doriantaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doriantaylor/subscriptions","organizations_url":"https://api.github.com/users/doriantaylor/orgs","repos_url":"https://api.github.com/users/doriantaylor/repos","events_url":"https://api.github.com/users/doriantaylor/events{/privacy}","received_events_url":"https://api.github.com/users/doriantaylor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-09T19:30:09Z","updated_at":"2015-10-09T19:30:09Z","closed_at":null,"body":"Currently trying to get the OWL rules to be processed correctly. `dct.n3` is just http://purl.org/dc/terms/ to use as input fodder.\r\n\r\n```\r\npdb `which FuXi` -d  --input-format=n3   --rules  http://www.agfa.com/w3c/euler/rdfs-rules.n3 --rules http://www.agfa.com/w3c/euler/owl-rules.n3  /tmp/dct.n3\r\n```\r\nRunning the `FuXi` script (bare and in the debugger) gives me a bunch of these:\r\n\r\n```\r\n/…/FuXi/Rete/CommandLine.py:443: SyntaxWarning: Integrity constraints (rules with empty heads) are not supported: Forall ?X ?A ( And(  ) :- And( owl:equivalentClass(?A owl:Nothing) ?A(?X) ) )\r\n```\r\n\r\n…and then crashes with a `KeyError` here: https://github.com/RDFLib/FuXi/blob/master/lib/Rete/Network.py#L360\r\n\r\nI added the following condition in my test code:\r\n\r\n```python\r\n        try:\r\n            flhs = self.ruleStore.formulae[lhs]\r\n            frhs = self.ruleStore.formulae[rhs]\r\n        except KeyError as e:\r\n            import warnings\r\n            warnings.warn(\"Could not find rule %s in rule store\" % rule,\r\n                SyntaxWarning, 2)\r\n            raise e\r\n```\r\n\r\nThis spits out the offending rule as something like:\r\n\r\n```\r\n(Pdb) p rule\r\nForall _:N58f3fe0d6efa485eb833f4518991fa8b ?X _:N0cdcf914557f4059bf7c5d114e004be3 ?M ( Exists _:N58f3fe0d6efa485eb833f4518991fa8b _:N58e667762cb3452bb0330582592477e4 _:N43a8f967776a40208352e3912c6e1b02 _:N0cdcf914557f4059bf7c5d114e004be3 ( And( notItem(rdf:nil N58e667762cb3452bb0330582592477e4) rdf:first(rdf:nil N58e667762cb3452bb0330582592477e4) rdf:rest(rdf:nil N58f3fe0d6efa485eb833f4518991fa8b) rdf:first(N58f3fe0d6efa485eb833f4518991fa8b N43a8f967776a40208352e3912c6e1b02) rdf:rest(N58f3fe0d6efa485eb833f4518991fa8b N0cdcf914557f4059bf7c5d114e004be3) rdf:first(N0cdcf914557f4059bf7c5d114e004be3 1) rdf:rest(N0cdcf914557f4059bf7c5d114e004be3 rdf:nil) ) ) :- )\r\n```\r\n\r\nThat smiley-face looking construct at the tail of the rule is, from my reading, a syntax error in [RIF](http://www.w3.org/TR/rif-bld/#EBNF_Grammar_for_the_Presentation_Syntax_of_RIF-BLD_.28Informative.29). Likewise is `And( )` in the `SyntaxWarning` above. If we inspect the rule's body:\r\n\r\n```\r\n(Pdb) p rule.formula.body\r\nAnd(  )\r\n(Pdb) p rule.formula.body.__dict__\r\n{'nsMgr': <rdflib.namespace.NamespaceManager object at 0x98fcdcc>, 'nsDict': {}, 'naf': False, 'formulae': []}\r\n```\r\nMy tentative conclusion is that something in the process is generating these illegal empty `And( )` constructs. I have a hunch that it has something to do with the fact that certain terms evaluate to `False`, as I found in issue #13."}}