title: Stopping recursion in Prolog?
body: <pre><code>connect(raj,isa,indian).
  connect(indian,isa,man).
  
  attribute(raj,marks,100).
  attribute(indian,marks,200).
  
  p(Node,marks,Number) :- 
     attribute(Node,marks,Number).
  p(Node,marks,Number) :-
     connect(Node,isa,X),
     p(X,marks,Number).
  </code></pre>
  
  <p>So now, while querying,</p>
  
  <pre><code>171 ?- p(raj,marks,100).
  true .
  
  172 ?- p(raj,marks,200).
  true .
  </code></pre>
  
  <p>In this case, I want <code>p(raj,marks,200)</code> to fail.</p>
  
  <p>How do I stop recursion while getting the first answer?</p>