query-8098e38823c4ea7e1d59cf7d7171a3dd
Breweries that are abbreviated to ABC
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 skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table
SELECT ?item ?itemLabel ?countryLabel ?localityLabel
WHERE
{
{?item wdt:P31 wd:Q131734} # Is a brewery
UNION
{?item wdt:P31 wd:Q5487333} # or a microbrewery
?item skos:altLabel ?alias. # Get the alias (also known as)
OPTIONAL {?item wdt:P17 ?country}. # Get the country
OPTIONAL {?item wdt:P131 ?locality}. # Get the locality
FILTER(CONTAINS(?alias, "ABC"@en)) # Check that the alias is 'ABC'
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE]"
}
}
ORDER BY ?countryLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?alias")
v4("?country")
v1("?countryLabel"):::projected
v3("?item"):::projected
v5("?locality")
c4(["wd:Q5487333"]):::iri
c3(["wd:Q131734"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;"]):::literal
f0[["contains(?alias,sABC^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>')"]]
f0 --> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> c3
end
union0r <== or ==> union0l
end
v3 --"skos:altLabel"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P17".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P131".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end