query-466164b977096afbfce95d15ebfe921e

rq turtle/ttl

select articles with one single author (author as a string),

and select the author (which can't be done in the same query, it has to be made in a join)

SELECT $item $count ?author WHERE { FILTER (?count = 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 ?author WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item wdt:P2093 ?author. } } }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
# select articles with one single author (author as a string), 
# and select the author (which can't be done in the same query, it has to be made in a join)
SELECT $item $count ?author WHERE {
  FILTER (?count = 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 ?author WHERE {
      ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 .
      ?item wdt:P2093 ?author.
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?author"):::projected v4("?count"):::projected v2("?item"):::projected c5(["wd:Q57081850"]):::iri c3(["wd:Q13442814"]):::iri f0[["?count = '1^^xsd:integer'"]] f0 --> v4 v2 --"wdt:P31"--> c3 v2 --"wdt:P179"--> c5 v2 --"wdt:P2093"--> v3 bind2[/"count(?author)"/] v3 --o bind2 bind2 --as--o v4 v2 --"wdt:P31"--> c3 v2 --"wdt:P179"--> c5 v2 --"wdt:P2093"--> v3