query-314bb2aeee7208730ec9104b0a882e02
MEPs on Twitter and Mastodon mirrors SELECT ?item ?itemLabel ?handle ?mastodon (GROUP_CONCAT(DISTINCT ?groupLabel; SEPARATOR = "; ") AS ?groups) (GROUP_CONCAT(DISTINCT ?languageLabel; SEPARATOR = "; ") AS ?languages) WHERE { SELECT DISTINCT ?item ?itemLabel ?handle ?mastodon ?groupLabel ?languageLabel WHERE { ?item p:P39 ?officeStatement. ?officeStatement ps:P39 wd:Q27169. OPTIONAL { ?officeStatement pq:P4100 ?group. } OPTIONAL { ?item wdt:P1412 ?language. } ?item p:P27 ?citizenshipStatement. ?citizenshipStatement ps:P27 ?citizenship. MINUS { ?citizenshipStatement pq:P582 ?endtime } . ?item p:P2002 ?handleStatement. ?handleStatement ps:P2002 ?handle. # But not those which ended already MINUS { ?handleStatement pq:P582 ?endtime } . OPTIONAL { ?item p:P4033 ?mastodonStatement. ?mastodonStatement ps:P4033 ?mastodon. ?mastodonStatement pq:P3831 wd:Q654822. ?mastodonStatement wikibase:rank ?rank }. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 2000 } GROUP BY ?item ?itemLabel ?handle ?mastodon
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#>
# MEPs on Twitter and Mastodon mirrors
SELECT ?item ?itemLabel ?handle ?mastodon (GROUP_CONCAT(DISTINCT ?groupLabel; SEPARATOR = "; ") AS ?groups) (GROUP_CONCAT(DISTINCT ?languageLabel; SEPARATOR = "; ") AS ?languages) WHERE {
SELECT DISTINCT ?item ?itemLabel ?handle ?mastodon ?groupLabel ?languageLabel
WHERE
{
?item p:P39 ?officeStatement.
?officeStatement ps:P39 wd:Q27169.
OPTIONAL { ?officeStatement pq:P4100 ?group. }
OPTIONAL { ?item wdt:P1412 ?language. }
?item p:P27 ?citizenshipStatement.
?citizenshipStatement ps:P27 ?citizenship.
MINUS { ?citizenshipStatement pq:P582 ?endtime } .
?item p:P2002 ?handleStatement.
?handleStatement ps:P2002 ?handle.
# But not those which ended already
MINUS { ?handleStatement pq:P582 ?endtime } .
OPTIONAL { ?item p:P4033 ?mastodonStatement.
?mastodonStatement ps:P4033 ?mastodon.
?mastodonStatement pq:P3831 wd:Q654822.
?mastodonStatement wikibase:rank ?rank }.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 2000
}
GROUP BY ?item ?itemLabel ?handle ?mastodon