Add layer for Semantic Web formats

- Syntax highlighting for N3, Turtle and SPARQL formats
- Company mode for SPARQL
- Execution of SPARQL queries against SPARQL HTTP endpoint
This commit is contained in:
Andreas Textor 2016-10-26 15:51:52 +02:00 committed by Eivind Fonn
parent 735321eda3
commit f7210c30c2
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#+TITLE: Semantic Web layer
[[file:img/semweb.png]]
* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#install][Install]]
- [[#key-bindings][Key bindings]]
* Description
This layer adds support for RDF files in N3 and [[https://www.w3.org/TR/turtle/][Turtle syntax]] using [[https://bitbucket.org/nxg/ttl-mode][ttl-mode]]
and for [[https://www.w3.org/TR/sparql11-query/][SPARQL]] queries using [[https://github.com/ljos/sparql-mode][sparql-mode]].
SPARQL-mode supports the execution of queries. When first called, you will be
prompted for a SPARQL HTTP endpoint in the minibuffer, which defaults to
http://localhost:2020/. Once set, it will be used for all subsequent queries in
that buffer. Results will be displayed in another buffer in CSV format.
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =semweb= to the existing =dotspacemacs-configuration-layers= list in this
file.
* Key bindings
| Key Binding | Description |
|-------------+-----------------------|
| ~SPC m q~ | Execute SPARQL query |

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,33 @@
;;; packages.el --- semweb layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Andreas Textor <mail@atextor.de>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq semweb-packages
'(
company
ttl-mode
sparql-mode
))
(defun semweb/init-ttl-mode ()
(use-package ttl-mode
:mode ("\\.\\(ttl\\|n3\\)\\'" . ttl-mode)))
(defun semweb/post-init-company ()
(add-hook 'sparql-mode-hook 'company-mode))
(defun semweb/init-sparql-mode ()
(use-package sparql-mode
:mode ("\\.\\(sparql\\|rq\\)\\'" . sparql-mode)
:init (spacemacs/set-leader-keys-for-major-mode 'sparql-mode "q" 'sparql-query-region)))
(defun semweb/pre-init-org ()
(spacemacs|use-package-add-hook org
:post-config (add-to-list 'org-babel-load-languages '(sparql . t))))