【问题标题】:Search Wikidata SPARQL for movies or tv series by title按标题在 Wikidata SPARQL 中搜索电影或电视剧
【发布时间】:2017-12-27 05:37:05
【问题描述】:

我想在电视剧 (http://www.wikidata.org/entity/Q5398426) 和电影 (http://www.wikidata.org/entity/Q11424) 中搜索“星球大战”。以下 SPARQL 用于搜索电影:

# search movies by name
SELECT DISTINCT ?item ?name WHERE {
  ?item wdt:P31 wd:Q11424.
  ?item rdfs:label ?queryByTitle.
  OPTIONAL { ?item wdt:P1476 ?name. }
  #FILTER(REGEX(?queryByTitle, "star wars", "i"))
  FILTER(contains(lcase(?queryByTitle), "star wars"))
}
LIMIT 100

知道如何按电视剧进行搜索吗?

【问题讨论】:

  • VALUES ?type {wd:Q5398426 wd:Q11424} ?item wdt:P31 ?type .替换?item wdt:P31 wd:Q11424.

标签: sparql wikidata


【解决方案1】:

@AKSW 回答了这个问题。这是未来搜索的任何人的完整要点。

SELECT DISTINCT ?item ?name WHERE {
  VALUES ?type {wd:Q5398426 wd:Q11424} ?item wdt:P31 ?type .
  ?item rdfs:label ?queryByTitle.
  OPTIONAL { ?item wdt:P1476 ?name. }
  FILTER(REGEX(?queryByTitle, "star wars", "i"))
}
LIMIT 100

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 2014-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多