Sparql MULTIPLE 不存在条件

Sparql MULTIPLE not exists condition

我正在执行一个 Sparql 查询,returns 关键字 apple 不属于特定子类的所有 URI Species

select distinct ?s 
where 
{ 
?s a owl:Thing . ?s rdfs:label ?label . 
filter(langmatches(lang(?label), 'en')) ?label bif:contains '"apple"' . 
filter not exists {?s rdf:type/rdfs:subClassOf* dbo:Species } 
}

我想包含更多子类。我想包含许多子类,所以我想像这样过滤掉:

filter not exists {?s rdf:type/rdfs:subClassOf* dbo:Speciesfilter not exists {?s rdf:type/rdfs:subClassOf* dbo:Organisationfilter not exists {?s rdf:type/rdfs:subClassOf* dbo:SomeOtherSubclass

如何将多个 AND 链接在一起?

你可以这样做:

FILTER NOT EXISTS { 
   VALUES ?clazz { dbo:Species dbo:Organisation dbo:SomeOtherSubclass } 
   ?s rdf:type/rdfs:subClassOf* ?clazz. 
 }

尽管无法保证其性能如何。