Skip to content
/ grlc Public
forked from CLARIAH/grlc

Builds Web APIs using SPARQL queries stored in git repositories

Notifications You must be signed in to change notification settings

jetschni/grlc

 
 

Repository files navigation

grlc, the git repository linked data API constructor, automatically builds Web APIs using SPARQL queries stored in git repositories.

Author: Albert Meroño
Copyright: Albert Meroño, VU University Amsterdam
License: MIT License (see license.txt)

Install and run

git clone --recursive https://github.com/CLARIAH/grlc
cd grlc
virtualenv .
source bin/activate
pip install -r requirements.txt
python grlc.py

Direct your browser to http://localhost:8088.

Alternatively, you can use the provided Gunicorn configuration to run it as a daemon on your server.

Usage

grlc assumes a GitHub repository (support for general git repos is on the way) where you store your SPARQL queries as .rq files (like in this one). grlc will create an API operation per such a SPARQL query/.rq file.

If you're seeing this, your grlc instance is up and running, and ready to build APIs. Assuming you got it running at http://localhost:8088/ and your queries are at https://github.com/CEDAR-project/Queries, just point your browser to the following locations:

By default grlc will direct your queries to the DBPedia SPARQL endpoint. To change this either:

  • Add a endpoint: decorator in the first comment block of the query text (preferred, see below)
  • Add the URL of the endpoint on a single line in an endpoint.txt file within the GitHub repository that contains the queries.
  • Or you can directly modify the grlc source code (but it's nicer if the queries are self-contained)

That's it!

Decorator syntax

A couple of SPARQL comment embedded decorators are available to make your swagger-ui look nicer (note all comments start with #+ ):

  • To specify a query-specific endpoint, #+ endpoint: http://example.com/sparql.
  • To create a summary of your query/operation, #+ summary: This is the summary of my query/operation
  • To assign tags to your query/operation,
    #+ tags:
    #+   - firstTag
    #+   - secondTag

See examples at https://github.com/CEDAR-project/Queries.

Request parameter mappings into SPARQL

grlc is compliant with BASIL's convention on how to map GET/POST request parameters into SPARQL.

About

Builds Web APIs using SPARQL queries stored in git repositories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 61.2%
  • HTML 38.8%