sparql-mode
sparql-mode copied to clipboard
pass prefixes to org-babel-sparql--current-curies
@johanwk @ljos
ob-sparql.el: org-babel-execute:sparql
sets a variable org-babel-sparql--current-curies
:
(org-babel-sparql--current-curies (append org-link-abbrev-alist-local org-link-abbrev-alist))
That variable is then used in org-babel-sparql-convert-to-table
to shorten URLs returned in query results. org-link-abbrev-alist-local
is defined as
Buffer-local version of ‘org-link-abbrev-alist’, which see. The value of this is taken from the LINK keywords.
But in the case of SPARQL there's a more obvious list of CURIEs: the prefixes declared in the query.
So it would be better to extract these prefixes and pass them to org-babel-sparql--current-curies
.
They can be extracted as \1, \2
by iterating a regex like this:
prefix:\s*(\w+):\s*<([^ >]+)>
This will work nicely in conjunction with https://github.com/ljos/sparql-mode/issues/74