query-2444041195755e7f11fb75896f82e918
Social media accounts of libraries
Use at
- https://query.wikidata.org/sparql
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 ?library ?libraryLabel
(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 {
?library wdt:P31/wdt:P279* wd:Q7075. # library (or subtype)
MINUS {?library wdt:P576 []} # Remove defunct
MINUS {?library wdt:P31/wdt:P279* wd:Q212805} # Remove digital libraries
OPTIONAL {?library wdt:P2002 ?twit}
OPTIONAL {?library wdt:P2003 ?insta}
OPTIONAL {?library wdt:P2013 ?fb}
FILTER (BOUND(?twit)|| BOUND(?insta) || BOUND(?fb))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} ORDER BY ?libraryLabel
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("?library"):::projected
v1("?libraryLabel"):::projected
v2("?twit"):::projected
v6("?twitter")
a2((" "))
a1((" "))
a3((" "))
c3(["wd:Q7075"]):::iri
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["wd:Q212805"]):::iri
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 minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v5 --"wdt:P31"--> a3
a3 --"wdt:P279"--> c5
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;
c10 --"wikibase:language"--> c12
end
bind3[/"concat('https://twitter.com/',?twit)"/]
v2 --o bind3
bind3 --as--o v6
bind4[/"concat('https://www.instagram.com/',?insta)"/]
v3 --o bind4
bind4 --as--o v7
bind5[/"concat('https://www.facebook.com/',?fb)"/]
v4 --o bind5
bind5 --as--o v8