query-e8e85fcf658948afad31689bca79cf49

rq turtle/ttl

better version of the one above: we select only articles that have one single author

(excluding the case where there are multiple authors but just one is a "string" author)

SELECT $item $count ?author_name ?rank WHERE { # FILTER REGEX(STR(?count), "^[1]{1}$") # FILTER REGEX(STR(?rank), "^[1]{1}$") # FILTER (?count >= 7) FILTER (?count = 1) FILTER (STR(?rank) = "1") { SELECT DISTINCT ?item (COUNT (?author) as ?count) WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item wdt:P2093 ?author. } GROUP BY (?item) } { SELECT DISTINCT ?item (xsd:string(?author) AS ?author_name) ?rank WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item p:P2093 [ ps:P2093 ?author ; pq:P1545 ?rank ] . } } }

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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/>
# better version of the one above: we select only articles that have one single author
# (excluding the case where there are multiple authors but just one is a "string" author)
SELECT $item $count ?author_name ?rank  WHERE {
  # FILTER REGEX(STR(?count), "^[1]{1}$")
  # FILTER REGEX(STR(?rank), "^[1]{1}$")
  # FILTER (?count >= 7)
  FILTER (?count = 1)
  FILTER (STR(?rank) = "1")
  {
    SELECT DISTINCT ?item (COUNT (?author) as ?count) WHERE {
      ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 .
      ?item wdt:P2093 ?author.
    }
    GROUP BY (?item)
  }
  {
    SELECT DISTINCT ?item (xsd:string(?author) AS ?author_name) ?rank WHERE {
      ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 .
      ?item p:P2093 [ ps:P2093 ?author ; pq:P1545 ?rank ] .
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?author") v5("?author_name"):::projected v5("?count"):::projected v3("?item"):::projected v1("?rank"):::projected a1((" ")) c6(["wd:Q57081850"]):::iri c4(["wd:Q13442814"]):::iri f0[["str(?rank) = '1'"]] f0 --> v1 f1[["?count = '1^^xsd:integer'"]] f1 --> v5 v3 --"p:direct/P31"--> c4 v3 --"p:direct/P179"--> c6 v3 --"p:direct/P2093"--> v4 bind3[/"count(?author)"/] v4 --o bind3 bind3 --as--o v5 v3 --"p:direct/P31"--> c4 v3 --"p:direct/P179"--> c6 a1 --"p:statement/P2093"--> v4 a1 --"p:qualifier/P1545"--> v1 v3 --"p:P2093"--> a1 bind4[/"http://www.w3.org/2001/XMLSchema#string(?author)"/] v4 --o bind4 bind4 --as--o v5