query-729e98aeb4bcc7e174c35cb2d718b3ef

rq turtle/ttl

Using wikibase:around and also return the aggregate count of statements for each returned itemHello, I am trying this query to return items in geographic radius and also count the number of statements for each return item. But I cant get it to work. How do you do this?

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?place ?location ?distance ?whatLabel ?placeLabel (COUNT (?statement) as ?statements) WHERE {
    SERVICE wikibase:around { 
      ?place wdt:P625 ?location.
      bd:serviceParam wikibase:center "Point(19.242296 57.955333)"^^geo:wktLiteral . 
      bd:serviceParam wikibase:radius "50" . 
      bd:serviceParam wikibase:distance ?distance .
    } 
    OPTIONAL {?place wdt:P31 ?what. }
    ?place ?p ?statement.

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

Query found at