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

flycheck validation (SPARQL) #29

Open
VladimirAlexiev opened this issue Mar 28, 2024 · 1 comment
Open

flycheck validation (SPARQL) #29

VladimirAlexiev opened this issue Mar 28, 2024 · 1 comment

Comments

@VladimirAlexiev
Copy link
Collaborator

I use these to associate various extensions to SPARQL mode:

(add-to-list 'auto-mode-alist '("\\.sparql$" . sparql-mode)) ; SPARQL
(add-to-list 'auto-mode-alist '("\\.tarql$"  . sparql-mode)) ; SPARQL in Tabular files
(add-to-list 'auto-mode-alist '("\\.rq$"     . sparql-mode)) ; SPARQL Query standard extension
(add-to-list 'auto-mode-alist '("\\.ru$"     . sparql-mode)) ; SPARQL Update standard extension

SPARQL validation with flycheck using jena qparse from ljos/sparql-mode#29:

(require 'flycheck)

(flycheck-define-checker sparql-syntax
  "A SPARQL syntax checker using ARQ qparse. See URL https://jena.apache.org/documentation/query/cmds.html."
  :command ("qparse.bat" "--query" source)
  :error-patterns
  ((error line-start "Encountered \"" (message) "\" at line " line ", column " column "." line-end)
   (error line-start "Lexical error at line " line ", column " column "." (+ space) "Encountered: " (message) line-end))
  :modes sparql-mode)
(add-to-list 'flycheck-checkers 'sparql-syntax)
(add-hook 'sparql-mode-hook 'flycheck-mode)

ljos/sparql-mode#70 asks for similar modes sparql-update-mode and tarql-mode but haven't been implemented yet. The validation sort of works for such files, but not quite.

@johanwk
Copy link
Owner

johanwk commented Mar 28, 2024

This is great stuff. We definitely need to include it!

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

2 participants