Home

Awesome

STTL

The SPARQL Template Transformation Language (STTL) is a specification to turn RDF graphs into character strings, e.g. for HTML rendering or syntax convertion.

Quickstart

const sttl = require('sttl');

// configuration
sttl.connect('a SPARQL endpoint URL');
sttl.register(
  'template { ?in " " ?p " " ?o " ." }' +
  'where { ?in ?p ?o . filter (isURI(?in) && isURI(?o)) }'
);

// Promise-based API
sttl.applyTemplates().then(ntriples => console.log(ntriples));

Instead of a remote SPARQL endpoint, a callback function returning results as SPARQL JSON can be given as argument of sttl.connect(). See /examples for a CLI and example templates.

Build

$ npm install
$ npm run-script build
$ npm test

To use in the browser:

$ npm run-script build-browser