Wikidata SPARQL query examples: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 48: Line 48:
== References ==
== References ==
<references />
<references />
[[Category: Wikidata]] [[Category: Sparql]]

Revision as of 11:25, 14 January 2024


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年台灣放映的電影

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
  }
}

Further reading

References