title: Prolog, error when querying a false statement
body: <pre><code>input :-
  read_line_to_codes(user_input, Input),
  string_to_atom(Input,Atoms),
  atomic_list_concat(Alist, ' ', Atoms),
  phrase(sentence(S), Alist),
  action(S).
  
  
  statement(Rule) --&gt; [Noun, 'is', 'a', Object], { Rule =.. [Object, Noun]}.
  statement1(Rule) --&gt; ['A', Noun, 'is', 'a', Object], { Rule =.. [Object, Noun]}.
  query(Fact) --&gt; ['Is', Noun, 'a', Object], { Fact =.. [Object, Noun]}.
  
  sentence(statement(S)) --&gt; statement(S).
  sentence(statement1(S))--&gt; statement1(S).
  sentence(query(Q)) --&gt; query(Q).
  
  
  action(statement(S)) :- asserta(S) -&gt; write(ok).
  action(statement1(S)) :- asserta(S) -&gt; write(ok).
  action(query(Q)) :-( Q -&gt; write(yes); write(unknown)), nl.
  </code></pre>
  
  <p>The assignment is to create rules from user input in the form " _ is a _." or " A _ is a _." This should respond with "ok".</p>
  
  <p>And then be able to query "Is _ a _?" And respond with "yes" or "unknown".
  I have no idea why it's giving an error if the predicate(i think that's what it's called, "ham") is not in the database, but its fine with the other part not being in there. Any ideas as to what I'm doing wrong? And sorry if I'm doing something simply stupid, first time with prolog. I'm using SWI-Prolog V.6.2.6 if that matters. And how would I go about omitting the true or false return in the ouput</p>
  
  <pre><code>   11 ?- input.
     |: john is a dog
     ok
     true .
  
     12 ?- input.
     |: Is john a dog
     yes
     true.
  
  
     13 ?- input.
     |: Is abraham a dog
     unknown
     false.
  
     14 ?- input.
     |: Is john a ham
     ERROR: action/1: Undefined procedure: ham/1
     Exception: (8) ham(john) ? 
  </code></pre>