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: http://query.linkeddatafragments.org/
Alternatively, install GraphQL-LD or Comunica SPARQL and execute GraphQL-LD queries on your machine
In order to execute queries, you'll need to parts:
- A GraphQL query: to select data
- 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:
{
label
}
JSON-LD context:
{
"@context": {
"label": { "@id": "http://www.w3.org/2000/01/rdf-schema#label" }
}
}
This query will be translated into the following triple pattern:
_:b <http://www.w3.org/2000/01/rdf-schema#label> ?label
If you want more details on how GraphQL-LD works, please refer to our article or our GraphQL-LD tool
- GraphQL-LD.js: Execute GraphQL-LD queries via JavaScript
- graphql-to-sparql.js: Convert GraphQL queries to SPARQL queries
- GraphQL-LD-SPARQLEndpoint.js: A GraphQL-LD engine that is backed by a SPARQL endpoint
- GraphQL-LD-Comunica.js: A GraphQL-LD engine that is backed by Comunica
- GraphQL-LD-Comunica-Solid.js: A GraphQL-LD engine that is backed by Comunica with Solid authentication
- solid-react-graphql-ld.js: React components and hooks for building Solid apps with GraphQL-LD
- Grappa: A GraphQL to SPARQL bridge testbed by OpenLink (live demo)
➡️ Edit: I'm sorry, i think my example is wrong. Just tried it out, and it doesn't really seem to filter
@AnasShahab
One possible way may be to specify the language in the
@context
:and then you'd use it
Check out the examples on Comunica website.
I'm completely new to graphql-ld, so there might be other ways, idk... hope this helps, anyways...