
grlc, the git repository linked data API constructor, automatically builds Web APIs using SPARQL queries stored in git repositories. http://grlc.io/
A cool project that can convert a random SPARQL endpoint into an OpenAPI endpoint
It enables us to quickly integrate any new API requirements in a matter of seconds, without having to worry about configuration or deployment of the system
You can store your SPARQL queries on GitHub and then you can run your queries on your favourite programming language (Python, Javascript, etc.) using a Web API (including swagger documentation) just as easily as loading data from a web page
Contributors: Albert Meroño, Rinke Hoekstra, Carlos Martínez
Copyright: Albert Meroño, VU University Amsterdam
License: MIT License (see LICENSE.txt)
grlc is a lightweight server that takes SPARQL queries curated in GitHub repositories, and translates them to Linked Data Web APIs. This enables universal access to Linked Data. Users are not required to know SPARQL to query their data, but instead can access a web API.
For a quick usage tutorial check out our wiki walkthrough here
pagination decorator and GitHub's API Pagination Traversaltext/turtle or application/ld+jsong (named graph where to insert the data) and data (with the triples to insert, in ntriples format). The INSERT query pattern is so far static, as defined in static.py. Only tested with Virtuoso.The easiest way to use grlc is by visiting grlc.io/ and using this service to convert SPARQL queries on your github repo into a RESTful API.
If you want to run grlc locally or use it as a library, you can install grlc on your machine. Grlc is registered in PyPi so you can install it using pip.
sudo apt-get install libevent-dev python-all-dev
pip install grlc
Grlc includes a command line tool which you can use to start your own grlc server:
grlc-server
You can run grlc using gunicorn as follows:
gunicorn grlc.server:app
If you want to use your own gunicorn configuration, for example gunicorn_config.py:
workers = 5
worker_class = 'gevent'
bind = '0.0.0.0:8088'
Then you can run it as:
gunicorn -c gunicorn_config.py grlc.server:app
Note: Since gunicorn does not work under Windows, you can use waitress instead:
waitress-serve --port=8088 grlc.server:app
You can use grlc as a library directly from your own python script. See the usage example to find out more.
To run grlc via docker, you'll need a working installation of docker. To deploy grlc, just pull the latest image from Docker hub. :
docker run -it --rm -p 8088:80 clariah/grlc
The docker image allows you to setup several environment variable such as GRLC_SERVER_NAME GRLC_GITHUB_ACCESS_TOKEN and GRLC_SPARQL_ENDPOINT:
docker run -it --rm -p 8088:80 -e GRLC_SERVER_NAME=grlc.io -e GRLC_GITHUB_ACCESS_TOKEN=xxx -e GRLC_SPARQL_ENDPOINT=http://dbpedia.org/sparql -e DEBUG=true clariah/grlc
In order for grlc to communicate with GitHub, you'll need to tell grlc what your access token is:
docker-compose.yml or docker-compose.default.yml file, and paste this token as value of the environment variable GRLC_GITHUB_ACCESS_TOKENIf you want to run grlc at system boot as a service, you can find example upstart scripts at upstart/
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:
http://localhost:8088/api/username/repo/spec, e.g. http://localhost:8088/api/CEDAR-project/Queries/spec or http://localhost:8088/api/CLARIAH/wp4-queries/spechttp://localhost:8088/api/username/repo/api-docs, e.g. http://localhost:8088/api/CEDAR-project/Queries/api-docs or http://localhost:8088/api/CLARIAH/wp4-queries/api-docsBy default grlc will direct your queries to the DBPedia SPARQL endpoint. To change this either:
endpoint parameter to your request: 'http://grlc.io/user/repo/query?endpoint=http://sparql-endpoint/'. You can add a #+ endpoint_in_url: False decorator if you DO NOT want to see the endpoint parameter in the swagger-ui of your API.#+ endpoint: decorator in the first comment block of the query text (preferred, see below)endpoint.txt file within the GitHub repository that contains the queries.That's it!
Check these out:
You'll find the sources of these and many more in GitHub
A couple of SPARQL comment embedded decorators are available to make your swagger-ui look nicer (note all comments start with #+ and the use of ':' is restricted to list-representations and cannot be used in the summary text):
#+ endpoint: http://example.com/sparql.#+ method: GET.#+ pagination: 100.#+ summary: This is the summary of my query/operation#+ tags:
#+ - firstTag
#+ - secondTag#+ enumerate:
#+ - var1
#+ - var2#+ enumerate:
#+ - var1:
#+ - value1
#+ - value2Notice that these should be plain variable names without SPARQL/BASIL conventions (so var1 instead of ?_var1_iri)
See examples at https://github.com/albertmeronyo/lodapi.
Use this GitHub search to see examples from other users of grlc.
grlc needs you to continue bringing Semantic Web content to developers, applications and users. No matter if you are just a curious user, a developer, or a researcher; there are many ways in which you can contribute:
Check our contributing guidelines for these and more, and join us today!
If you cannot code, that's no problem! There's still plenty you can contribute:
Content type
Image
Digest
Size
477.9 MB
Last updated
over 6 years ago
docker pull cmartinez/grlc:docker-no-nginx