【问题标题】:Find all artists who were born in a given city查找出生在给定城市的所有艺术家
【发布时间】:2018-05-21 15:00:48
【问题描述】:

以下 sn-p 使用 dbpedia.org 数据库检索来自世界各地的所有艺术家(姓名)。

prefix dbo: <http://dbpedia.org/ontology/>

select distinct (str(?name_) as ?name) {
  ?artist a dbo:Artist ;
          rdfs:label ?name_ .
}

接下来我想做的是扩展这个 sn-p 以便 a) 我按某个城市进行过滤 b) 显示以下可选字段:

  • 名称(这已经有效)
  • 城市名称
  • 出生日期
  • 子类(例如演员、音乐家等)

【问题讨论】:

    标签: sparql dbpedia


    【解决方案1】:

    dbo:birthDate 将为您提供艺术家的出生日期。

    dbo:birthPlace会给你艺术家的出生地。

    rdf:type / dbc:subject 将为您提供艺术家拥有的所有角色。小心,这可能是巨大的。也许你应该改进你的研究(Yago、dbc、dbo、wikidata,...)。

    以下是出生于 Pinner 的艺术家及其出生日期的示例:

    prefix dbo: <http://dbpedia.org/ontology/>
    
    select distinct (str(?name_) as ?name) ?birthPlace ?birthDate {
      ?artist a dbo:Artist ;
        rdfs:label ?name_ .
      ?artist dbo:birthPlace ?birthPlace .
      ?artist dbo:birthDate ?birthDate .
    filter(?birthPlace = dbr:Pinner)
    }
    

    【讨论】:

    • 太棒了!快速提问:我注意到我得到了重复的答案,唯一的区别是第一个表示日期为1962-10-03,而第二个使用以下表示法"1962-10-3"^^&lt;http://www.w3.org/2001/XMLSchema#date&gt;。我们知道为什么会发生这种情况吗?如果知道,我们该如何避免?
    • stackoverflow.com/questions/50060490/… ..这就是你得到重复答案的原因。
    猜你喜欢
    • 2017-12-01
    • 1970-01-01
    • 2018-09-14
    • 1970-01-01
    • 2011-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多