SPARQL 查询不等价

SPARQL query not equivalent

如何在门徒中做不等价查询: 我正在尝试从我的 ontology 中获取配偶,似乎我得到了重复项,例如母亲是母亲的配偶,我正在尝试查询以检查它们是否相同,然后将其过滤掉。

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 .

}

在我发布这个问题后我得到了答案:

SELECT  distinct ?mother ?father 

WHERE { 
      ?mother :hasChild ?c .
      ?father :hasChild ?c .
FILTER (?mother != ?father)
}