SPARQLWRapper provides us a user-friendly interface for issuing SPARQL queries, for example, you can execute a SPARQL query simply with the following two lines of code.
sparql.setQuery(query)
results = sparql.query().convert()
However, one thing I notice is that, sometimes the query might crash the sparql endpoint, however, sparql.query().convert()
does not raise any exception, it just returns an empty set as answer. And for the next query, because the sparql endpoint was crashed by the previous query, it will report connection refused. This reported error does not really help us to know what the real problem is; what we do want to know is what is happening when the server is crashed. I expect sparql.query().convert()
to raise some exception if the sparql endpoint is crashed during processing it, but unfortunately, it does not. So is there any way for me to catch such exception when using SPARQLWrapper?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…