{"id":15389353,"url":"https://github.com/tpluscode/rdf-string","last_synced_at":"2025-04-15T11:49:47.736Z","repository":{"id":38829818,"uuid":"238982469","full_name":"tpluscode/rdf-string","owner":"tpluscode","description":"Simplifies creating of RDF strings","archived":false,"fork":false,"pushed_at":"2024-05-06T10:03:32.000Z","size":1807,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-07T11:04:30.919Z","etag":null,"topics":["rdf","rdf-strings","sparql","template-literals","turtle"],"latest_commit_sha":null,"homepage":"https://tpluscode.github.io/rdf-string/","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/tpluscode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-02-07T17:10:58.000Z","updated_at":"2024-05-27T11:57:58.884Z","dependencies_parsed_at":"2024-05-06T11:00:29.621Z","dependency_job_id":"7e8598ad-98f0-49e3-a9f4-2283e93a1b20","html_url":"https://github.com/tpluscode/rdf-string","commit_stats":null,"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2Frdf-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2Frdf-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2Frdf-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2Frdf-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpluscode","download_url":"https://codeload.github.com/tpluscode/rdf-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249066817,"owners_count":21207392,"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":["rdf","rdf-strings","sparql","template-literals","turtle"],"created_at":"2024-10-01T15:00:11.365Z","updated_at":"2025-04-15T11:49:47.718Z","avatar_url":"https://github.com/tpluscode.png","language":"TypeScript","readme":"\u003e # @tpluscode/rdf-string ![Test](https://github.com/tpluscode/rdf-string/workflows/Test/badge.svg) [![codecov](https://codecov.io/gh/tpluscode/rdf-string/branch/master/graph/badge.svg)](https://codecov.io/gh/tpluscode/rdf-string) [![npm version](https://badge.fury.io/js/%40tpluscode%2Frdf-string.svg)](https://badge.fury.io/js/%40tpluscode%2Frdf-string)\n\nSimplifies the construction of RDF strings (turtle, n-triples, SPARQL, etc.)\nby taking care of correctly serializing values to their string representation\nand automatically prefixing URIs.\n\n## Usage\n\nThe heart of the library are [EcmaScript template string tag functions][template-literals].\nAll interpolated values are serialized according to the syntactic rules of the given RDF format.\n\nFormats which support prefixes will automatically abbreviate the URIs and\nreturn the prefix declarations according to the specific syntax.\n\n### SPARQL\n\n```js\nimport * as RDF from '@rdfjs/data-model' \nimport { prefixes } from '@zazuko/rdf-vocabularies'\nimport namespace from '@rdfjs/namespace'\n\nimport { sparql } from '@zazuko/rdf-string'\n\nconst person = RDF.variable('person')\nconst PersonType = RDF.namedNode('http://example.com/Person')\nconst schema = namespace(prefixes.schema)\nconst name = \"John\"\n\nconst query = sparql`SELECT * WHERE {\n  ${person} a ${PersonType} .\n  ${person} ${schema.name} ${name} .\n}`\n\nquery.toString()\n```\n\nThe last line will return a complete query.\n\n```sparql\nPREFIX schema: \u003chttp://schema.org/\u003e\n\nSELECT * WHERE {\n  ?person a \u003chttp://example.com/Person\u003e .\n  ?person schema:name \"John\" .\n}\n```\n\n### turtle\n\nTBD\n\n### n-triples\n\nTBD\n\n[template-literals]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpluscode%2Frdf-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpluscode%2Frdf-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpluscode%2Frdf-string/lists"}