Package Exports
- graphql-ld-comunica
- graphql-ld-comunica/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphql-ld-comunica) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Comunica for GraphQL-LD
This is a GraphQL-LD engine for executing queries using the Comunica query engine.
If you want to use this for Solid apps, have a look at graphql-ld-comunica-solid instead.
Usage
This requires you to install graphql-ld-comunica: yarn add graphql-ld-comunica
.
import {Client} from "graphql-ld";
import {QueryEngineComunica} from "graphql-ld-comunica";
// Define a JSON-LD context
const context = {
"@context": {
"label": { "@id": "http://www.w3.org/2000/01/rdf-schema#label" }
}
};
// Create a GraphQL-LD client based on a client-side Comunica engine over 2 sources
const comunicaConfig = {
sources: [ "http://dbpedia.org/sparql", "https://ruben.verborgh.org/profile/" ],
};
const client = new Client({ context, queryEngine: new QueryEngineComunica(comunicaConfig) });
// Define a query
const query = `
query @single {
label
}`;
// Execute the query
const { data } = await client.query({ query });
License
This software is written by Ruben Taelman.
This code is released under the MIT license.