query-4db58a6331ef256de4776593e8f9e8e0

rq turtle/ttl

This query finds the most prolific photographers in an area around a Wikidata item (Magnus Manske) SELECT ?creatorName ?creatorUrl (count(?creatorUrl) AS ?pictures_taken) WHERE { BIND ( wd:Q868642 as ?centerItem ) . # CHANGE THIS ITEM TO SET THE NEW CENTER BIND ( "5" as ?km ) . # CHANGE THIS TO SET THE SEARCH RADIUS (IN KM)

hint:Query hint:optimizer "None". SERVICE https://query.wikidata.org/sparql { ?centerItem wdt:P625 ?center } SERVICE wikibase:around { ?file wdt:P1259 ?coor. bd:serviceParam wikibase:center ?center . bd:serviceParam wikibase:radius ?km. }
?file p:P170 ?creatorStatement . ?creatorStatement pq:P2699 ?creatorUrl . ?creatorStatement pq:P2093 ?creatorName . } GROUP BY ?creatorName ?creatorUrl ORDER BY DESC(?pictures_taken)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# This query finds the most prolific photographers in an area around a Wikidata item (Magnus Manske)
SELECT ?creatorName ?creatorUrl (count(?creatorUrl) AS ?pictures_taken) WHERE {
  BIND ( wd:Q868642 as ?centerItem ) . # CHANGE THIS ITEM TO SET THE NEW CENTER
  BIND ( "5" as ?km ) . # CHANGE THIS TO SET THE SEARCH RADIUS (IN KM)


  SERVICE <https://query.wikidata.org/sparql> { ?centerItem wdt:P625 ?center }
  SERVICE wikibase:around {
      ?file wdt:P1259 ?coor.
      bd:serviceParam wikibase:center ?center .
      bd:serviceParam wikibase:radius ?km.
  }  
  ?file p:P170 ?creatorStatement .
  ?creatorStatement pq:P2699 ?creatorUrl .
  ?creatorStatement pq:P2093 ?creatorName .
}
GROUP BY ?creatorName ?creatorUrl
ORDER BY DESC(?pictures_taken)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?center") v2("?centerItem") v6("?coor") v9("?creatorName"):::projected v7("?creatorStatement") v8("?creatorUrl"):::projected v5("?file") v3("?km") v10("?pictures_taken") c5(["bd:serviceParam"]):::iri bind0[/"'wd:Q868642'"/] bind0 --as--o v2 bind1[/"'5'"/] bind1 --as--o v3 subgraph s1["https://query.wikidata.org/sparql"] style s1 stroke-width:4px; v2 --"p:direct/P625"--> v4 end subgraph s2["http://wikiba.se/ontology#around"] style s2 stroke-width:4px; v5 --"p:direct/P1259"--> v6 c5 --"wikibase:center"--> v4 c5 --"wikibase:radius"--> v3 end v5 --"p:P170"--> v7 v7 --"p:qualifier/P2699"--> v8 v7 --"p:qualifier/P2093"--> v9 bind3[/"count(?creatorUrl)"/] v8 --o bind3 bind3 --as--o v10