{"id":30556163,"url":"https://github.com/jahed/sparql-engine","last_synced_at":"2025-08-28T06:34:35.509Z","repository":{"id":306144901,"uuid":"1025133178","full_name":"jahed/sparql-engine","owner":"jahed","description":"SPARQL query engine for servers and web browsers.","archived":false,"fork":false,"pushed_at":"2025-08-08T20:20:04.000Z","size":1729,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-08T21:14:17.610Z","etag":null,"topics":["engine","graph","query","rdf","semantic-web","sparql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jahed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"jahed","patreon":"jahed"}},"created_at":"2025-07-23T19:20:37.000Z","updated_at":"2025-08-08T20:20:08.000Z","dependencies_parsed_at":"2025-07-23T23:23:52.978Z","dependency_job_id":"8f9f0cbe-eb23-4946-9f45-10bce0c8275d","html_url":"https://github.com/jahed/sparql-engine","commit_stats":null,"previous_names":["jahed/sparql-engine"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/jahed/sparql-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahed%2Fsparql-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahed%2Fsparql-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahed%2Fsparql-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahed%2Fsparql-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jahed","download_url":"https://codeload.github.com/jahed/sparql-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahed%2Fsparql-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272453851,"owners_count":24937469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["engine","graph","query","rdf","semantic-web","sparql"],"created_at":"2025-08-28T06:34:34.493Z","updated_at":"2025-08-28T06:34:35.504Z","avatar_url":"https://github.com/jahed.png","language":"TypeScript","funding_links":["https://github.com/sponsors/jahed","https://patreon.com/jahed"],"categories":[],"sub_categories":[],"readme":"# @jahed/sparql-engine\n\n[![npm](https://img.shields.io/npm/v/@jahed/sparql-engine.svg)](https://www.npmjs.com/package/@jahed/sparql-engine)\n[![author](https://img.shields.io/badge/author-jahed-%23007fff)](https://jahed.dev/)\n\nSPARQL query engine for servers and web browsers.\n\nThis project is a continuation of [Callidon/sparql-engine](https://github.com/Callidon/sparql-engine) which is no longer maintained. For additional history, check out that project's repository.\n\nThe aim of this project is to use newer Web APIs, language features, and make the project easier to use and maintain.\n\n## Installation\n\n```sh\nnpm install @jahed/sparql-engine sparqljs\n```\n\nOverride `rdf-data-factory` to use v2 in your `package.json`.\n\n```json\n{\n  \"overrides\": {\n    \"sparqljs\": {\n      \"rdf-data-factory\": \"^2\"\n    }\n  }\n}\n```\n\n## Usage\n\n```ts\nimport type { ExecutionContext } from \"@jahed/sparql-engine/engine/context/execution-context.js\";\nimport type { PipelineInput } from \"@jahed/sparql-engine/engine/pipeline/pipeline-engine.js\";\nimport SparqlEngineGraph from \"@jahed/sparql-engine/rdf/graph.js\";\nimport HashMapDataset from \"@jahed/sparql-engine/rdf/hashmap-dataset.js\";\nimport { RDF } from \"@jahed/sparql-engine/utils/rdf.js\";\nimport type { EngineTriple } from \"@jahed/sparql-engine/types.js\";\nimport { Parser } from \"sparqljs\";\n\nexport class MySparqlGraph extends SparqlEngineGraph {\n  *find(\n    triple: EngineTriple,\n    context: ExecutionContext\n  ): PipelineInput\u003cEngineTriple\u003e {\n    yield RDF.quad(\n      RDF.namedNode(\"subject\"),\n      RDF.namedNode(\"predicate\"),\n      RDF.namedNode(\"object\")\n    );\n  }\n  async insert(triple: EngineTriple): Promise\u003cvoid\u003e {}\n  async delete(triple: EngineTriple): Promise\u003cvoid\u003e {}\n  async clear(): Promise\u003cvoid\u003e {}\n}\n\nconst defaultGraph = new MySparqlGraph();\nconst dataset = new HashMapDataset(defaultGraph);\nconst planner = new PlanBuilder(dataset);\nconst parser = new Parser({ factory: RDF });\nconst query = parser.parse(\"\u003csparql\u003e\");\n\ntry {\n  for await (const row of planner.build(query)) {\n    // row found\n  }\n  // query completed\n} catch (error) {\n  // query has errored\n}\n```\n\n## Alternative Pipelines\n\nPipelines are used to process results. To use an alternative pipeline, change it before doing anything else with the engine.\n\n```ts\nimport { Pipeline } from \"@jahed/sparql-engine/engine/pipeline/pipeline.ts\"\nimport RxjsPipeline from from \"@jahed/sparql-engine/engine/pipeline/rxjs-pipeline.ts\"\n\n// Install rxjs to use the RxjsPipeline.\nPipeline.setInstance(new RxjsPipeline());\n```\n\n## License\n\n[MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahed%2Fsparql-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahed%2Fsparql-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahed%2Fsparql-engine/lists"}