I have an ontology where is defined that several sports are played by
several people. if you want to consult it, the file is in the following
link:
https://www.dropbox.com/s/vcazac9vdvx4me6/schema_data_Sport2.xml


I have the follow jena rule:

(?x exa:seaPartner ?y) <-
(?x exa:playSport ?s1),
(?y exa:playSport ?s2),
notEqual(?x, ?y), 
(?s1 rdf:type exa:SeaSport),
(?s2 rdf:type exa:SeaSport).

When I execute the follow SPARQL command:
prefix exa: <http://www.example.org/example#>
select ?x ?y
where {
?x exa:sportPartner ?y .
}
the output is:
x -> exa:Ricardo; y -> exa:Miguel;
x -> exa:Miguel; y -> exa:Ricardo;
x -> exa:Miguel; y -> null:null;
x -> exa:Ricardo; y -> null:null;

I don't understand why the last two rows are listed. When I execute the
follow SPARQL command:
prefix exa: <http://www.example.org/example#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?x ?y
where {
?x exa:playSport ?s1 .
?y exa:playSport ?s2 .
?s1 rdf:type exa:SeaSport .
?s2 rdf:type exa:SeaSport .
FILTER (?x != ?y). 
}
the output is:
x -> exa:Ricardo; y -> exa:Miguel;
x -> exa:Miguel; y -> exa:Ricardo;



Reply via email to