Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

sparql - Is there a way to get the error code in SPARQLWrapper?

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...