PREFIX schema: PREFIX property: PREFIX xsd: SELECT DISTINCT ?station ?long ?lat (avg(?no2) as ?avgno2) WHERE { ?obs schema:NO2 ?no2 . ?obs schema:station ?station . ?station property:longitudeDegree ?long . ?station property:latitudeDegree ?lat . ?station property:type "Background"^^xsd:string . ?obs schema:year ?year . ?year property:yearNum "2011"^^xsd:integer . { ?station schema:inCity ?city . ?city schema:locatedIn ?country . } UNION { ?station schema:inCountry ?country . } ?country property:isoCode ?isocode . ?obs schema:sensor ?sensor . ?sensor property:statisticShortName "Mean"^^xsd:string . 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 ) ) }