User:Neo-Jay/Goratings.org/Query

From Wikidata
Jump to navigation Jump to search

Full list[0,1000)[1000,2000)[2000,3000)Query

Items with Goratings link[edit]

No.2 (2019.11.04T0519 created)

# find items with Goratings ID, and show Goratings links
SELECT ?goplayer ?goplayerLabel ?goratings_ID ?goratings_link
WHERE {
  # define ?goplayer's Goratings ID (P2805) value as ?goratings_ID
  ?goplayer wdt:P2805 ?goratings_ID.
  # define Goratings ID (P2805)'s formatter URL (P1630) as ?url
  wd:P2805 wdt:P1630 ?url
  # replace ?goratings_ID with ?url, and get
  # IRI (Internationalized Resource Identifier) of ?url; and
  # bind ?url's IRI as ?goratings_link
  BIND(IRI(REPLACE(?goratings_ID, '^(.+)$', ?url)) AS ?goratings_link). 
  # show label in simplified Chinese (zh-hans) as default, and English when no default label exists
  SERVICE wikibase:label {bd:serviceParam wikibase:language "zh-hans,en".}  
}
Try it! (https://w.wiki/BQe)