query-388767accc391fb8ccd39602d7ad080e

rq turtle/ttl

taxa of wd:Q59256 with author, but no Wikispecies sitelink

by Jura1, August 29, 2020

SELECT ?author ?authorLabel ?taxa ?count WITH { SELECT ?author (GROUP_CONCAT(DISTINCT ?taxon; separator=", ") as ?taxa) (COUNT(?taxon) as ?count) WHERE { hint:Query hint:optimizer "None". ?taxonitem wdt:P171+ wd:Q59256 . ?taxonitem p:P225 ?st . ?st pq:P405 ?author . FILTER NOT EXISTS { [] schema:about ?author ; schema:isPartOf https://species.wikimedia.org/ } ?st ps:P225 ?taxon . } GROUP BY ?author } as %new WHERE { INCLUDE %new SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count) LIMIT 100

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
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#>
#taxa of wd:Q59256 with author, but no Wikispecies sitelink
#by Jura1, August 29, 2020

SELECT ?author ?authorLabel ?taxa ?count
WHERE
{

{
  SELECT ?author
         (GROUP_CONCAT(DISTINCT ?taxon; separator=", ") as ?taxa)
         (COUNT(?taxon) as ?count)
  WHERE
  {

    ?taxonitem wdt:P171+ wd:Q59256 .
    ?taxonitem p:P225 ?st . 
    ?st pq:P405 ?author .
    FILTER NOT EXISTS { [] schema:about ?author ; schema:isPartOf <https://species.wikimedia.org/> }
    ?st ps:P225 ?taxon .
  }
  GROUP BY ?author
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?author"):::projected v7("?count"):::projected v4("?st") v6("?taxa"):::projected v5("?taxon") v3("?taxonitem") a1((" ")) c3([https://species.wikimedia.org/]):::iri c10(["bd:serviceParam"]):::iri c5(["wd:Q59256"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0a1 --"schema:about"--> e0v1 e0a1 --"schema:isPartOf"--> e0c3 e0v1("?author"):::projected e0a1((" ")):::projected e0c3([https://species.wikimedia.org/]):::iri end f0--EXISTS--> f0e0 f0 --> a1 f0 --> c1 f0 --> v2 f0 --> c2 f0 --> c3 a1 --"schema:about"--> v2 a1 --"schema:isPartOf"--> c3 v3 --"p:direct/P171"--> c5 v3 --"p:P225"--> v4 v4 --"p:qualifier/P405"--> v2 v4 --"p:statement/P225"--> v5 bind3[/"?taxon"/] v5 --o bind3 bind3 --as--o v6 bind4[/"count(?taxon)"/] v5 --o bind4 bind4 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end