如何以正确的方式构建简单的SPARQL查询 [英] How to build simple SPARQL query in the right way

查看:86
本文介绍了如何以正确的方式构建简单的SPARQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是SPARQL和DBpedia的新手。

I am novice with SPARQL and DBpedia.

我想了解构建简单SPARQL查询的知识。

I would like to get knowledge of building simple SPARQL queries.

您能否请我为以下问题建立答案:
足球运动员的故乡(任何一个),艺术家名单,奥斯卡获奖者名单(任何一年)

Could you please help me to build answer for such questions as: Hometown of footballer (any one), List of Artists, List of Oscar winners (any year)

推荐答案

我认为这个问题可能太广泛了,但是如果有用的话,描述如何解决这种类型的问题可能很有意义。对于其中一个问题,这是我的工作。

I think this question is probably too broad, but in case it's useful, it might make sense to describe how to approach this type of problem. For one of the problems, here's what I did.

在在这种情况下,我首先访问了获得奥斯卡金像奖得主 Brad Pitt 的DBpedia条目。在这里,您会看到属性 dcterms:subject 类别:Producers_who_won_the_Best_Picture_Academy_Astrong>。
该类别的属性为
skos:broader
类别:Best_Picture_Academy_Award_winners ,其中依次包含
skos:broader

类别:Academy_Award_winners
。因此,您可以查找具有 dcterms:subject 某个类别值的东西,该值通过与 Academy_Award_winners 链接的 skos:broader 路径连接类别。实际上,这会出现一些不是人的事物,因为这些类别是商品的类别,而不是实体的类别,因此您还需要过滤掉那些属于人的事物。这可能会给您列出奥斯卡金像奖得主的名单,尽管有些人可能属于该类别,因为他们与该类别还有其他关系:

In this case, I started by visting the DBpedia entry for an Academy Award winner, Brad Pitt. There you'll see the property dcterms:subject category:Producers_who_won_the_Best_Picture_Academy_Award. That category has property skos:broader category:Best_Picture_Academy_Award_winners which, in turn, has skos:broader
category:Academy_Award_winners
. So you could look for things that have a dcterms:subject value of some category that's connected by a path of skos:broader links to the Academy_Award_winners category. That will actually turn up some things that aren't persons, because those categories are categories of articles, not classes of entities, so you'll also want to filter down to those things which are Persons. That's probably going to give you a list of Academy Award winners, though it's possible that some are just in that category because they have some other relationship to the category:

select ?person where {
  ?person a dbpedia-owl:Person ;
          dcterms:subject/skos:broader* category:Academy_Award_winners .
}

SPARQL结果

这篇关于如何以正确的方式构建简单的SPARQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆