Dreams:sdg-index: Difference between revisions

From DREAMS
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
     ?goal
     ?goal
   WHERE {
   WHERE {
     ?goal dreamst:P2 dreams:Q22 .  
     { ?goal dreamst:P2 dreams:Q22 . }
    UNION
    { ?goal dreamst:P2 dreams:Q5594 . }
 
     OPTIONAL { ?item dreamst:P42 ?goal . }
     OPTIONAL { ?item dreamst:P42 ?goal . }
   }
   }

Revision as of 09:04, 9 December 2022

SDGs

PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>

SELECT 
  ?count
  ?goal ?goalLabel 
  (CONCAT("#sdg/", SUBSTR(STR(?goal), 38)) AS ?goalUrl)
  ?goalDescription
WITH {
  SELECT
    (COUNT(?item) AS ?count)
    ?goal
  WHERE {
    { ?goal dreamst:P2 dreams:Q22 . }
    UNION
    { ?goal dreamst:P2 dreams:Q5594 . }

    OPTIONAL { ?item dreamst:P42 ?goal . }
  }
  GROUP BY ?goal
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],da,en". }
}
ORDER BY DESC(?count)