query-f7a816ee6701ce76a480c527e924e814

rq turtle/ttl

Massachusetts music venuesMake a map of Massachusetts music venues!

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Music venues in Massachusetts
#defaultView:Map{"markercluster":"true"}

SELECT ?music_venue ?music_venueLabel ?coords
(group_concat(distinct ?locationLabel; separator="; ") as ?locations) 
WHERE {

    ?music_venue wdt:P131+ wd:Q771;
                 wdt:P131 ?location.
    # Things that have instance of (some subclass of) music venue or 
    # has use (some subclass of) music venue
    {?music_venue wdt:P31/wdt:P279* wd:Q8719053.}
    UNION
    {?music_venue wdt:P366/wdt:P279* wd:Q8719053.}
    OPTIONAL{?music_venue wdt:P625 ?coords}
    SERVICE wikibase:label { 
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
        ?location rdfs:label ?locationLabel.
        ?music_venue rdfs:label ?music_venueLabel.}
} group by ?music_venue ?music_venueLabel ?coords

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?coords"):::projected v2("?location") v4("?locationLabel"):::projected v6("?locations") v1("?music_venue"):::projected v5("?music_venueLabel"):::projected a1((" ")) a2((" ")) c9(["bd:serviceParam"]):::iri c5(["wd:Q8719053"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q771"]):::iri v1 --"wdt:P131"--> c2 v1 --"wdt:P131"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P366"--> a2 a2 --"wdt:P279"--> c5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P625".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 v2 --"rdfs:label"--> v4 v1 --"rdfs:label"--> v5 end bind1[/"?locationLabel"/] v4 --o bind1 bind1 --as--o v6