Mus*_*h87 4 java rdf semantic-web rdfs sparql
我有这个查询SPARQL我在它上运行.dbpedia.org/sparql:
select ?resource where {
?resource rdfs:label "Piemonte"@it
}
Run Code Online (Sandbox Code Playgroud)
我得到这个结果:
http://it.dbpedia.org/resource/Categoria:Piemonte
http://it.dbpedia.org/resource/Piemonte
Run Code Online (Sandbox Code Playgroud)
我希望只有http://it.dbpedia.org/resource/Piemonte.我试图写这个查询SPARQL 从结果中删除http://it.dbpedia.org/resource/Categoria:Piemonte:
select ?resource where {
?resource rdfs:label "Piemonte"@it
FILTER (rdf:type != skos:Concept)
}
Run Code Online (Sandbox Code Playgroud)
因为我注意到http://it.dbpedia.org/resource/Categoria:Piemonte有对象skos:Concept而http://it.dbpedia.org/resource/Piemonte没有,但我得到了相同的结果.为什么?我在这做错了什么?
我也尝试添加LIMIT 1,但结果是http://it.dbpedia.org/resource/Categoria:Piemonte,因为结果不保证是相同的顺序.
使用像FILTER (rdf:type != skos:Concept)你只是问两个常量是否不相等的过滤器.这些URI rdf:type和skos:Concept是的,当然,不同的.
您想要的是一个没有skos:Concept该属性值的资源rdf:type.你表明它确实有这个?resource rdf:type skos:Concept.因此,您的查询只需要一个过滤器,以确保数据中不存在该三元组.在意大利语DBpedia上,您可以询问以下内容并获得一个结果.
select ?resource where {
?resource rdfs:label "Piemonte"@it
filter not exists { ?resource rdf:type skos:Concept }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2079 次 |
| 最近记录: |