Wikidata:Synia:country-collection-index

From Wikidata
Jump to navigation Jump to search

Synis: Country-collections

[edit]
PREFIX target: <http://www.wikidata.org/entity/Q35>

SELECT 
  ?description ?descriptionLabel ?descriptionUrl

  ?value ?valueLabel ?valueUrl

  ?wikidata ?wikidataUrl

  ?scholia ?scholiaUrl
WHERE {
  {
    BIND(1 AS ?order)
    BIND(wd:Q6256 AS ?description)
    BIND("#country" AS ?descriptionUrl)
    
    BIND(target: AS ?value)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32)) AS ?valueUrl)
    
    BIND("Wikidata&nbsp;↗" AS ?wikidata)
    BIND(CONCAT("https://www.wikidata.org/wiki/", SUBSTR(STR(?value), 32)) AS ?wikidataUrl)

    BIND("Scholia&nbsp;↗" AS ?scholia)
    BIND(CONCAT("https://scholia.toolforge.org/country/", SUBSTR(STR(?value), 32)) AS ?scholiaUrl)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY ?order
Try it!

Collections

[edit]
PREFIX target: <http://www.wikidata.org/entity/Q35>

SELECT
  ?items

  ?collection ?collectionLabel
  (CONCAT("#collection/", SUBSTR(STR(?collection), 32)) AS ?collectionUrl)
  ?collectionDescription

  ?example_item ?example_itemLabel
WITH {
  SELECT 
    (COUNT(?item) AS ?items)
    ?collection
    (SAMPLE(?item) AS ?example_item)
  WHERE {
    ?collection ^wdt:P195 ?item ;
                wdt:P17 target: .
  }
  GROUP BY ?collection
} AS %collections
WHERE {
  INCLUDE %collections
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?items)
Try it!