-2

I am trying to check if there are two individuals connected by the relation B , and have relation c with the same element

ASK{

{?x :B ?y}filter not exist{?x :c ?t1, ?y :c ?t2 ,t1 ≠ t2 }

}
hala
  • 29
  • 5
  • If you want that they HAVE relation c, why `not exists`? Once, this is clear, all you need to do is fix the syntax: the commas are not OK there, and if you still want to filter out, then it should be `filter not exists`. – Ivo Velitchkov Jun 26 '16 at 18:31
  • @IvoVelitchkov so is it acceptable to put t1 ≠ t2 in the filter ? what is the syntax of not equal ? how to write it – hala Jun 26 '16 at 18:52
  • 1
    It's `!=` . I would suggest that you refer to the [SPARQL specification](https://www.w3.org/TR/sparql11-query/) at least for the basic syntax – Ivo Velitchkov Jun 26 '16 at 18:57
  • see the answer for some other syntax issues – Ivo Velitchkov Jun 26 '16 at 19:09

1 Answers1

2

If I understood right, the query you are trying to write should look like this:

ASK{
?x :B ?y;
:c ?t1 .
?y :c ?t2 .
filter (t1 != t2 )
}

Please note that with a such query, x and y might just as well be classes, and not individuals.

Ivo Velitchkov
  • 2,361
  • 11
  • 21