OntoBroker implements negation as the so-called "default negation" (OntoBroker supports both stratified and wellfounded negation). This means that when you have the program:

q(a).

q(b).

r(a).

QUERY q1: ?- q(?X) AND NOT r(?X).

Then OntoBroker evaluates the rule as follows:

1. | Retrieve all tuples for q(X): X=a, X=b |

2. | Retrieve all tuples for r(X): X=a |

3. | Subtract the tuples r(X) from q(X). |

So the result of the query is "X=b" because b does not occur in r(X) and hence the formula "NOT r(X)" is true.

Imagine what would happen if we had the program:

q(a).

q(b).

r(a).

QUERY q1: ?- NOT r(?X).

We have nothing as the base where we could subtract the r(X) facts from. So the result would be infinitely large (= the result size is not range restricted).