N3 Editor in JavaScript

We thought it would be neat if we could have a fully-fledged N3 editor in
the browser, complete with lint support (i.e., error flagging) and syntax
highlighting. Also, we thought it would be even better that this N3 editor
could somehow show the deductive closure of any N3 expression.

 

So, we created the Notation3 JS Editor
(https://github.com/william-vw/n3-editor-js)

You can find a demo here: http://ppr.cs.dal.ca:3002/n3/editor/

 

You can pass URL parameters to show (and execute) examples, for instance, 

http://ppr.cs.dal.ca:3002/n3/editor/?formula=:jos%20:knows%20:will%20.%20{%2
0?a%20:knows%20:will%20.%20}%20=%3E%20{%20?a%20:is%20:cool%20.%20}%20.
<http://ppr.cs.dal.ca:3002/n3/editor/?formula=:jos%20:knows%20:will%20.%20%7
b%20?a%20:knows%20:will%20.%20%7d%20=%3E%20%7b%20?a%20:is%20:cool%20.%20%7d%
20.&exec=eye> &exec=eye 

 

It's very much a work in progress and any feedback / bug reports / feature
requests / .. are certainly welcome.

 

<long-story>ANTLR allows compiling N3 parsers in JavaScript, which is really
neat and I wanted to do something with that for ages. Using the ANTLR JS
parser for flagging errors, we use CodeMirror for the visual linting and
syntax highlighting. The "n3-mode" does the syntax highlighting -
thankfully, CodeMirror already had a "turtle-mode" that was slightly
extended with N3 keywords (still a work in progress). For calculating the
deductive closure, the editor calls a Node JS server (e.g., deployed at
http://ppr.cs.dal.ca:3002/n3) that executes either an Eye or Cwm command,
depending on what you selected. 

 

Hopefully, this can be eventually turned into a JSON-LD like playground
<https://json-ld.org/playground/>  or even a Fiddle-like environment
<https://jsfiddle.net/>  that allows sharing examples more easily!

</long-story>

 

 

Kind regards,

 

William

Received on Wednesday, 10 June 2020 18:58:20 UTC