Dreams:pattern-index: Difference between revisions

(→‎Patterns: Fix on recipient)
Line 10: Line 10:
   (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)
   (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)


   ?subject ?subjectLabel
   ?subject ?subjectLabel ?subjectUrl
  (CONCAT("#effect/", SUBSTR(STR(?subject), 38)) AS ?subjectUrl)


   ?object ?objectLabel
   ?object ?objectLabel ?objectUrl
  (CONCAT("#effect/", SUBSTR(STR(?object), 38)) AS ?objectUrl)


   ?recipient ?recipientLabel
   ?recipient ?recipientLabel ?recipientUrl
  (CONCAT("#effect/", SUBSTR(STR(?recipient), 38)) AS ?recipientUrl)


   ?quote  
   ?quote  
Line 29: Line 26:
   ?pattern dreamst:P2 dreams:Q263 .
   ?pattern dreamst:P2 dreams:Q263 .


   OPTIONAL { ?pattern dreamst:P33 ?subject . }
   OPTIONAL {
   OPTIONAL { ?pattern dreamst:P34 ?object . }
    ?pattern dreamst:P33 ?subject .
   OPTIONAL { ?pattern dreamst:P55 ?recipient . }
    ?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(COALESCE(?subject_label, ""), ' ("', ?subject_text, '")') AS ?subjectLabel)
   
  OPTIONAL {
    ?pattern dreamst:P34 ?object .  
    ?object rdfs:label ?object_label .
    FILTER (LANG(?object_label) = 'da')
    BIND(CONCAT("#effect/", SUBSTR(STR(?object), 38)) AS ?objectUrl)
  }
   OPTIONAL { ?pattern dreamst:P49 ?object_text }
  BIND(COALESCE(?object, ?object_text) AS ?object)
  BIND(CONCAT(COALESCE(?object_label, ""), ' ("', ?object_text, '")') AS ?objectLabel)
 
  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(COALESCE(?recipient_label, ""), ' ("', ?recipient_text, '")') AS ?recipientLabel)


   OPTIONAL { ?pattern dreamst:P18 ?quote . }
   OPTIONAL { ?pattern dreamst:P18 ?quote . }