Skip to content

JavaScript implementation of the SPARQL Template Transformation Language (STTL)

License

Notifications You must be signed in to change notification settings

vcharpenay/STTL.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

JavaScript implementation of the SPARQL Template Transformation Language (STTL)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published