Wikidata SPARQL query examples

From LemonWiki共筆
Jump to navigation Jump to search


icon_scale_pencil.png This article "Wikidata SPARQL query examples" is still being written. If there are any incomplete parts, you are welcome to directly edit them. 這篇文章「Wikidata SPARQL query examples」內容還在撰寫中,如果有不完整的部分,歡迎你直接動手修改


2023年台灣放映的電影[edit]

Wikidata Query Builder

  • 原產地 (P495) = 中華民國 (Q865)
  • 隸屬於 (Q865) = 電影 (Q11424)
  • 出版日期 (P577) after 2023-1-1
  • 出版日期 (P577) before 2023-1-1
  • 影視作品原始語言 (P364) = 國語 (Q262828)
  • Limit the number of results to: 100

Show query in the Query Service

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P495 ?statement0.
      ?statement0 (ps:P495/(wdt:P279*)) wd:Q865.
      ?item p:P31 ?statement1.
      ?statement1 (ps:P31/(wdt:P279*)) wd:Q11424.
      ?item p:P577 ?statement_2.
      ?statement_2 psv:P577 ?statementValue_2.
      ?statementValue_2 wikibase:timePrecision ?precision_2.
      FILTER(?precision_2 >= 11 )
      ?statementValue_2 wikibase:timeValue ?P577_2.
      FILTER(?P577_2 > "+2023-01-01T00:00:00Z"^^xsd:dateTime)
      ?item p:P364 ?statement3.
      ?statement3 (ps:P364/(wdt:P279*)) wd:Q262828.
      ?item p:P577 ?statement_4.
      ?statement_4 psv:P577 ?statementValue_4.
      ?statementValue_4 wikibase:timePrecision ?precision_4.
      FILTER(?precision_4 >= 11 )
      ?statementValue_4 wikibase:timeValue ?P577_4.
      FILTER(?P577_4 < "+2024-01-01T00:00:00Z"^^xsd:dateTime)
    }
    LIMIT 100
  }
}

今年放映的電影[edit]

修改自維基數據:SPARQL查詢示例[1]

SELECT DISTINCT ?item ?itemLabel WHERE {
 ?item wdt:P31 wd:Q11424.
 ?item wdt:P577 ?pubdate.
 FILTER((?pubdate >= "2025-01-01T00:00:00Z"^^xsd:dateTime) && (?pubdate <= "2025-12-31T00:00:00Z"^^xsd:dateTime))
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}


Further reading[edit]

References[edit]