{"id":47896,"library":"graphql-ld","title":"GraphQL-LD","description":"Query Linked Data using GraphQL queries and JSON-LD contexts. v2.0.0 converts GraphQL queries to SPARQL, executes them via local or remote engines, and returns tree-structured results. Bridges the gap between GraphQL developers and RDF/SPARQL ecosystems. Requires a separate query engine package (graphql-ld-comunica or graphql-ld-sparqlendpoint).","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/rubensworks/graphql-ld.js","tags":["javascript","graphql","graphqlld","sparql","query","rdf","linked data","typescript"],"install":[{"cmd":"npm install graphql-ld","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-ld","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-ld","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for client-side query execution against local or remote SPARQL endpoints","package":"graphql-ld-comunica","optional":true},{"reason":"Required for query execution via a remote SPARQL endpoint","package":"graphql-ld-sparqlendpoint","optional":true}],"imports":[{"note":"Default export is an object; use named import for Client class.","wrong":"import Client from 'graphql-ld'","symbol":"Client","correct":"import { Client } from 'graphql-ld'"},{"note":"CommonJS requires destructuring the named export.","wrong":"const Client = require('graphql-ld')","symbol":"Client","correct":"const { Client } = require('graphql-ld')"},{"note":"This engine is in a separate package, not part of graphql-ld core.","wrong":"import { QueryEngineComunica } from 'graphql-ld'","symbol":"QueryEngineComunica","correct":"import { QueryEngineComunica } from 'graphql-ld-comunica'"}],"quickstart":{"code":"import { Client } from 'graphql-ld';\nimport { QueryEngineComunica } from 'graphql-ld-comunica';\n\nconst context = {\n  \"@context\": {\n    \"label\": { \"@id\": \"http://www.w3.org/2000/01/rdf-schema#label\" }\n  }\n};\n\nconst client = new Client({\n  context,\n  queryEngine: new QueryEngineComunica({\n    sources: ['http://dbpedia.org/sparql']\n  })\n});\n\nconst query = `query @single { label }`;\nconst { data } = await client.query({ query });\nconsole.log(data);","lang":"typescript","description":"Shows basic setup: create a Client with a JSON-LD context and a Comunica query engine, then execute a simple GraphQL query."},"warnings":[{"fix":"Provide a queryEngine instance, e.g., new QueryEngineComunica({...}).","message":"The Client constructor now requires the 'queryEngine' option; passing only context will fail in v2.0.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use the graphql-ld-sparqlendpoint package instead and pass its engine to 'queryEngine'.","message":"The 'sparqlEndpoint' option in Client constructor has been deprecated since v2.0.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Include @single in your GraphQL query if you expect a single result.","message":"The query object must use the @single directive as shown; omitting it may return unexpected nested arrays.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import syntax in ES modules. If required CommonJS, use dynamic import() or ensure bundler compatibility.","message":"ESM-only since v2.0.0; require() still works via Node.js CJS interop but is not guaranteed in all bundlers.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'bridg':34 'comunica':52 'context':14 'convert':16 'data':6,65 'develop':39 'ecosystem':42 'engin':27,47 'execut':21 'gap':36 'graphql':2,8,17,38,50,55,59 'graphql-ld':1 'graphql-ld-comunica':49 'graphql-ld-sparqlendpoint':54 'graphqlld':60 'javascript':58 'json':12 'json-ld':11 'ld':3,13,51,56 'link':5,64 'local':24 'packag':48 'queri':4,9,18,46,62 'rdf':63 'rdf/sparql':41 'remot':26 'requir':43 'result':33 'return':29 'separ':45 'sparql':20,61 'sparqlendpoint':57 'structur':32 'tree':31 'tree-structur':30 'typescript':66 'use':7 'v2.0.0':15 'via':23","created_at":"2026-06-07T16:53:53.330129+00:00","updated_at":"2026-06-07T16:53:53.330129+00:00","problems":[{"fix":"new Client({ context, queryEngine: new QueryEngineComunica({...}) })","cause":"Client constructor was called without a 'queryEngine' option (required since v2.0.0).","error":"Error: No query engine provided"},{"fix":"Ensure sources array is present: new QueryEngineComunica({ sources: [...] })","cause":"QueryEngineComunica configuration object is missing or malformed.","error":"TypeError: Cannot read properties of undefined (reading 'sources')"},{"fix":"Double-check the GraphQL query syntax and JSON-LD context JSON formatting.","cause":"GraphQL query string is malformed; often missing quotation marks in context.","error":"SyntaxError: Expected '}' but found 'label'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rubensworks/graphql-ld.js#readme","github":"ssh://git@github.com/rubensworks/graphql-ld.js","docs":null,"changelog":null,"pypi":null,"npm":"graphql-ld","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}