Dreams:pattern: Difference between revisions

From DREAMS
Jump to navigation Jump to search
(→‎Pattern data: Change display of labels)
Line 1: Line 1:
== Pattern data ==
== Mønsterdata ==
{{SPARQL | query=  
{{SPARQL | query=  
PREFIX target: <https://dreams.wikibase.cloud/entity/Q922>
PREFIX target: <https://dreams.wikibase.cloud/entity/Q922>
Line 6: Line 6:


SELECT DISTINCT
SELECT DISTINCT
   ?description
   ?beskrivelse
   ?value ?valueLabel ?valueUrl
   ?value ?valueLabel ?valueUrl
WHERE {
WHERE {
Line 12: Line 12:
   {
   {
     BIND(1 AS ?order)
     BIND(1 AS ?order)
     BIND("Subject (effector)" AS ?description)
     BIND("Subject (effector)" AS ?beskrivelse)
     OPTIONAL {
     OPTIONAL {
       ?pattern dreamst:P33 ?value .  
       ?pattern dreamst:P33 ?value .  
Line 26: Line 26:
   {
   {
     BIND(2 AS ?order)
     BIND(2 AS ?order)
     BIND("Object (affected)" AS ?description)
     BIND("Object (affected)" AS ?beskrivelse)
     OPTIONAL {
     OPTIONAL {
       ?pattern dreamst:P34 ?value .
       ?pattern dreamst:P34 ?value .
Line 40: Line 40:
   {
   {
     BIND(10 AS ?order)
     BIND(10 AS ?order)
     BIND("Recipient" AS ?description)
     BIND("Recipient" AS ?beskrivelse)
     OPTIONAL {
     OPTIONAL {
       ?pattern dreamst:P55 ?value .
       ?pattern dreamst:P55 ?value .
Line 54: Line 54:
   {
   {
     BIND(11 AS ?order)
     BIND(11 AS ?order)
     BIND("Significance" AS ?description)
     BIND("Significance" AS ?beskrivelse)
     ?pattern dreamst:P21 ?value .
     ?pattern dreamst:P21 ?value .
   }
   }
Line 60: Line 60:
   {
   {
     BIND(12 AS ?order)
     BIND(12 AS ?order)
     BIND("Mitigation" AS ?description)
     BIND("Mitigation" AS ?beskrivelse)
     OPTIONAL {
     OPTIONAL {
       ?pattern dreamst:P56 ?value .
       ?pattern dreamst:P56 ?value .
Line 74: Line 74:
   {
   {
     BIND(15 AS ?order)
     BIND(15 AS ?order)
     BIND("Quote" AS ?description)
     BIND("Quote" AS ?beskrivelse)
     ?pattern dreamst:P18 ?value .
     ?pattern dreamst:P18 ?value .
   }
   }
Line 80: Line 80:
   {
   {
     BIND(20 AS ?order)
     BIND(20 AS ?order)
     BIND("Report" AS ?description)
     BIND("Report" AS ?beskrivelse)
     ?pattern dreamst:P20 ?value .
     ?pattern dreamst:P20 ?value .
     BIND(CONCAT("#report/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
     BIND(CONCAT("#report/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
Line 87: Line 87:
   {
   {
     BIND(25 AS ?order)
     BIND(25 AS ?order)
     BIND("Project type" AS ?description)
     BIND("Project type" AS ?beskrivelse)
     { ?pattern dreamst:P16 ?value_from_pattern . }
     { ?pattern dreamst:P16 ?value_from_pattern . }
     UNION  
     UNION  
Line 97: Line 97:
   {
   {
     BIND(26 AS ?order)
     BIND(26 AS ?order)
     BIND("Project phase" AS ?description)
     BIND("Project phase" AS ?beskrivelse)
     ?pattern dreamst:P19 ?value .
     ?pattern dreamst:P19 ?value .
     BIND(CONCAT("#projectphase/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
     BIND(CONCAT("#projectphase/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
Line 104: Line 104:
   {
   {
     BIND(30 AS ?order)
     BIND(30 AS ?order)
     BIND("Miljøportal" AS ?description)
     BIND("Miljøportal" AS ?beskrivelse)
     ?pattern dreamst:P20 / dreamst:P40 ?value_ .
     ?pattern dreamst:P20 / dreamst:P40 ?value_ .
     OPTIONAL { ?pattern dreamst:P46 ?page }
     OPTIONAL { ?pattern dreamst:P46 ?page }

Revision as of 13:13, 9 December 2022

Mønsterdata

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

SELECT DISTINCT
  ?beskrivelse
  ?value ?valueLabel ?valueUrl
WHERE {
  BIND(target: AS ?pattern)
  {
    BIND(1 AS ?order)
    BIND("Subject (effector)" AS ?beskrivelse)
    OPTIONAL {
      ?pattern dreamst:P33 ?value . 
      ?value rdfs:label ?value_label .
      FILTER (LANG(?value_label) = 'da')
      BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
    }
    OPTIONAL { ?pattern dreamst:P47 ?value_text }
    BIND(COALESCE(?value, ?value_text) AS ?value)
    BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("Object (affected)" AS ?beskrivelse)
    OPTIONAL {
      ?pattern dreamst:P34 ?value .
      ?value rdfs:label ?value_label .
      FILTER (LANG(?value_label) = 'da')
      BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
    }
    OPTIONAL { ?pattern dreamst:P49 ?value_text }
    BIND(COALESCE(?value, ?value_text) AS ?value)
    BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
  }
  UNION
  {
    BIND(10 AS ?order)
    BIND("Recipient" AS ?beskrivelse)
    OPTIONAL {
      ?pattern dreamst:P55 ?value .
      ?value rdfs:label ?value_label .
      FILTER (LANG(?value_label) = 'da')
      BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
    }
    OPTIONAL { ?pattern dreamst:P54 ?value_text }
    BIND(COALESCE(?value, ?value_text) AS ?value)
    BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
  }
  UNION
  {
    BIND(11 AS ?order)
    BIND("Significance" AS ?beskrivelse)
    ?pattern dreamst:P21 ?value .
  }
  UNION
  {
    BIND(12 AS ?order)
    BIND("Mitigation" AS ?beskrivelse)
    OPTIONAL {
      ?pattern dreamst:P56 ?value .
      ?value rdfs:label ?value_label .
      FILTER (LANG(?value_label) = 'da')
      BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
    }
    OPTIONAL { ?pattern dreamst:P53 ?value_text }
    BIND(COALESCE(?value, ?value_text) AS ?value)
    BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
  }
  UNION
  {
    BIND(15 AS ?order)
    BIND("Quote" AS ?beskrivelse)
    ?pattern dreamst:P18 ?value .
  }
  UNION
  {
    BIND(20 AS ?order)
    BIND("Report" AS ?beskrivelse)
    ?pattern dreamst:P20 ?value .
    BIND(CONCAT("#report/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(25 AS ?order)
    BIND("Project type" AS ?beskrivelse)
    { ?pattern dreamst:P16 ?value_from_pattern . }
    UNION 
    { ?pattern dreamst:P20 / dreamst:P16 ?value_from_report . }
    BIND(COALESCE(?value_from_pattern, ?value_from_report) AS ?value)
    BIND(CONCAT("#projecttype/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(26 AS ?order)
    BIND("Project phase" AS ?beskrivelse)
    ?pattern dreamst:P19 ?value .
    BIND(CONCAT("#projectphase/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(30 AS ?order)
    BIND("Miljøportal" AS ?beskrivelse)
    ?pattern dreamst:P20 / dreamst:P40 ?value_ .
    OPTIONAL { ?pattern dreamst:P46 ?page }
    BIND(CONCAT(STR(?value_), IF(BOUND(?page), CONCAT(" (page ", ?page, ") ↗"), " ↗")) AS ?value)
    BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?value_), 
                IF(BOUND(?page), CONCAT("#page=", ?page), "")) AS ?valueUrl)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}
ORDER BY ?order