SPARQL查询不等效

时间:2018-03-30 08:21:46

标签: protege

如何在protege中不进行等效查询: 我试图从我的本体论得到配偶,似乎我得到像妈妈一样的重复,是母亲的配偶,我试图检查,如果它们是相同的,那么它将过滤掉它。

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 .

}

1 个答案:

答案 0 :(得分:1)

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

SELECT  distinct ?mother ?father 

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