query-2f27a7dde360059f502cb5d64993db4c
Members of Parliament on Twitter 2019 - present. SELECT DISTINCT ?itemLabel ?constituencyLabel ?partyLabel ?twitter ?dob ?age ?sexLabel { ?item p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q77685926 . OPTIONAL { ?positionStatement pq:P768 ?constituency . } OPTIONAL { ?positionStatement pq:P4100 ?party . } OPTIONAL { ?item wdt:P2002 ?twitter . } OPTIONAL { ?item wdt:P569 ?dob . BIND(year(now()) - year(?dob) AS ?age) } OPTIONAL { ?item wdt:P21 ?sex . } SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' } } ORDER BY ?start
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#>
# Members of Parliament on Twitter 2019 - present.
SELECT DISTINCT ?itemLabel ?constituencyLabel ?partyLabel ?twitter ?dob ?age ?sexLabel {
?item p:P39 ?positionStatement .
?positionStatement ps:P39 wd:Q77685926 .
OPTIONAL { ?positionStatement pq:P768 ?constituency . }
OPTIONAL { ?positionStatement pq:P4100 ?party . }
OPTIONAL { ?item wdt:P2002 ?twitter . }
OPTIONAL { ?item wdt:P569 ?dob .
BIND(year(now()) - year(?dob) AS ?age)
}
OPTIONAL { ?item wdt:P21 ?sex . }
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}
ORDER BY ?start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?age"):::projected
v4("?constituency")
v7("?dob"):::projected
v2("?item")
v5("?party")
v3("?positionStatement")
v9("?sex")
v1("?start")
v6("?twitter"):::projected
c10(["bd:serviceParam"]):::iri
c12(["en"]):::literal
c3(["wd:Q77685926"]):::iri
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P768".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P4100".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P2002".-> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P569".-> v7
bind0[/"year-from-dateTime(NOW()) - year-from-dateTime(?dob)"/]
v7 --o bind0
bind0 --as--o v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P21".-> v9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end