Dreams:effect: Difference between revisions

From DREAMS
Jump to navigation Jump to search
Line 75: Line 75:
== Affects ==
== Affects ==
{{SPARQL | query=
{{SPARQL | query=
PREFIX target: <https://dreams.wikibase.cloud/entity/Q6>
 
PREFIX target: <https://dreams.wikibase.cloud/entity/Q309>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
Line 101: Line 102:
   (CONCAT("#report/", SUBSTR(STR(?report), 38)) AS ?reportUrl)   
   (CONCAT("#report/", SUBSTR(STR(?report), 38)) AS ?reportUrl)   


  ?link ?linkUrl
WHERE {
WHERE {
   ?pattern dreamst:P2 dreams:Q263 ;
   ?pattern dreamst:P2 dreams:Q263 ;
Line 106: Line 108:
   OPTIONAL { ?pattern dreamst:P34 ?affected . }
   OPTIONAL { ?pattern dreamst:P34 ?affected . }
   OPTIONAL { ?pattern dreamst:P18 ?quote . }
   OPTIONAL { ?pattern dreamst:P18 ?quote . }
   OPTIONAL { ?pattern dreamst:P20 ?report . }
   OPTIONAL {
    ?pattern dreamst:P20 ?report .
 
    OPTIONAL {
      ?report dreamst:P40 ?miljøportal .
      BIND("↗" AS ?link1)
      BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal)) AS ?link1Url)
      OPTIONAL {
        ?pattern dreamst:P46 ?page .
        BIND(CONCAT(?page, "&nbsp;↗") AS ?link2)
        BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal),
                  "#page=", ?page) AS ?link2Url)
      }
     
      # This doesn't not make sense
      BIND(COALESCE(?link2, ?link1) AS ?link)
      # BIND(COALESCE(?link2Url, ?link1Url) AS ?linkUrl)
      BIND(IF(EXISTS { ?pattern dreamst:P46 ?page }, ?link2Url, ?link1Url) AS ?linkUrl)
    }
  }


   OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
   OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }

Revision as of 21:10, 13 October 2022

Effect data

PREFIX target: <https://dreams.wikibase.cloud/entity/Q179>
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 ?description ?value ?valueLabel ?valueUrl
WHERE {
  BIND(target: AS ?effect)
  {
    BIND(1 AS ?order)
    BIND("Effect" AS ?description)
    BIND(target: AS ?value) .
  }
  UNION
  {
    BIND(5 AS ?order)
    BIND("Superconcept" AS ?description)
    target: dreamst:P10 ?value .
    BIND(SUBSTR(STR(?value), 38) AS ?q) 
    BIND(CONCAT("#effect/", ?q) AS ?valueUrl)
  }
  UNION
  {
    BIND(6 AS ?order)
    BIND("Subconcepts" AS ?description)
    target: ^dreamst:P10 ?value .
    BIND(SUBSTR(STR(?value), 38) AS ?q) 
    BIND(CONCAT("#effect/", ?q) AS ?valueUrl)
  }
  UNION
  {
    BIND(6 AS ?order)
    BIND("Affects" AS ?description)
    target: dreamst:P9 ?value .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("Is affected by" AS ?description)
    target: ^dreamst:P9 ?value .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(10 AS ?order)
    BIND("SDG" AS ?description)
    target: dreamst:P42 ?value .
    BIND(CONCAT("#sdg/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(11 AS ?order)
    BIND("arter.dk" AS ?description)
    target: dreamst:P45 ?value_ .
    BIND(CONCAT(?value_, " ↗") AS ?value)
    BIND(CONCAT("https://arter.dk/taxa/taxon/details/", ?value_) AS ?valueUrl)
  }
  UNION
  {
    BIND(20 AS ?order)
    BIND("Scholia" AS ?description)
    target: dreamst:P3 ?value_ .
    BIND(CONCAT(?value_, " ↗") AS ?value)
    BIND(CONCAT("https://scholia.toolforge.org/topic/", ?value_) AS ?valueUrl)
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}
ORDER BY ?order


Affects

PREFIX target: <https://dreams.wikibase.cloud/entity/Q309>
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
  ?pattern ?patternLabel
  (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)  

  ?affected ?affectedLabel
  (CONCAT("#effect/", SUBSTR(STR(?affected), 38)) AS ?affectedUrl)  

  ?significance

  ?quote 

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

  ?project_type ?project_typeLabel
  (CONCAT("#projecttype/", SUBSTR(STR(?project_type), 38)) AS ?project_typeUrl)  

  ?report ?reportLabel
  (CONCAT("#report/", SUBSTR(STR(?report), 38)) AS ?reportUrl)  

  ?link ?linkUrl
WHERE {
  ?pattern dreamst:P2 dreams:Q263 ;
           dreamst:P33 / dreamst:P10* target: .
  OPTIONAL { ?pattern dreamst:P34 ?affected . }
  OPTIONAL { ?pattern dreamst:P18 ?quote . }
  OPTIONAL {
    ?pattern dreamst:P20 ?report .
  
    OPTIONAL {
      ?report dreamst:P40 ?miljøportal .
      BIND("↗" AS ?link1)
      BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal)) AS ?link1Url)
      OPTIONAL {
        ?pattern dreamst:P46 ?page .
        BIND(CONCAT(?page, " ↗") AS ?link2)
        BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal), 
                  "#page=", ?page) AS ?link2Url)
      }
      
      # This doesn't not make sense
      BIND(COALESCE(?link2, ?link1) AS ?link)
      # BIND(COALESCE(?link2Url, ?link1Url) AS ?linkUrl)
      BIND(IF(EXISTS { ?pattern dreamst:P46 ?page }, ?link2Url, ?link1Url) AS ?linkUrl)
    }
  }

  OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
  BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?significance)

  OPTIONAL { ?pattern dreamst:P19 ?project_phase . }
  OPTIONAL { ?pattern dreamst:P16 ?project_type . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}


Is affected by

PREFIX target: <https://dreams.wikibase.cloud/entity/Q6>
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
  ?pattern ?patternLabel
  (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)  

  ?effect ?effectLabel
  (CONCAT("#effect/", SUBSTR(STR(?effect), 38)) AS ?effectUrl)  

  ?significance

  ?quote 

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

  ?project_type ?project_typeLabel
  (CONCAT("#projecttype/", SUBSTR(STR(?project_type), 38)) AS ?project_typeUrl)  

  ?report ?reportLabel
  (CONCAT("#report/", SUBSTR(STR(?report), 38)) AS ?reportUrl)  

WHERE {
  ?pattern dreamst:P2 dreams:Q263 ;
           dreamst:P34 / dreamst:P10* target:
  OPTIONAL { ?pattern dreamst:P33 ?effect . }
  OPTIONAL { ?pattern dreamst:P18 ?quote . }
  OPTIONAL { ?pattern dreamst:P20 ?report . }

  OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
  BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?significance)

  OPTIONAL { ?pattern dreamst:P19 ?project_phase . }
  OPTIONAL { ?pattern dreamst:P16 ?project_type . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}