SPARQL: unable to use FactForge endpoint

情到浓时终转凉″ 提交于 2019-12-24 02:22:58

问题


I am using python to run some sparql queries. I want to extract information from http://factforge.net/sparql

sparql = SPARQLWrapper("http://factforge.net/sparql")
query = """
# F02: Big Cities in Eastern Europe

PREFIX onto: <http://www.ontotext.com/>
PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT * FROM onto:disable-sameAs
WHERE {
    SERVICE <http://factforge.net/sparql>{
    ?loc gn:parentFeature dbr:Eastern_Europe ; 
         gn:featureClass  gn:P;
         gn:featureCode gn:A.ADM2.
    ?loc dbo:populationTotal ?population ; dbo:country ?country .
    ?country a dbo:Country .
    }
    FILTER(?population > 300000 )
    ?country skos:prefLabel ?country_name . 

} ORDER BY ?country_name DESC(?population)

"""
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()

This query works on the factforge website but locally I receive the following error EndPointNotFound: it was impossible to connect with the endpoint in that address, check if it is correct.


回答1:


GraphDB exposes RDF4J-style API. This is exactly what is said on the Help page.

The SPARQL endpoint address should be http://factforge.net/repositories/{repositoryID}.

Unfortunately, it is impossible to determine which repository is used from SPARQL in GraphDB.

You could use F12 Developer Tools in your browser for this purpose. Or the About page says:

Applications can access FactForge via SPARQL at http://factforge.net/repositories/ff-news.
This is also the service address to be used for federated SPARQL queries.



来源:https://stackoverflow.com/questions/47454145/sparql-unable-to-use-factforge-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!