0

I'm trying to make a query to get the predicate or the relation between 2 entities already exist in Arabic DBpedia... I'm trying to do that in Python using the SPARQL Endpoint interface to Python (SPARQLWrapper), so I set the Data Set Name, with the query like that:

sparql = SPARQLWrapper("http://ar.dbpedia.org/sparql")
sparql.setReturnFormat(JSON)
property = []
query = "SELECT ?property WHERE {{ <{}> ?property <{}> }}".format('http://ar.dbpedia.org/resource/فرنسا', 'http://ar.dbpedia.org/resource/باريس')

sparql.setQuery(query) 
string_s = sparql.query().convert()

if len(string_s['results']['bindings']) != 0:
    bindings = string_s['results']['bindings']
    for b in bindings:
         property.append(b['property']['value'])
     print(property)

The problem is when I specified the Data set name as (http://ar.dbpedia.org/sparql), it gave me an error in connection like that:

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

And when I change it to the Default one (http://dbpedia.org/sparql), it gives me no relation between the 2 entities (and I guess this is because I am making a request on the data set that's not having the two entities!), I test the previous code on English resources by changing the data set name to the default one, and changing the query to this:

query = "SELECT ?property WHERE {{ <{}> ?property <{}> }}".format('http://dbpedia.org/resource/France', 'http://dbpedia.org/resource/Paris')

it worked and gave me the (?property) like this:

['http://dbpedia.org/ontology/wikiPageWikiLink', 'http://dbpedia.org/ontology/capital']

So my question is, How could I do the same request and get the same answer on the Arabic DBpedia? How can I inquire about the property that links between the 2 Arabic resources (Arabic entities) that already exist in Arabic DBpedia?

Islam Kh
  • 55
  • 6
  • did you ever thought of ar.dbpedia.org/sparql being offline? You can always load Arabic Dbpedia into your own triple store if the public service is not available anymore. that's all you can do besides pinging the maintainer of Arabic DBpedia – UninformedUser Mar 17 '20 at 14:13
  • @UninformedUser Thank you! The query worked right when I made the SPARQL query on the downloaded Arabic DBpedia using the RDFLib Python library – Islam Kh Mar 18 '20 at 11:38

0 Answers0