Dreams:pattern: Difference between revisions

From DREAMS
Jump to navigation Jump to search
(→‎Pattern data: Clarification)
Line 1: Line 1:
== Pattern data ==
== Pattern data ==
{{SPARQL | query=  
{{SPARQL | query=  
PREFIX target: <https://dreams.wikibase.cloud/entity/Q260>
PREFIX target: <https://dreams.wikibase.cloud/entity/Q206>
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 20: Line 19:
   {
   {
     BIND(2 AS ?order)
     BIND(2 AS ?order)
     BIND("Object (effected/recipient)" AS ?description)
     BIND("Object (effected)" AS ?description)
     ?pattern dreamst:P34 ?value .
     ?pattern dreamst:P34 ?value .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(3 AS ?order)
    BIND("Recipient" AS ?description)
    ?pattern dreamst:P34 / dreamst:P9 ?value .
    ?value dreamst:P10+ dreams:Q50 .
     BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
     BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
   }
   }
Line 60: Line 67:
}
}
ORDER BY ?order
ORDER BY ?order
}}
}}

Revision as of 22:56, 5 October 2022

Pattern data

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

SELECT 
  ?description
  ?value ?valueLabel ?valueUrl
WHERE {
  BIND(target: AS ?pattern)
  {
    BIND(1 AS ?order)
    BIND("Subject (effector)" AS ?description)
    ?pattern dreamst:P33 ?value .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("Object (effected)" AS ?description)
    ?pattern dreamst:P34 ?value .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(3 AS ?order)
    BIND("Recipient" AS ?description)
    ?pattern dreamst:P34 / dreamst:P9 ?value .
    ?value dreamst:P10+ dreams:Q50 .
    BIND(CONCAT("#effect/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(5 AS ?order)
    BIND("Quote" AS ?description)
    ?pattern dreamst:P18 ?value .
  }
  UNION
  {
    BIND(10 AS ?order)
    BIND("Report" AS ?description)
    ?pattern dreamst:P20 ?value .
    BIND(CONCAT("#report/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(15 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(20 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