SPARQL: FILTER NOT EXISTS and MINUS

I was wondering the difference between FILTER NOT EXISTS and MINUS, and found out a great answer here

The difference between FILTER NOT EXISTS and MINUS is related to the two styles of negation used by SPARQL. According to the specification:


The SPARQL query language incorporates two styles of negation, one based on filtering results depending on whether a graph pattern does or does not match in the context of the query solution being filtered, and one based on removing solutions related to another pattern.

 

Still according to the specification:


NOT EXISTS and MINUS represent two ways of thinking about negation, one based on testing whether a pattern exists in the data, given the bindings already determined by the query pattern, and one based on removing matches based on the evaluation of two patterns. In some cases they can produce different answers.


The two requests of your question are cited in the specification and the results are explained in the following way:


SELECT * {

   ?s ?p ?o .

   FILTER NOT EXISTS { ?x ?y ?z } .

}

This request evaluates to a result set with no solutions because { ?x ?y ?z } matches given any ?s ?p ?o, so NOT EXISTS { ?x ?y ?z } eliminates any solutions.


SELECT * {

   ?s ?p ?o .

   MINUS { ?x ?y ?z } .

}

In the request with MINUS, there is no shared variable between the first part (?s ?p ?o) and the second (?x ?y ?z) so no bindings are eliminated.