Dreams:pattern: Difference between revisions

From DREAMS
Jump to navigation Jump to search
(→‎Pattern data: Add mitigation)
(→‎Pattern data: Change display of labels)
Line 21: Line 21:
     OPTIONAL { ?pattern dreamst:P47 ?value_text }
     OPTIONAL { ?pattern dreamst:P47 ?value_text }
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(CONCAT(COALESCE(?value_label, ""), ' ("', ?value_text, '")') AS ?valueLabel)
     BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
   }
   }
   UNION
   UNION
Line 35: Line 35:
     OPTIONAL { ?pattern dreamst:P49 ?value_text }
     OPTIONAL { ?pattern dreamst:P49 ?value_text }
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(CONCAT(COALESCE(?value_label, ""), ' ("', ?value_text, '")') AS ?valueLabel)
     BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
   }
   }
   UNION
   UNION
Line 49: Line 49:
     OPTIONAL { ?pattern dreamst:P54 ?value_text }
     OPTIONAL { ?pattern dreamst:P54 ?value_text }
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(CONCAT(COALESCE(?value_label, ""), ' ("', ?value_text, '")') AS ?valueLabel)
     BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
   }
   }
   UNION
   UNION
Line 69: Line 69:
     OPTIONAL { ?pattern dreamst:P53 ?value_text }
     OPTIONAL { ?pattern dreamst:P53 ?value_text }
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(COALESCE(?value, ?value_text) AS ?value)
     BIND(CONCAT(COALESCE(?value_label, ""), ' ("', ?value_text, '")') AS ?valueLabel)
     BIND(CONCAT(?value_text, " (", COALESCE(?value_label, ""), ")") AS ?valueLabel)
   }
   }
   UNION
   UNION

Revision as of 14:52, 8 December 2022

Pattern data

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
  ?description
  ?value ?valueLabel ?valueUrl
WHERE {
  BIND(target: AS ?pattern)
  {
    BIND(1 AS ?order)
    BIND("Subject (effector)" AS ?description)
    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 ?description)
    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 ?description)
    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 ?description)
    ?pattern dreamst:P21 ?value .
  }
  UNION
  {
    BIND(12 AS ?order)
    BIND("Mitigation" AS ?description)
    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 ?description)
    ?pattern dreamst:P18 ?value .
  }
  UNION
  {
    BIND(20 AS ?order)
    BIND("Report" AS ?description)
    ?pattern dreamst:P20 ?value .
    BIND(CONCAT("#report/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(25 AS ?order)
    BIND("Project type" AS ?description)
    { ?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 ?description)
    ?pattern dreamst:P19 ?value .
    BIND(CONCAT("#projectphase/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(30 AS ?order)
    BIND("Miljøportal" AS ?description)
    ?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