jquery-shiftenter

Wanting to quickly post a HTML form made of a textarea I found nothing on the web that would quickly allow me to press Enter to submit the contents. Similar to how Facebook got rid of their comment button (simply press enter when finished commenting) I want to use the Return key to submit the form while retaining the possibility to create line breaks by hitting Shift+Enter.

I thus came up with jquery-shiftenter, a simple jQuery plug-in to turn your textareas into an input accepting Enter to submit and showing a textual hint on how to generate newlines.

You can find an example here. The code is on github. Enjoy.

Deniz, a simple Javascript-based RDF browser

I’d like to announce a little project started recently called “Deniz”, a browser to view your RDF data.

 

While developing our software Trip based on an RDF “triple” store we need to look at our data on a daily basis. Most often this is just for debugging purposes and bad enough we are limited to what the triple stores offer. In case of Franz AllegroGraph the store already ships with an AJAX-based browser, but for example Virtuoso only supports a simple SPARQL interface.

 

Goals

 

The goal of Deniz is to implement a simple and lightweight browsing application to query RDF stores using SPARQL. More specific it builds on top of stores implementing the SPARQL protocol defined by the W3C which makes the application dead simple. A SPARQL query string sent to such a server will return a JSON structure of results that can easily be turned into a human-readable table.

 

Inspired by AllegroGraph’s browser it will probably inherit many ideas, but so far I want to keep the following points in mind when improving Deniz:

 

  • Easy to use
    • Deniz is not designed to become a phpMyAdmin for RDF nor anyway near.
  • Transparent SPARQL usage
    • You can quickly learn SPARQL by looking at the SPARQL code the different views use. The expert in turn will quickly see what the views offer and what not.
  • Practical usage
  • We use RDF to solve problems. Deniz should help us rather then offer a complete set of operations on the triple store.

 

SPARUL (SPARQL/Update) might go into the interface in the future but I can’t say for sure.

 

CORS

 

One technique needed to access an RDF store via AJAX is CORS (“Cross-Origin Resource Sharing”). CORS offers a standardised solution around the same domain limitation forced upon Javascript connections out of security concerns. In particular the browser will disallow any request made to servers from a domain different to where the originating query’s page is served from. Via CORS a server can explicitly allow cross-domain requests and we will use that here.

 

In theory this means that Deniz will completely work without the need of any server-side deployments. You only need a SPARQL endpoint that does support CORS. This is the case for example for dbpedia.org. Deniz already queries DBpedia by default. If you don’t have such support for the store you want to query, read below for a simple solution.

 

Implementation

 

Deniz is implemented in Javascript, HTML & CSS – so far my first project with this setting. You can run it from your local hard drive or deploy it on a standard non-CGI/PHP web server. It uses jQuery, jQuery UI (both pretty basic) and CodeMirror as syntax highlighter (can you believe it ships with a SPARQL highlighter by default?). A nice addition is the jQuery history plug-in which offers back & forward browsing as if Deniz was a fullblown web application.

 

Currently the monolithic deniz.html could do with some refactoring. This will probably come once my initial feature set is implemented. For example one point missing on my list is easy GRAPH support.

 

SPARQL protocol proxy

 

If you either don’t have a SPARQL protocol compatible store or need the CORS support described above then the SPARQL protocol proxy might work for you. It was explicitly started to offer the missing layer to Deniz and is implemented as a small HTTP-server written in pure Python. It is far from supporting anything near 100% of the SPARQL protocol and until now has only been tested with Virtuoso, but it might suite your needs.

 

Demo & License

 

You can find the demo here . By default dbpedia.org is selected as endpoint, but you can change it to your own triple store (see above though for CORS support).

 

Deniz is released under a new BSD license, so you are pretty free to do what ever you like with it.

 

And before I forget, “deniz” is Turkish for “sea”. Now you also improved your language skills while reading about the semantic web, isn’t that nice?

 

Update: Virtuoso has been release some days ago with CORS support. I am still looking into how to enable it, and eventually I’ll find out how.

Update2: See http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuide… on how to configure Virtuoso.