PREFIX schema: PREFIX property: PREFIX xsd: SELECT ?station ?long ?lat (avg(?pm25) as ?avgpm25) WHERE { ?obs schema:PM2.5 ?pm25 . ?obs schema:station ?station . ?station property:longitudeDegree ?long . ?station property:latitudeDegree ?lat . ?station property:type "Traffic"^^xsd:string . ?obs schema:year ?year . ?year property:yearNum "2010"^^xsd:integer . { ?station schema:inCity ?city . ?city schema:locatedIn ?country . } UNION { ?station schema:inCountry ?country . } ?obs schema:sensor ?sensor . ?sensor property:statisticShortName "Mean"^^xsd:string . ?country property:isoCode ?isocode . FILTER( ?isocode IN ("AT"^^xsd:string, "BE"^^xsd:string, "BG"^^xsd:string, "CH"^^xsd:string, "CY"^^xsd:string, "CZ"^^xsd:string, "DE"^^xsd:string, "DK"^^xsd:string, "EE"^^xsd:string, "ES"^^xsd:string, "FI"^^xsd:string, "FR"^^xsd:string, "GB"^^xsd:string, "GR"^^xsd:string, "HU"^^xsd:string, "IE"^^xsd:string, "IS"^^xsd:string, "IT"^^xsd:string, "LI"^^xsd:string, "LT"^^xsd:string, "LU"^^xsd:string, "LV"^^xsd:string, "MT"^^xsd:string, "NL"^^xsd:string, "NO"^^xsd:string, "PL"^^xsd:string, "PT"^^xsd:string, "RO"^^xsd:string, "SK"^^xsd:string, "SI"^^xsd:string, "SE"^^xsd:string, "TR"^^xsd:string) ) } GROUP BY ?station ?long ?lat