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

Integrates identitas into Tawny-OWL #71

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions emacs/tawny-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
(require 'nrepl-client)
(require 'clojure-mode)
(require 'easymenu)
(require 'cl)

;;; Code:

Expand Down Expand Up @@ -82,6 +83,32 @@ elk or jfact."
(cider-current-ns)
)))

(defun tawny-mode-identitas ()
"Prints random prolong (lexical pronounceable string) ID generated
by the Identitaslibrary."
(interactive)
(tawny-mode-check-for-nrepl-buffer)
(cider-nrepl-request:eval
(format
"(do (require 'tawny.emacs)(tawny.emacs/identitas \"%s\"))"
(cider-current-ns))
(tawny-mode-make-into-buffer-response-handler (point-marker))))

(defun tawny-mode-make-into-buffer-response-handler(marker)
"Return a messaging response handler into the current BUFFER."
(lexical-let
((m marker))
(nrepl-make-response-handler
(marker-buffer marker)
(lambda (buffer value)
(save-excursion
(set-buffer (marker-buffer m))
(goto-char m)
(insert (substring value 1 -1))))
(lambda (buffer value))
(lambda (buffer value))
(lambda (buffer)))))

(defun tawny-mode-unsatisfiable ()
"Prints a message describing unsatisfiability of current ontology."
(interactive)
Expand Down
5 changes: 4 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
;; Shut up ELK
[log4j/log4j "1.2.17"]
;; Shut up OWL API
[org.slf4j/slf4j-nop "1.7.10"]]
[org.slf4j/slf4j-nop "1.7.10"]

;; identitas
[uk.org.russet/identitas-j "0.0.1"]]

;; multiple profiles for testing against different OWL versions. The :base
;; dependency adds dev-resources to the path which I need for testing.
Expand Down
6 changes: 6 additions & 0 deletions src/tawny/emacs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ NAMESPACE"
"Ontology is consistent."
"Ontology is not consistent."))))

(defn identitas
"Return a random prolong ID from the identitas library."
[id]
(let [id (uk.org.russet.identitas.Util/randomProlong)]
id))

(defn list-classes
"Given a set of classes, returns a string representation."
[classes]
Expand Down