Skip to content

Uninformative error message when query not found #9

Open
@jmmcd

Description

@jmmcd

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, eg FileNotFoundError.

In [4]: sa.run(q='query1.sparql')
[main] INFO com.github.sparqlanything.cli.SPARQLAnything - SPARQL anything
---------------------------------------------------------------------------
JavaException                             Traceback (most recent call last)
Cell In[4], line 1
----> 1 sa.run(q='query1.sparql')

File ~\miniconda3\Lib\site-packages\pysparql_anything\sparql_anything.py:30, in SparqlAnything.run(self, **kwargs)
     23 """
     24 The run method replaces the regular command line execution.
     25 @param **kwargs The keyword arguments are the same as the regular
     26     flags for the Sparql Anything CLI, minus the hyphen.
     27 See the User Guide for an example.
     28 """
     29 command = cmd.RunCommand(kwargs, self.receiver)
---> 30 command.execute()

File ~\miniconda3\Lib\site-packages\pysparql_anything\command.py:159, in RunCommand.execute(self)
    157 """ instructions for a run request """
    158 args = super()._combine()
--> 159 self.receiver.main(args)

File ~\miniconda3\Lib\site-packages\pysparql_anything\engine.py:39, in Engine.main(self, args)
     37 def main(self, args):
     38     """ Wrapper for the SPARQL Anything main method. """
---> 39     self.reflection.main(args)

File jnius\\jnius_export_class.pxi:876, in jnius.JavaMethod.__call__()

File jnius\\jnius_export_class.pxi:1059, in jnius.JavaMethod.call_staticmethod()

File jnius\\jnius_utils.pxi:79, in jnius.check_exception()

JavaException: JVM exception occurred: Lexical error at line 1, column 14.  Encountered: <EOF> after prefix "query1.sparql" org.apache.jena.query.QueryParseException

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions