query-0988b50eb8fd42a787fde4d7a11e11aa
SPARQL query
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?itemLabel (LCASE(?twitter_mc) AS ?twitter) ?constituencyLabel
WHERE
{
?item p:P39 ?statement .
?statement ps:P39/wdt:P279* wd:Q16707842 ; pq:P580 ?start .
OPTIONAL { ?statement pq:P582 ?end }
OPTIONAL { ?statement pq:P768 ?constituency }
?item wdt:P2002 ?twitter_mc .
FILTER(!BOUND(?end) || ?end > NOW())
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?twitter
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?constituency")
v2("?end")
v3("?item")
v5("?start")
v4("?statement")
v8("?twitter")
v7("?twitter_mc"):::projected
a1((" "))
c10(["bd:serviceParam"]):::iri
c4(["wd:Q16707842"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["(not bound(?end) || ?end > NOW())"]]
f0 --> v2
v3 --"p:P39"--> v4
v4 --"p:statement/P39"--> a1
a1 --"p:direct/P279"--> c4
v4 --"p:qualifier/P580"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P768".-> v6
end
v3 --"p:direct/P2002"--> v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind1[/"lower-case(?twitter_mc)"/]
v7 --o bind1
bind1 --as--o v8