Skip to content

Instantly share code, notes, and snippets.

What would you like to do?


GraphQL-LD is a way to query Linked Data using GraphQL.

Instead of querying GraphQL interfaces, Linked Data interfaces are queried, such as SPARQL endpoints, TPF interfaces, Linked Data documents, ... This is done by semantifying GraphQL queries using a JSON-LD context.

Try it out from your browser:

Alternatively, install GraphQL-LD or Comunica SPARQL and execute GraphQL-LD queries on your machine

The basics

In order to execute queries, you'll need to parts:

  1. A GraphQL query: to select data
  2. A JSON-LD context: to map query fields to URIs

With this, GraphQL queries can be translated into a SPARQL query, using which any Linked Data source can be queried.


Find all labels in a dataset

GraphQL query:


JSON-LD context:

  "@context": {
    "label": { "@id": "" }

This query will be translated into the following triple pattern:

_:b <> ?label

More information

If you want more details on how GraphQL-LD works, please refer to our article or our GraphQL-LD tool

Related software

Copy link

elf-pavlik commented Dec 13, 2018

Does it fully support JSON-LD @reverse? In other words, can GraphQL query include property only defined in JSON-LD context as @reverse of actual instance of rdf:Property used in the dataset?

Copy link

rubensworks commented Jan 10, 2019

@elf-pavlik Yep, @reverse on properties is fully supported!

Copy link

almereyda commented Apr 3, 2019

There is an open issue about how to use @reverse in rubensworks/graphql-to-sparql.js#22

Copy link

Rakeshjdev commented Jul 17, 2019

I have jsonld and my requirement is to map jsonld to Grapql schema so that i can do get and post operation with graphql . how will i achieve this. please suggest. please give a reference so that i can achieve this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment