Open jmmcd opened 1 year ago
Hi James,
I could implement a preliminary check on whether the file exists that returns a FileNotFoundError.
The JavaException however comes from SPARQL Anything and is simply thrown onto the terminal by PySPARQL.
@enridaga Thoughts? Should I go ahead and implement what I suggested above?
Actually, the error is not a file not found but a syntax error on the string interpreted as a query. The value for -q
is either a file or, if a file does not exist, a valid SPARQL query. In practice, what happens is that the file is not found, therefore the system attempts to execute the string as a query itself, and fails (see the last line Lexical error at line 1, column 14. Encountered: <EOF>
). Maybe, a better way would be to catch the error on the SA code and throw a better message (nor file or valid query string provided...).
Thank you, it makes sense.
Off-topic - I have PySA running in my code base now instead of running SA.jar from the command-line. It looks like it is going to cut my runtime from about 5 hours to 3 minutes. So I think you have saved a lot of CO2 emissions with this package!
Version:
sparql-anything-v0.8.2.jar
This issue is not an important one. It could be a small cosmetic improvement.
When I tried to
sa.run()
a query as below, it failed because I mistyped the filename, with the error as below. I think the error message could be more informative, egFileNotFoundError
.