SPARQL/WIKIDATA Language links and Badges

edit
#Female scientists with most number of sitelinks (but not English Wikipedia)
SELECT ?item ?itemLabel (COUNT(DISTINCT ?languagelink) AS ?linkcount) (SAMPLE( ?languagelink ) AS ?sample ) 
WHERE {
    ?item wdt:P31 wd:Q5.            # is a human 
    ?item wdt:P21 wd:Q6581072.      # gender female
    ?item wdt:P106 wd:Q901.         # occupation scientist
    ?languagelink schema:about ?item.
  FILTER NOT EXISTS {
    ?enlanguagelink schema:about ?item.
    ?enlanguagelink schema:inLanguage "en". 
    ?enlanguagelink schema:isPartOf <https://en.wikipedia.org/>
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,es,ar,fr" }
}
GROUP BY ?item ?itemLabel
ORDER BY DESC(?linkcount)

Try it!

The code schema:about links an item to the language link.
The code schema:inLanguage within the language link retrieves the language.
The code schema:isPartOf within the language link retrieves the wikimedia project, like <https://en.wikipedia.org/>.

Badges

edit

Badges are a kind of marker attached to a language link, which could identify, for example, that the article is a featured article badge (Q17437796) on a specific site. They do not describe the external entity but the page on the specific site.

Here a query that ranks the wikimedia projects badges.

SELECT ?wiki ?badge ?badgeLabel (COUNT(DISTINCT ?languagelink) AS ?count) (SAMPLE(?item) AS ?sample)
WHERE {
  ?languagelink schema:isPartOf ?wiki.
  ?languagelink wikibase:badge ?badge.
  ?languagelink schema:about ?item.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". 
                          ?badge rdfs:label ?badgeLabel.
                         }

}
GROUP BY ?wiki ?badge ?badgeLabel
ORDER BY DESC(?count)
LIMIT 100

Try it!

The code schema:isPartOf (within the language link) retrieves the wikimedia project, like <https://en.wikipedia.org/>.
The code wikibase:badge (within the language link) retrieves the badge, like featured article badge (Q17437796).
The code schema:about links an item to the language link.