我必须运行以下查询
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
"""
如果我在此处https://sparql.geo.admin.ch/sparql运行该查询,则可行,但如果我尝试在Python
中运行该问题:
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("https://sparql.geo.admin.ch/sparql")
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
我收到以下错误
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>