Skip to content

Latest commit

 

History

History
137 lines (90 loc) · 4.78 KB

README.md

File metadata and controls

137 lines (90 loc) · 4.78 KB

JAvascript Suite for Sparql Access (Jassa) Core

NPM version Code Climate Dependency Status

  • Master branch:
    Build Status Coverage Status

  • Develop branch:
    Build Status Coverage Status Develop

This library is a swiss army knife for dealing with SPARQL queries and result sets from JavaScript. It is comprised of a set of layered modules, ranging from a (low-level) RDF API over a service abstraction layer, a SPARQL-JSON mapping layer up to a faceted browsing layer. Jassa lets you focus on application development rather than getting tangled up in SPARQL details. Note, that Jassa-Core can be used in both server- and client-side scenarios.

Demos

A good point to get started with Jassa is to have a look at the demos and see what can be achieved and how. The demos make use of widgets from the related jassa-ui-angular project.

Data Browsers

Faceted Search

  • Coming soon

Applications

Components and Usage

The jassa object defines the following modules, of which each has its own documentation page.

  • rdf Core RDF classes closely following the Jena API
  • vocab Essential vocabulary definitions
  • sparql Classes for the syntactic representation of SPARQL queries
  • sponate SPARQL-to-JSON mapping module
  • facete A powerful faceted search API

An overview of the modules is shown below:

Jassa Module Overview

Community

The github issue tracker is the preferred place to discuss issues with the this project, however, you can also discuss project-related things on the jassa mailing lists on source forge:

How to obtain

How to build/test

  1. Make sure you have latest node.js installed
  2. Install gulp with npm -g install gulp
  3. Clone this repo
  4. cd into repo folder and run npm install

Now you can run gulp to see if the tests complete as well as results for code covarage.

Browser-based Set Up

TODO: add explanation here

Run gulp browserify. Then this minimal example using JQuery and Bluebird works:

<html>
<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.min.js"></script>

    <!--<script src="dist/jassa.min.js"></script>-->
    <script src="dist/jassa.js"></script>

    <script type="text/javascript">
            // Init jassa with native promise and jquery.ajax
            var jassa = new Jassa(Promise, $.ajax);

            // The jassa object is now readily available
            // We hope that the name Jassa is sufficiently exotic to never cause a name clash
            // But who knows. I wished JavaScript had native namespace support...
            console.log("The Jassa object: ", jassa);
        </script>
    </head>
</html>

NodeJs-based Set Up

Example of a nodejs based set up:

// require libraries
var Promise = require('bluebird');
var request = Promise.promisifyAll(require('request'));

// create ajax function for sending requests
var ajax = function(param) {
    return request.postAsync(param.url, {
        json: true,
        form: param.data,
    }).then(function(res) {
        return new Promise(function(resolve) {
            resolve(res[0].body);
        });
    });
};

// init jassa with loaded Promise and ajax request function
var jassa = require('jassa')(Promise, ajax);