Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparql-update-mode, tarql-mode; syntax checking with flycheck #70

Open
VladimirAlexiev opened this issue Mar 15, 2022 · 0 comments
Open

Comments

@VladimirAlexiev
Copy link
Collaborator

VladimirAlexiev commented Mar 15, 2022

@ljos thanks for your very excellent mode!
I also use it for writing SPARQL UPDATEs and TARQL tabular conversions.

Could you make 2 more derived modes: sparql-update-mode (ext *.ru), tarql-mode (ext *.tarql)?

So the only thing that I'm missing is syntax checking.

  • SPARQL syntax error checking #29 explores advanced topics like LSP but hasn't been implemented in 7 years.
  • @bjonnh has showed a very simple implementation as a flycheck checker.
  • The same checker can be used for sparql-update-mode, tarql-mode: the only thing that needs to be changed is the executable name, and add a few more regexes. On Windows the executables are *.bat (as shown below), on linux are *, on Cygwin are either:
    • sparql-mode: ("qparse.bat" "--query" source)
    • sparql-update-mode: ("update.bat" "--update" source)
    • tarql-mode: ("tarql.bat" source)

Output examples:

qparse --query foo.rq
Encountered " <DELETE_WHERE> "delete where "" at line 5, column 1.
qparse --query bar.rq
Lexical error at line 2, column 11.  Encountered: " " (32), after : "z"
qparse --query baz.rq
Line 2, column 17: Unresolved prefixed name: ...

update --update foo.ru
org.apache.jena.query.QueryParseException: Variable used when already in-scope: ?upd in ((AGG ?.0 MAX(?new)) AS ?upd)
update --update bar.ru
org.apache.jena.query.QueryParseException: Encountered " "." ". "" at line 6, column 67.

tarql foo.tarql
Error parsing SPARQL query: Encountered " <DELETE_WHERE> "delete where "" at line 5, column 1.
tarql bar.tarql
Error parsing SPARQL query: Lexical error at line 1, column 1.  Encountered: "\u0016" (22), after : ""
tarql baz.tarql
Error parsing SPARQL query: Line 2, column 17: Unresolved prefixed name: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant