query-c9981d83bf8384dc9ed908b93c95f87d

rq turtle/ttl

Geolocated topics of scholarly articles

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#source: https://gist.github.com/floatingpurr/490df22fdbeff0f127f71f83eff6a284
#defaultView:Map{"layer":"?topicsBin"}
SELECT ?topic ?topicLabel ?geoloc ?topicsBin ?topicCitations
WHERE{
   BIND(
      IF(?topicCitations < 10, "Log < 1",
            IF(?topicCitations < 100, "Log < 2",
                IF(?topicCitations < 1000, "Log < 3",
                    "Log >= 3")))
    AS ?topicsBin)

  {
  SELECT ?topic ?geoloc (count(?topic) as ?topicCitations) 

  WHERE {

  ?paper wdt:P921 ?topic ; 
         wdt:P31 wd:Q13442814 .
  ?topic wdt:P625 ?geoloc.
  } 

  GROUP BY ?topic ?geoloc


  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?geoloc"):::projected v2("?paper") v3("?topic"):::projected v5("?topicCitations"):::projected v1("?topicsBin"):::projected c3(["wd:Q13442814"]):::iri c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/"if(?topicCitations < '10^^xsd:integer','Log < 1',if(?topicCitations < '100^^xsd:integer','Log < 2',if(?topicCitations < '1000^^xsd:integer','Log < 3','Log >= 3')))"/] v5 --o bind0 bind0 --as--o v1 v2 --"wdt:P921"--> v3 v2 --"wdt:P31"--> c3 v3 --"wdt:P625"--> v4 bind2[/"count(?topic)"/] v3 --o bind2 bind2 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end