query-94594ab028cfb67d87af11c329c7c514

rq turtle/ttl

Adding hyperlinks in map view, and i want to try and improve the query. Hovering over a pin in map view gives a pop-up box with an image and hyperlinks to the relevent Wikidata items, but what i really want is a hyperlink to the official website of each library. I have done this with the query below: their front pageHey. Could someone lend a hand? The National Libraries website here in Wales has decided to embed a Wikidata map on

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?s ?sLabel ?coor ?operator ?operatorLabel ?image ?layer ?website WHERE {  

       ?s wdt:P31/wdt:P279* wd:Q28564 ;
          wdt:P17 wd:Q145 ;
          wdt:P625 ?coor ;
          wdt:P137 ?operator ;
          OPTIONAL {?s wdt:P18 ?image .}
          OPTIONAL {?s wdt:P856 ?website .}

  VALUES ?operator { wd:Q4923796 wd:Q4966533 wd:Q5016926 wd:Q5038400 wd:Q5043224 wd:Q5064127 wd:Q5166758 wd:Q5256629 wd:Q16837157
                   wd:Q5623821 wd:Q6083890 wd:Q16997658 wd:Q6901162 wd:Q6984500 wd:Q16998902 wd:Q7161994 wd:Q7236943 wd:Q7321391 
                                 wd:Q5123523 wd:Q7825688 wd:Q7909538 wd:Q8038115 } 
BIND ( 
       IF(?operator = wd:Q4923796, "Blaenau Gwent", 
       IF(?operator = wd:Q4966533, "Bridgend", 
       IF(?operator = wd:Q5016926, "Caerphilly",  
       IF(?operator = wd:Q5038400, "Cardiff",   
       IF(?operator = wd:Q5043224, "Carmarthenshire", 
       IF(?operator = wd:Q5064127, "Ceredigion",   
       IF(?operator = wd:Q5166758, "Conwy",
       IF(?operator = wd:Q5256629, "Denbighshire",
       IF(?operator = wd:Q16837157, "Flintshire", 
       IF(?operator = wd:Q5623821, "Gwynedd",   
       IF(?operator = wd:Q6083890, "Isle of Anglesey",
       IF(?operator = wd:Q16997658, "Merthyr Tydfil",
       IF(?operator = wd:Q6901162, "Monmouthshire",
       IF(?operator = wd:Q6984500, "Neath Port Talbot",   
       IF(?operator = wd:Q16998902, "Newport",
       IF(?operator = wd:Q7161994, "Pembrokeshire", 
       IF(?operator = wd:Q7236943, "Powys",   
       IF(?operator = wd:Q7321391, "Rhondda Cynon Taf",
       IF(?operator = wd:Q5123523, "Swansea",
       IF(?operator = wd:Q7825688, "Torfaen",   
       IF(?operator = wd:Q7909538, "Vale of Glamorgan", 
       IF(?operator = wd:Q8038115, "Wrexham",
                   "")))))))))))))))))))))) AS ?layer).  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?website

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?coor"):::projected v5("?image"):::projected v6("?layer"):::projected v6("?operator"):::projected v2("?s"):::projected v1("?website"):::projected a1((" ")) c3(["wd:Q28564"]):::iri c13(["en"]):::literal c11(["bd:serviceParam"]):::iri c5(["wd:Q145"]):::iri v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v2 --"wdt:P17"--> c5 v2 --"wdt:P625"--> v3 v2 --"wdt:P137"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P856".-> v1 end bind0[/VALUES ?operator/] bind0-->v6 bind00(["wd:Q4923796"]) bind00 --> bind0 bind01(["wd:Q4966533"]) bind01 --> bind0 bind02(["wd:Q5016926"]) bind02 --> bind0 bind03(["wd:Q5038400"]) bind03 --> bind0 bind04(["wd:Q5043224"]) bind04 --> bind0 bind05(["wd:Q5064127"]) bind05 --> bind0 bind06(["wd:Q5166758"]) bind06 --> bind0 bind07(["wd:Q5256629"]) bind07 --> bind0 bind08(["wd:Q16837157"]) bind08 --> bind0 bind09(["wd:Q5623821"]) bind09 --> bind0 bind010(["wd:Q6083890"]) bind010 --> bind0 bind011(["wd:Q16997658"]) bind011 --> bind0 bind012(["wd:Q6901162"]) bind012 --> bind0 bind013(["wd:Q6984500"]) bind013 --> bind0 bind014(["wd:Q16998902"]) bind014 --> bind0 bind015(["wd:Q7161994"]) bind015 --> bind0 bind016(["wd:Q7236943"]) bind016 --> bind0 bind017(["wd:Q7321391"]) bind017 --> bind0 bind018(["wd:Q5123523"]) bind018 --> bind0 bind019(["wd:Q7825688"]) bind019 --> bind0 bind020(["wd:Q7909538"]) bind020 --> bind0 bind021(["wd:Q8038115"]) bind021 --> bind0 bind1[/"if(?operator = 'wd:Q4923796','Blaenau Gwent',if(?operator = 'wd:Q4966533','Bridgend',if(?operator = 'wd:Q5016926','Caerphilly',if(?operator = 'wd:Q5038400','Cardiff',if(?operator = 'wd:Q5043224','Carmarthenshire',if(?operator = 'wd:Q5064127','Ceredigion',if(?operator = 'wd:Q5166758','Conwy',if(?operator = 'wd:Q5256629','Denbighshire',if(?operator = 'wd:Q16837157','Flintshire',if(?operator = 'wd:Q5623821','Gwynedd',if(?operator = 'wd:Q6083890','Isle of Anglesey',if(?operator = 'wd:Q16997658','Merthyr Tydfil',if(?operator = 'wd:Q6901162','Monmouthshire',if(?operator = 'wd:Q6984500','Neath Port Talbot',if(?operator = 'wd:Q16998902','Newport',if(?operator = 'wd:Q7161994','Pembrokeshire',if(?operator = 'wd:Q7236943','Powys',if(?operator = 'wd:Q7321391','Rhondda Cynon Taf',if(?operator = 'wd:Q5123523','Swansea',if(?operator = 'wd:Q7825688','Torfaen',if(?operator = 'wd:Q7909538','Vale of Glamorgan',if(?operator = 'wd:Q8038115','Wrexham',''))))))))))))))))))))))"/] v6 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end