How to do not equivalent query in protege: I am trying to get spouse from my ontology and it seems like I get duplicates like mother is spouse to mother and I am trying to have query that checks that if they are the same then it will filter it out.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://example.com/owl/families/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX aa: <http://example.com/owl/families#Maija>
SELECT distinct ?mother ?father
#CONSTRUCT {?mother :hasSpouse ?father .}
WHERE {
?mother :hasChild ?c .
?father :hasChild ?c .
?mother :notEqualto ?father .
}
Just after I posted this question I got the answer:
SELECT distinct ?mother ?father
WHERE {
?mother :hasChild ?c .
?father :hasChild ?c .
FILTER (?mother != ?father)
}