ljos / sparql-mode

A SPARQL mode for emacs
GNU General Public License v3.0
60 stars 23 forks source link

enable querying of an RDF file #75

Open VladimirAlexiev opened 5 months ago

VladimirAlexiev commented 5 months ago

sparql-mode queries SPARQL endpoints that is specified with variables like this;

(setq
 sparql-default-base-url "..." ;; org-babel-execute:sparql gets endpoint from param :url
 sparql-prompt-base-url t ; this really means endpoint
 sparql-default-format "text/csv" ;; org-babel-execute:sparql gets from param :format
)
(put 'sparql-base-url 'safe-local-variable 'stringp)

However, it's also interesting to query an RDF file. Eg during development of an ontology, you can extract the class hierarchy this way. Two tools that allow this:

VladimirAlexiev commented 5 months ago

We could use advice but it's better to fork sparql-mode and add this and other additions (eg sparql vs update vs tarql derived modes, syntax checking with flycheck, etc. A crucial question is how to pass org-babel parameters to the query tool (see params :url and :format in the first code block).

johanwk commented 5 months ago

I'm not sure whether I understand completely. With the variant org-babel-execute:sparql in ELOT, :url is reused for a filename (in the sense of, if it doesn't look like a url, assume it's a filename). Maybe this should be required to be a file:/// url? It appears to me to make sense that we don't need another header parameter, but can reuse :url.

Regarding :format, there's a use of this in the ELOT elot-robot-execute-query to request either csv or ttl from ROBOT. Should that be done differently?

VladimirAlexiev commented 4 months ago

Hi @johanwk !

So I think you should use a new keyword eg :data (which is a file in a triple or quad format, i.e. can populate multiple graphs). In the future we may think of exploiting the namedGraph options of arq or robot.

Please reopen https://github.com/johanwk/elot/issues/27

johanwk commented 4 months ago

I can only say I agree with all of your points here. I chose shortcuts in order to progress ELOT. sparql-mode should do much better, I just don't want to wait for it.

Will reopen :)