query-7d114e0c77472fbefd3cdd94fcb1b12f
Every state library association website (http://librarian.net/stax/4920/every-state-library-association-website/) SELECT distinct ?item ?itemLabel ?acronymLabel ?wikilink WHERE { ?item wdt:P31 wd:Q856564. #Q856564 = library association ?item wdt:P17 wd:Q30 . #Q30 = United States of America OPTIONAL { ?item wdt:P1813 ?acronym} OPTIONAL { ?item wdt:P856 ?website} BIND(CONCAT('[', str(?website), ' ', str(?website), ']') AS ?wikilink) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?itemLabel
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#>
#Every state library association website (http://librarian.net/stax/4920/every-state-library-association-website/)
SELECT distinct ?item ?itemLabel ?acronymLabel ?wikilink
WHERE
{
?item wdt:P31 wd:Q856564. #Q856564 = library association
?item wdt:P17 wd:Q30 . #Q30 = United States of America
OPTIONAL { ?item wdt:P1813 ?acronym}
OPTIONAL { ?item wdt:P856 ?website}
BIND(CONCAT('[', str(?website), ' ', str(?website), ']') AS ?wikilink) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?acronym")
v2("?item"):::projected
v1("?itemLabel"):::projected
v4("?website")
v5("?wikilink"):::projected
c2(["wd:Q856564"]):::iri
c8(["bd:serviceParam"]):::iri
c4(["wd:Q30"]):::iri
c10(["en"]):::literal
v2 --"wdt:P31"--> c2
v2 --"wdt:P17"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1813".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P856".-> v4
end
bind0[/"concat('#91;',str(?website),' ',str(?website),'#93;')"/]
v4 --o bind0
bind0 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end