ColinMaudry / sparql-router

Application to turn SPARQL queries into APIs and use them in a simple Web app (Express + Vue)
http://queery.link
MIT License
9 stars 4 forks source link

SPARQL router 0.4.0

The NodeJS/Express application that powers queery.link to serve canned SPARQL queries to the world.

master (demo) develop (demo)
Build Status Coverage Status Build Status Coverage Status

Description

SPARQL is the query language to retrieve data from RDF triple stores. I often had the issue that fellow developers or data fanatics asked for data that was in a triple store, but they don't know SPARQL.

This server application solves the issue:

  1. You write the query and gives it a name (e.g. biggest-asian-cities)
  2. You save it under /tables, /graphs or /update, depending on the query type (SELECT, CONSTRUCT, DESCRIBE, SPARQL Update)
  3. You give the URL to your fellow developer, picking the right format for their usage:
    • http:/yourhost/api/tables/biggest-asian-cities.csv for manipulations as a spreadsheet
    • http:/yourhost/api/tables/biggest-asian-cities.json as input for a Web app
    • http:/yourhost/api/tables/biggest-asian-cities.xml if they are into XML
  4. They get fresh updated results from the store every time they hit the URL!

Create a query

Get query results

Features

A screenshot of the tests as overview of the features.

Configuration and detailed usage documentation

Upcoming features

Known issues

Demo

Requirements

Installation

git clone https://github.com/ColinMaudry/sparql-router.git --depth=1
cd sparql-router
npm install --production

SPARQL router is also available as an NPM package.

Configuration

On the wiki.

Once it's configured, you must initialize the system queries and test queries:

npm run initialize

Test

I haven't found a proper way to mock a triple store for testing purposes. I consequently use a remote triple store. That means the tests only work if the machine has Internet access.

The configuration used for the tests is stored in config/test.json.

First, make sure, you have all the dev dependencies installed:

npm install

Tests rely on mocha and supertest for the API, and on nightwatch for the frontend.

API

To run the API tests:

npm test

Overview of the API tests.

Frontend

To run the frontend tests:

# Make sure the dev dependencies are installed
npm install

# Start the server in development mode with the test configuration
NODE_ENV=test npm run dev

# Run the frontend tests
npm run test-ui

Start it

Using config/default.json configuration file:

npm start

Using config/myconfig.json configuration file:

NODE_ENV=myconfig npm start

Start in debug mode:

DEBUG=functions,routes npm start

Resilient deployment

If you want the app to restart automatically after fatal errors, I suggest you use forever.

When forever is installed globally, run the following command in the sparql-router folder:

forever bin/www

Use it

See this wiki page for detailed instructions: Using SPARQL router

The API documentation can be found here (development version). If you're running the app, at /api.

Actions that require authentication

The actions that are not read-only on the canned queries or the data require basic authentication.

Similar software

If SPARQL router doesn't match your requirements, you can have a look at these solutions:

Contact

Change log

0.4.0

0.3.0

0.2.2
0.2.1

0.2.0

0.1.0

License

MIT license

If you use it, I'd really appreciate a public statements such as a tweet!