【问题标题】:Problem with basics queries form dbpedia with sparql使用 sparql 形成 dbpedia 的基础查询问题
【发布时间】:2021-12-03 09:23:46
【问题描述】:

为什么可以用这个查询得到结果:

SELECT *
              WHERE {
                ?person rdfs:label "Kirk Douglas"@en;
                dbo:birthPlace ?place. # With dbp: too
              }

但不是和另一个人:


SELECT *
              WHERE {
                ?person rdfs:label "Kirk Douglas"@en;
                dbo:starring ?film.
              }

我正在关注https://dbpedia.org/page/Kirk_Douglas中的标签

了解它的一些技巧。

谢谢!

【问题讨论】:

    标签: sparql dbpedia


    【解决方案1】:

    dbr:Kirk_Douglas你可以阅读:

    dbo:birthPlace     dbr:Amsterdam_(city),_New_York
    ...
    is dbo:starring of dbr:The_Light_at_the_Edge_of_the_World
                       dbr:Cast_a_Giant_Shadow
                       dbr:Two-Fisted_Tales_(film)
                       ...
    

    其中is dbo:starring of 是为dbo:starring 模拟inverse property 的一种方式。

    确实,在dbo:starring 你可以阅读:

    rdfs:domain dbo:Work
    ...
    rdfs:range dbo:Actor
    

    这意味着您不应该构建像 ?actor dbo:starring ?work 这样的三元组,而 ?work dbo:starring ?actor 是一个有效的三元组。

    所以你的查询应该是这样的:

    SELECT *
    WHERE {
      ?person rdfs:label "Kirk Douglas"@en .
      ?film dbo:starring ?person .
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多