You haven't given any other details of your problem I.e. data but the
behaviour as described sounds in line with the specification for MINUS.
MINUS finds all matches for its pattern and then does a set subtraction
based on the bound variables.

So your pattern { ?s a <http://xmlns.com/foaf/0.1/person> } matches all
things declared as type foaf:Person in the data binding the associated
subject to ?s.  It then subtracts any matching solutions from the LHS, so
if a given ?s is declared to be a foaf:Person then all matches pertaining
to ?s will be removed from the LHS.

It sounds like what you actually want to do is exclude foaf:Person type
declarations?

In this case neither MINUS nor FILTER NOT EXISTS will do what you want and
you have to use a simpler filter e.g.

CONSTRUCT
{
  ?s a ?o
}
WHERE
{
  ?s a ?o .
  FILTER(!SAMETERM(?o, <http://xmlns.com/foaf/0.1/Person>))
}

Hope this helps,

Rob

On 11/12/2013 02:56, "Erich Bremer" <[email protected]> wrote:

>In the following segment of code:
>
>String queryString = "construct {?s a ?o} where {?s a ?o minus {?s a
><http://xmlns.com/foaf/0.1/Person>}}";
>Query query = QueryFactory.create(queryString);
>QueryExecution qe = QueryExecutionFactory.create(query,m);
>Model whoa = qe.execConstruct();
>
>Rather than remove just the pattern {?s a
><http://xmlns.com/foaf/0.1/Person>}, it removes all types as if the
>MINUS pattern was {?s a ?p}
>
>     - Erich
>========================
>http://www.ebremer.com
>http://haylyn.io




Reply via email to