query-3b6ae7933e86b7bec7e3c0d0a7f92ff1

rq turtle/ttl

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

select economists

join economist name with single author string.

without the limit, we're in timeout.

SELECT $item $count ?author_name $a WHERE { # FILTER REGEX(STR(?count), "^[1]{1}$") 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 (xsd:string(?author) AS ?author_name) WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item wdt:P2093 ?author. } } { SELECT (xsd:string(?author) AS ?author_name) $a WHERE { ?a wdt:P31 wd:Q5; wdt:P106 wd:Q188094; rdfs:label ?author . FILTER(LANG(?author) IN ("en")) . } LIMIT 3000 } }

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
# select nber articles with one single author (author as a string), 
# select economists
# join economist name with single author string.
# without the limit, we're in timeout.

SELECT $item $count ?author_name $a WHERE {
  # FILTER REGEX(STR(?count), "^[1]{1}$")
  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 (xsd:string(?author) AS ?author_name) WHERE {
      ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 .
      ?item wdt:P2093 ?author.
    }
  }
  {
    SELECT (xsd:string(?author) AS ?author_name) $a WHERE {
      ?a wdt:P31 wd:Q5;
         wdt:P106 wd:Q188094;
         rdfs:label ?author .
      FILTER(LANG(?author) IN ("en")) .
    }
    LIMIT 3000
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?a"):::projected v3("?author") v6("?author_name"):::projected v4("?count"):::projected v2("?item"):::projected c5(["wd:Q57081850"]):::iri c3(["wd:Q13442814"]):::iri c8(["wd:Q5"]):::iri c10(["wd:Q188094"]):::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 bind3[/"http://www.w3.org/2001/XMLSchema#string(?author)"/] v3 --o bind3 bind3 --as--o v6 f4[["?author = 'en'"]] f4 --> v3 v5 --"wdt:P31"--> c8 v5 --"wdt:P106"--> c10 v5 --"rdfs:label"--> v3 bind5[/"http://www.w3.org/2001/XMLSchema#string(?author)"/] v3 --o bind5 bind5 --as--o v6