CubiQL: A GraphQL service for querying multidimensional Linked Data Cubes
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data Find the best label for dimensions, measures and codelist items. Aug 9, 2018
doc More cropping Nov 20, 2018
resources Merge remote-tracking branch 'origin/master' into pull_93 Nov 1, 2018
src/cubiql Rename project to CubiQL. Nov 19, 2018
test/cubiql
.gitignore Fix logging to use log4j2 Jun 11, 2018
.travis.yml Rename project to CubiQL. Nov 19, 2018
CHANGELOG.md
DataRestrictions.md Rename project to CubiQL. Nov 19, 2018
LICENSE Generate GraphQL schema from dataset dimensions. Sep 1, 2017
README.md Add logo to README (fix URL) Nov 20, 2018
project.clj Rename project to CubiQL. Nov 19, 2018

README.md

CubiQL

Build Status

CubiQL

CubiQL (formerly called graphql-qb) is a proof of concept GraphQL service for querying Linked Data Cubes that was produced as part of the Open Gov Intelligence project.

The primary aim of CubiQL is to facilitate the querying of multidimensional QB datasets through GraphQL in an easier more familiar way than through SPARQL.

Example

We have hosted an example CubiQL service at graphql-qb.publishmydata.com which is currently using data from from statistics.gov.scot.

The graphql endpoint for this service can be found at: http://graphql-qb.publishmydata.com/graphql

Example Queries

Pagination

As CubiQL provides access to datacubes and slices containing potentially large amounts of observations, observations are paginated following the graphql recommendation. Paginating through the data might not however suit all consumers, and might even timeout on larger datasets. So we anticipate providing a download_link field into the observations schema #43.

You can see an example of a pagination query here. You'll notice that this query has been parameterised by a $page parameter, which is provided in the supplied variable map. So to get the next page of results you just need to supply a new map of variables with page bound to the last value of the next_page field.

Using graphql voyager

You can browse our schema by following these steps:

  1. Run the graphql voyager introspection query on our endpoint
  2. Copy the result of the above query to your clipboard
  3. Visit https://apis.guru/graphql-voyager/
  4. Select custom schema
  5. Paste the schema into the text area
  6. Click change schema.

You'll see something like: screen shot 2017-09-08 at 15 48 29

Running yourself

$ java -jar cubiql-standalone.jar OPTIONS

The available options are:

Name Description Required Default
port Port to run server on no 8080
endpoint Endpoint for datasets yes
configuration Configuration for the dataset structure no

For example to run the server against a remote SPARQL endpoint on port 9000:

$ java -jar cubiql-standalone.jar --port 9000 --endpoint http://remote-endpoint/sparql/query

The endpoint can also refer to a local directory containing RDF data files. The repository contains test datasets in the data directory. When running from the root directory this repository can be specified with:

$ java -jar cubiql-standalone.jar --port 9000 --endpoint data

During development lein run can be used instead of building the uberjar:

$ lein run --port 9000 --endpoint data

The server hosts a GraphQL endpoint at http://localhost:PORT/graphql which follows the protocol described here.

Generating RDF data cubes with table2qb

table2qb is a command-line tool for generating RDF data cubes from tidy CSV data. See the end-to-end example of using table2qb and CubiQL together to generate and query RDF data cubes.

License

Copyright © 2017 Swirrl IT Ltd.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.