Wikidata:Synia:country

From Wikidata
Jump to navigation Jump to search

Synia: country

[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!

Subaspects

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

SELECT
  ?aspect ?aspectLabel ?aspectUrl
  ?aspectDescription 
WHERE {
  {
    BIND(wd:Q2668072 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/collection") AS ?aspectUrl)
  }
  UNION
  {
    BIND(wd:Q3621491 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/archaeologist") AS ?aspectUrl)
  }
  UNION
  {
    BIND(wd:Q464980 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/exhibition") AS ?aspectUrl)
  }
  UNION
  {
    BIND(wd:Q27986619 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/mastodon") AS ?aspectUrl)
  }
  UNION
  {
    BIND(wd:Q15284 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/municipality") AS ?aspectUrl)
  }
  UNION
  {
    BIND(wd:Q2085381 AS ?aspect)
    BIND(CONCAT("#country/", SUBSTR(STR(target:), 32), "/publisher") AS ?aspectUrl)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
ORDER BY ?aspectLabel
Try it!

Locations by population

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

SELECT
  ?population
  ?location ?locationLabel
  ?locationDescription
WITH {
  SELECT 
    ?population
    ?location 
  WHERE { 
    ?location wdt:P17 target: ;
              wdt:P625 ?geo ;
              wdt:P1082 ?population .
  }
  ORDER BY DESC(?population)
  LIMIT 500
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY DESC(?population)
Try it!

Topics

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

SELECT
  ?works
  (CONCAT("#country/", SUBSTR(STR(target:), 32), "/topic/", SUBSTR(STR(?topic), 32)) AS ?worksUrl)

  ?topic ?topicLabel
  (CONCAT("#topic/", SUBSTR(STR(?topic), 32)) AS ?topicUrl)
  ?topicDescription
WITH {
  SELECT DISTINCT ?author WHERE {
    ?author wdt:P27| (( wdt:P1416 | wdt:P108 ) / wdt:P17) target: .
  }
} AS %authors
WITH {
  SELECT
    (COUNT(DISTINCT ?work) AS ?works)
    ?topic
  WHERE {
    INCLUDE %authors
    ?work wdt:P50 ?author ;
          wdt:P921 ?topic .
  }
  GROUP BY ?topic
  ORDER BY DESC(?works) 
  LIMIT 500  
} AS %topics
WHERE {
  INCLUDE %topics
  service wikibase:label { bd:serviceParam wikibase:language "en" . } 
}
ORDER BY DESC(?works)
Try it!