How to build simple SPARQL query in the right way

孤街浪徒 提交于 2019-12-08 07:27:54

问题


I am novice with SPARQL and DBpedia.

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)


回答1:


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.

List of Oscar winners (any year)

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 results



来源:https://stackoverflow.com/questions/27724741/how-to-build-simple-sparql-query-in-the-right-way

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!