query-d82154539ec0bc0b79d734bdff6a34f5

rq turtle/ttl

Social media accounts of museums

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 DISTINCT ?museum ?museumLabel
(URI(CONCAT("https://twitter.com/",?twit)) AS ?twitter)
(URI(CONCAT("https://www.instagram.com/",?insta)) AS ?instagram)
(URI(CONCAT("https://www.facebook.com/",?fb)) AS ?facebook) WHERE {
?museum wdt:P31/wdt:P279* wd:Q33506. # museum (or subtype)
MINUS {?museum wdt:P576 []} # Remove defunct
OPTIONAL {?museum wdt:P2002 ?twit}
OPTIONAL {?museum wdt:P2003 ?insta}
OPTIONAL {?museum wdt:P2013 ?fb}
FILTER (BOUND(?twit)|| BOUND(?insta) || BOUND(?fb))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} ORDER BY ?museumLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?facebook") v4("?fb"):::projected v3("?insta"):::projected v7("?instagram") v5("?museum"):::projected v1("?museumLabel"):::projected v2("?twit"):::projected v6("?twitter") a2((" ")) a1((" ")) c3(["wd:Q33506"]):::iri c9(["bd:serviceParam"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["(bound(?twit) || (bound(?insta) || bound(?fb)))"]] f0 --> v2 f0 --> v3 f0 --> v4 v5 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v5 --"wdt:P576"--> a2 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P2002".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P2003".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P2013".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind2[/"concat('https://twitter.com/',?twit)"/] v2 --o bind2 bind2 --as--o v6 bind3[/"concat('https://www.instagram.com/',?insta)"/] v3 --o bind3 bind3 --as--o v7 bind4[/"concat('https://www.facebook.com/',?fb)"/] v4 --o bind4 bind4 --as--o v8