Dreams:projecttype

From DREAMS
Revision as of 13:21, 9 December 2022 by Fnielsen (talk | contribs) (→‎Mønstre)
Jump to navigation Jump to search

Projekttype-data

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

SELECT DISTINCT 
  ?beskrivelse
  ?værdi ?værdiLabel ?værdiUrl
WHERE {
  BIND(target: AS ?effect)
  {
    BIND(1 AS ?order)
    BIND("Projekttype" AS ?beskrivelse)
    BIND(target: AS ?værdi) .
  }
  UNION
  {
    BIND(5 AS ?order)
    BIND("Overbegreb" AS ?beskrivelse)
    target: dreamst:P10 ?værdi .
    BIND(SUBSTR(STR(?værdi), 38) AS ?q) 
    BIND(CONCAT("#projecttype/", ?q) AS ?værdiUrl)
  }
  UNION
  {
    BIND(6 AS ?order)
    BIND("Underbegreb" AS ?beskrivelse)
    target: ^dreamst:P10 ?værdi .
    BIND(SUBSTR(STR(?værdi), 38) AS ?q) 
    BIND(CONCAT("#projecttype/", ?q) AS ?værdiUrl)
  }
  UNION
  {
    BIND(10 AS ?order)
    BIND("Ekstern beskrivelse" AS ?beskrivelse)
    target: dreamst:P29 ?værdi .
    BIND(?værdi AS ?værdiUrl)
  }
  UNION
  {
    BIND(100 AS ?order)
    BIND("Rapporter" AS ?beskrivelse)
    BIND("🔍" AS ?værdi)
    BIND(CONCAT("#projecttype/", SUBSTR(STR(target:), 38), "/report") AS ?værdiUrl)
  }
  UNION
  {
    BIND(101 AS ?order)
    BIND("Effekter" AS ?beskrivelse)
    BIND("🔍" AS ?værdi)
    BIND(CONCAT("#projecttype/", SUBSTR(STR(target:), 38), "/effect") AS ?værdiUrl)
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}
ORDER BY ?order


Mønstre

PREFIX target: <https://dreams.wikibase.cloud/entity/Q321>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamsp: <https://dreams.wikibase.cloud/prop/>
PREFIX dreamspsv: <https://dreams.wikibase.cloud/prop/statement/value/> 

SELECT
  DISTINCT
  ?pattern ("🔍" AS ?patternLabel)
  (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)  

  ?rapport ?rapportLabel
  (CONCAT("#report/", SUBSTR(STR(?rapport), 38)) AS ?rapportUrl)  

  ?subject ?subjectLabel ?subjectUrl

  ?impact ?impactLabel ?impactUrl

  ?recipient ?recipientLabel ?recipientUrl

  ?signifikans ?signifikansLabel

  ?afbødning ?afbødningLabel ?afbødningUrl

  ?quote 

  ?project_phase ?project_phaseLabel
  (CONCAT("#projectphase/", SUBSTR(STR(?project_phase), 38)) AS ?project_phaseUrl)  

  ?link ?linkUrl

WHERE {
  ?pattern dreamst:P2 dreams:Q263 ;
           dreamst:P20? / dreamst:P16 / dreamst:P10* target: .

  OPTIONAL {
    ?pattern dreamst:P33 ?subject .
    ?subject rdfs:label ?subject_label .
    FILTER(LANG(?subject_label) = 'da')
    BIND(CONCAT("#effect/", SUBSTR(STR(?subject), 38)) AS ?subjectUrl)
  }
  OPTIONAL { ?pattern dreamst:P47 ?subject_text }
  BIND(COALESCE(?subject, ?subject_text, "") AS ?subject)
  BIND(CONCAT(?subject_text, " (", COALESCE(?subject_label, ""), ")") AS ?subjectLabel)
    
  OPTIONAL {
    ?pattern dreamst:P34 ?impact . 
    ?impact rdfs:label ?impact_label .
    FILTER (LANG(?impact_label) = 'da')
    BIND(CONCAT("#effect/", SUBSTR(STR(?impact), 38)) AS ?impactUrl)
  }
  OPTIONAL { ?pattern dreamst:P49 ?impact_text }
  BIND(COALESCE(?impact, ?impact_text) AS ?impact)
  BIND(CONCAT(?impact_text, " (", COALESCE(?impact_label, ""), ")") AS ?impactLabel)

  OPTIONAL {
    ?pattern dreamst:P55 ?recipient .
    ?recipient rdfs:label ?recipient_label .
    FILTER (LANG(?recipient_label) = 'da')
    BIND(CONCAT("#effect/", SUBSTR(STR(?recipient), 38)) AS ?recipientUrl)
  }
  OPTIONAL { ?pattern dreamst:P54 ?recipient_text }
  BIND(COALESCE(?recipient, ?recipient_text) AS ?recipient)
  BIND(CONCAT(?recipient_text, " (", COALESCE(?recipient_label, ""), ")") AS ?recipientLabel)

  OPTIONAL {
    ?pattern dreamst:P56 ?afbødning .
    ?afbødning rdfs:label ?afbødning_label .
    FILTER (LANG(?afbødning_label) = 'da')
    BIND(CONCAT("#effect/", SUBSTR(STR(?afbødning), 38)) AS ?afbødningUrl)
  }
  OPTIONAL { ?pattern dreamst:P53 ?afbødning_text }
  BIND(COALESCE(?afbødning, ?afbødning_text) AS ?afbødning)
  BIND(CONCAT(?afbødning_text, " (", COALESCE(?afbødning_label, ""), ")") AS ?afbødningLabel)

  OPTIONAL { ?pattern dreamst:P18 ?quote . }
  OPTIONAL { ?pattern dreamst:P19 ?project_phase . }
  OPTIONAL { ?pattern dreamst:P20 ?rapport . }

  OPTIONAL {
    ?pattern dreamst:P21 ?signifikans .
    ?signifikans rdfs:label ?signifikans_text .
    FILTER (LANG(?signifikans_text) = 'da')
    OPTIONAL { ?signifikans dreamst:P44 ?symbol . }
    BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?signifikans_symbol)
    BIND(CONCAT(?signifikans_symbol, " ", ?signifikans_text) AS ?signifikansLabel)
  }

  OPTIONAL {
    ?pattern dreamst:P20 ?rapport .
    ?rapport dreamst:P40 ?miljøportal .
    OPTIONAL { ?pattern dreamst:P46 ?page }
    BIND(IF(BOUND(?page), CONCAT(?page, " ↗"), " ↗") AS ?link)
    BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal), 
                IF(BOUND(?page), CONCAT("#page=", ?page), "")) AS ?linkUrl)
  }


  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}