User:Nemo bis/Queries

Verified Weibo accounts

edit

Accounts from outside China

SELECT ?item ?itemLabel ?weibo
WHERE 
{
  ?item wdt:P3579 ?weibo.
  ?item p:P3579/pq:P1552 wd:Q28378282.
  #MINUS { ?item wdt:P31 wd:Q5 .}
  MINUS { ?item wdt:P17 wd:Q148 .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

OA journals by start date

edit
SELECT ?journal ?journalLabel ?started
WHERE {
  ?journal wdt:P31 wd:Q773668;
    (wdt:P275/wdt:P31) wd:Q196294.
  ?journal p:P31/pq:P580 ?started.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

DOAJ journals by software engine

edit
SELECT DISTINCT (count(?item) as ?count) ?engine ?engineLabel
WHERE 
{
  ?item wdt:P5115 ?doaj.
  ?item wdt:P408 ?engine.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?engine ?engineLabel
ORDER BY DESC(?count)
Try it!

Famous people on Mastodon

edit
SELECT ?item ?itemLabel ?handle ?links WHERE {
  ?item wdt:P31 wd:Q5.
  ?item p:P4033 ?handleStatement.
  ?handleStatement ps:P4033 ?handle.
  # But not mirrors or unofficial accounts
  MINUS { ?handleStatement pq:P3831 wd:Q29509080 } .
  MINUS { ?handleStatement pq:P3831 wd:654822 } .
  # And not those which ended already
  MINUS { ?handleStatement pq:P582 ?endtime } .
  ?item wikibase:sitelinks ?links.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC (?links)
Try it!

Famous people on Twitter

edit
# People on Twitter
SELECT DISTINCT ?item ?handle
{
  ?item wdt:P31 wd:Q5.
  ?item p:P2002 ?handleStatement.
  ?handleStatement ps:P2002 ?handle.
  # But not those which ended already
  MINUS { ?handleStatement pq:P582 ?endtime } .
  ?item wdt:P8687 ?followers.
}
ORDER BY DESC(?followers)
LIMIT 1000
Try it!

Researchers who tweet

edit
# Researchers who tweet
SELECT DISTINCT ?item ?itemLabel ?orcid ?twitter ?followers
WHERE 
{
  ?item wdt:P496 ?orcid.
  ?item wdt:P2002 ?twitter.
  # ?item wdt:P106 wd:Q1622272.
  #?item wdt:P108/wdt:P31/wdt:P279 wd:Q23002037.
  OPTIONAL { ?item wdt:P8687 ?followers.}
}
LIMIT 20000
Try it!

And who aren't on Mastodon:

# Researchers who tweet and aren't on Mastodon
SELECT DISTINCT ?item ?itemLabel ?fieldLabel ?orcid ?twitter ?followers
WHERE 
{
  ?item wdt:P496 ?orcid.
  ?item wdt:P2002 ?twitter.
  ?item wdt:P101 ?field.
  ?field wdt:P279* wd:Q420.
  # ?item wdt:P106 wd:Q1622272.
  #?item wdt:P108/wdt:P31/wdt:P279 wd:Q23002037.
  MINUS {?item wdt:P4033 ?mastodonHandle .}
  OPTIONAL { ?item wdt:P8687 ?followers.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?followers)
LIMIT 1000
Try it!

And who are on Mastodon:

# Researchers on Mastodon
SELECT ?item ?itemLabel (GROUP_CONCAT(?fieldLabel; SEPARATOR = "; ") AS ?fields) ?orcid ?twitter ?mastodon WHERE {
  SELECT ?item ?itemLabel ?fieldLabel ?orcid ?twitter ?mastodon
WHERE 
{
  ?item wdt:P496 ?orcid.
  OPTIONAL { ?item wdt:P2002 ?twitter.}
  OPTIONAL { ?item wdt:P106 ?field .}
  ?item wdt:P4033 ?mastodon .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 20000
}
GROUP BY ?item ?itemLabel ?orcid ?twitter ?mastodon
Try it!

Olympians weight and height

edit

It's defined in about 3000 items out of 11200.

# Olympyans' weight and height
SELECT ?item ?itemLabel ?weight ?height 
WHERE 
{
  ?item wdt:P31 wd:Q5.
  # ?item wdt:P21 wd:Q6581097.
  # Recent
  ?item wdt:P569 ?birth.
  filter (?birth > "1900-01-01"^^xsd:dateTime).
  ?item wdt:P1344/wdt:P31 wd:Q26132862.
  # Only kg and cm
  ?item p:P2067/psv:P2067 [ wikibase:quantityAmount     ?weight ;
                              wikibase:quantityUnit       wd:Q11570 ].
  ?item p:P2048/psv:P2048 [ wikibase:quantityAmount     ?height ;
                              wikibase:quantityUnit       wd:Q174728 ].
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Italian politicians

edit
# Parlamentari e ministri 50-80enni
SELECT DISTINCT ?item ?itemLabel (COUNT(DISTINCT ?position_statement) AS ?ministerCount)
WHERE 
{
  ?item wdt:P31 wd:Q5.
  ?item wdt:P27 wd:Q38.
  ?item wdt:P569 ?birth.
  filter (?birth > "1941-01-01"^^xsd:dateTime).
  filter (?birth < "1972-01-24"^^xsd:dateTime).
  MINUS { ?item wdt:P570 ?death. }.
  # Ex parlamentari
  ?item wdt:P39/wdt:P361/wdt:P361 wd:Q1117578.
  MINUS {  ?item wdt:P39/wdt:P361/wdt:P361 wd:Q1117578 ; 
                 pq:P580 ?start FILTER (?start >= "2018-01-01T00:00:00Z"^^xsd:dateTime) . }
  # Ministri
  ?item p:P39 ?position_statement .
  ?position_statement ps:P39/wdt:P361 wd:Q3687318.
  # Ma non ministri recenti
  MINUS { ?item p:P39 ?position_recent .
         ?position_recent ps:P39/wdt:P361 wd:Q3687318.
         ?position_recent pq:P582 ?position_end
                   FILTER (?position_end >= "2014-01-01T00:00:00Z"^^xsd:dateTime). }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it". }
}
GROUP BY ?item ?itemLabel
Try it!


MEPs on Twitter and Mastodon

edit
# 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
Try it!

Or just the official MEP accounts on Mastodon

# MEPs on Mastodon
SELECT DISTINCT ?item ?itemLabel ?mastodon (GROUP_CONCAT(DISTINCT ?groupLabel; SEPARATOR = "; ") AS ?groups) (GROUP_CONCAT(DISTINCT ?languageLabel; SEPARATOR = "; ") AS ?languages) WHERE {
  SELECT DISTINCT ?item ?itemLabel ?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:P4033 ?mastodonStatement.
  ?mastodonStatement ps:P4033 ?mastodon.
  MINUS {?mastodonStatement pq:P3831 wd:Q654822.}
  MINUS { ?mastodonStatement pq:P582 ?endtime } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 5000
}
GROUP BY ?item ?itemLabel ?handle ?mastodon
Try it!