Skip to content
JavaScript implementation of the SPARQL Template Transformation Language (STTL)
Yacc JavaScript Smarty
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
LICENSE
README.md
package-lock.json
package.json

README.md

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 tests for an example.

Build

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

To use in the browser:

$ npm run-script build-browser
You can’t perform that action at this time.