sparql - SPAQRL 创建排除查询
问题描述
我有这种结构
<ontology:Louvre>
<rdf:type ontology:Museum/>
<ontology:preserves rdf:Gioconda/>
<ontology:locatedIn rdf:Paris/>
<ontology:name>Louvre</ontology:name>
<ontology:Gioconda>
<rdf:type ontology:Artwork/>
<ontology:preserved rdf:Louvre/>
<ontology:author rdf:Leonardo/>
<nomeOpera>Gioconda</nomeOpera>
<rdf:Leonardo_Da_Vinci>
<rdf:type ontology:Painter"/>
<ontology:paint ontology:Gioconda"/>
<ontology:paint ontology:Ultima_cena"/>
<name>Leonardo Da Vinci</name>
...(other museum, artist and artwork)
I use "ontology" to indicate my prefix
博物馆的专属艺术家有可能找回吗?
解决方案
我找到了解决方案。这是我正在寻找的查询
SELECT DISTINCT * WHERE {
?museum ontology:preserves ?artwork .
?museum ontology:name "Louvre" .
?artwork ontology:author ?author.
FILTER NOT EXISTS{
?museum2 ontology:preserves ?artwork2 .
?artwork2 ontology:author ?author .
FILTER (?museum2 != ?museum)
}
}
推荐阅读
- vb.net - PostgreSQL 数据更改时的更改/通知事件
- c# - node.js 和 c# 之间的 Masstransit 队列生产者/消费者
- node.js - 在 knex.stream 中传递列名
- python - 加载带有标签的 TensorFlow 模型
- android - 如何删除android studio中的导航?
- python - Method Not Allowed:请求的 URL 不允许该方法
- r - 动态添加具有多个输入的用户界面
- firebase - 页面没有移动到下一页
- django - 一个序列化程序中的两个不相关的模型 django rest 框架
- python - 禁用 gunicorn 烧瓶应用程序的重新加载