query-8362c994ff4d670848731cf0ba17618f
How to format string output as clickable link?I cannot get the output of my query in the example below as "clickable" as I like. The WP sitelink and the "official website" are datatype URL anyway, so that's not a problem. But the Theatres Trust Database ID is a normal string property (like all those authority data properties are, by the way). I does, however, very much represent a defined part of an URL, and it would be nice to be able to generate something clickable. Here's as far as I got (and before you try it, adding the "<" and ">" to the string doesn't help either).
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?TTDB ?TTDB_URL ?enWP_article ?Website
WHERE
{
?item wdt:P4079 ?TTDB .
BIND ( CONCAT("https://database.theatrestrust.org.uk/resources/theatres/show/", ?TTDB) AS ?TTDB_URL)
OPTIONAL {
?enWP_article schema:about ?item .
?enWP_article schema:inLanguage "en" .
?enWP_article schema:isPartOf <https://en.wikipedia.org/> .
}
OPTIONAL {
?item wdt:P856 ?Website .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" }
}
LIMIT 50
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?TTDB"):::projected
v3("?TTDB_URL"):::projected
v5("?Website"):::projected
v4("?enWP_article"):::projected
v1("?item"):::projected
c6([https://en.wikipedia.org/]):::iri
c9(["bd:serviceParam"]):::iri
c4(["en"]):::literal
c11(["en,en"]):::literal
v1 --"wdt:P4079"--> v2
bind0[/"concat('https://database.theatrestrust.org.uk/resources/theatres/show/',?TTDB)"/]
v2 --o bind0
bind0 --as--o v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."schema:about".-> v1
v4 --"schema:inLanguage"--> c4
v4 --"schema:isPartOf"--> c6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P856".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end