0

I have to run the following query

query = """
PREFIX schema: <http://schema.org/>
PREFIX gn: <http://www.geonames.org/ontology#>
select ?Municipality ?Name ?Population
where
{
?Municipality a gn:A.ADM3 .
?Municipality schema:name ?Name .
?Municipality gn:population ?Population .
?Municipality <http://purl.org/dc/terms/issued> ?Date .
FILTER (?Date = "2016-01-01"^^xsd:date)
}
ORDER BY DESC(?Population)
LIMIT 5
"""

If I run that query here https://sparql.geo.admin.ch/sparql it works, but if I try to run it in Python:

from SPARQLWrapper import SPARQLWrapper, JSON 
sparql = SPARQLWrapper("https://sparql.geo.admin.ch/sparql")  
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()

I get the following error

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
emax
  • 6,965
  • 19
  • 74
  • 141
  • I used Google with "Python" and "CERTIFICATE_VERIFY_FAILED" -> first link was https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error – UninformedUser Nov 13 '17 at 14:27
  • Regarding SPARQLWrapper I found https://github.com/RDFLib/sparqlwrapper/issues/56 – UninformedUser Nov 13 '17 at 14:28

0 Answers0