{"id":20950402,"url":"https://github.com/atomgraph/sparql-builder","last_synced_at":"2025-05-14T03:32:36.676Z","repository":{"id":35583369,"uuid":"175314392","full_name":"AtomGraph/sparql-builder","owner":"AtomGraph","description":"Type-safe SPARQL query builder written in TypeScript","archived":false,"fork":false,"pushed_at":"2023-01-07T11:13:03.000Z","size":289,"stargazers_count":16,"open_issues_count":13,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-14T16:48:25.144Z","etag":null,"topics":["javascript","knowledge-graph","linked-data","query-builder","rdf","semantic-web","sparql","sparql-builder","sparql-query-builder","triplestore","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AtomGraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-13T00:00:05.000Z","updated_at":"2024-11-13T15:08:57.000Z","dependencies_parsed_at":"2023-01-16T00:14:04.750Z","dependency_job_id":null,"html_url":"https://github.com/AtomGraph/sparql-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2Fsparql-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2Fsparql-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2Fsparql-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2Fsparql-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AtomGraph","download_url":"https://codeload.github.com/AtomGraph/sparql-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275717,"owners_count":17448387,"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","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":["javascript","knowledge-graph","linked-data","query-builder","rdf","semantic-web","sparql","sparql-builder","sparql-query-builder","triplestore","typescript"],"created_at":"2024-11-19T00:48:19.757Z","updated_at":"2024-11-19T00:48:20.522Z","avatar_url":"https://github.com/AtomGraph.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sparql-builder\nSPARQL query builder written in TypeScript. Can be used from both TypeScript and JavaScript, although type-safety is lost in JavaScript.\n\nIt [exposes the following classes](dist/index.d.ts):\n\n* `QueryBuilder` - builder base class\n    * `SelectBuilder` - `SELECT` query builder\n    * `DescribeBuilder` - `DESCRIBE` query builder\n\n## Build\n\nThe [`build-dist.sh`](build-dist.sh) script does the following:\n* compiles the TypeScript code using `tsc`\n* runs unit tests using `npm test`\n* packages the library with `webpack`\n  - for use in the browser (`window` target, output in `dist/window`)\n  - for use with Node.js (`commonjs2` target, output in `dist/node`)\n\n## Usage\n\nThe builder is published as [`sparql-builder`](https://www.npmjs.com/package/sparql-builder) package on npm. Import it into your `package.json`:\n\n```json\n    \"dependencies\": {\n        \"sparql-builder\": \"^1.0.6\"\n    }\n```\n\n## Example:\n\nCode in `test.ts`:\n```typescript\nimport { SelectBuilder } from 'sparql-builder';\n\nlet query = \"SELECT ?s { ?s ?p ?o }\";\n\nlet builder = SelectBuilder.fromString(query).\n    limit(42).\n    offset(66).\n    orderBy(SelectBuilder.ordering(SelectBuilder.var(\"s\"), true)).\n    orderBy(SelectBuilder.ordering(SelectBuilder.var(\"p\")));\n\nconsole.log(builder.toString());\n```\n\nOutput of `tsc \u0026\u0026 node test.js`:\n```sparql\nSELECT ?s WHERE { ?s ?p ?o. }\nORDER BY DESC (?s) (?p)\nOFFSET 66\nLIMIT 42\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomgraph%2Fsparql-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomgraph%2Fsparql-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomgraph%2Fsparql-builder/lists"}