{"id":27118585,"url":"https://github.com/doga/rdf-json-parser","last_synced_at":"2025-04-07T07:58:57.428Z","repository":{"id":281160410,"uuid":"944395718","full_name":"doga/rdf-json-parser","owner":"doga","description":"An RDF-JSON parser.","archived":false,"fork":false,"pushed_at":"2025-03-28T14:35:13.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T15:34:23.438Z","etag":null,"topics":["rdf"],"latest_commit_sha":null,"homepage":"https://www.w3.org/TR/rdf-json/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doga.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}},"created_at":"2025-03-07T09:20:55.000Z","updated_at":"2025-03-28T14:35:16.000Z","dependencies_parsed_at":"2025-03-07T10:39:37.196Z","dependency_job_id":null,"html_url":"https://github.com/doga/rdf-json-parser","commit_stats":null,"previous_names":["doga/rdf-json-parser"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doga%2Frdf-json-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doga%2Frdf-json-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doga%2Frdf-json-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doga%2Frdf-json-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doga","download_url":"https://codeload.github.com/doga/rdf-json-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615461,"owners_count":20967183,"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"],"created_at":"2025-04-07T07:58:56.926Z","updated_at":"2025-04-07T07:58:57.412Z","avatar_url":"https://github.com/doga.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"left\"\u003e\n\u003ca href=\"https://rdf.js.org/\" target=\"_blank\" rel=\"noreferrer\"\u003e\u003cimg src=\"https://github.com/doga/doga/raw/main/logos/rdf.svg\" height=\"85\" alt=\"RDF logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# An RDF-JSON parser\n\nA JavaScript library for parsing [RDF-JSON](https://www.w3.org/TR/rdf-json/).\n\n## Usage examples\n\n\u003cdetails data-mdrb\u003e\n\u003csummary\u003eParsing and serialising\u003c/summary\u003e\n\n\u003cpre\u003e\ndescription = '''\nTransform valid RDF-JSON into an RDF dataset, and back again.\n'''\n\u003c/pre\u003e\n\u003c/details\u003e\n\n```javascript\nimport { parse, serialise } from 'https://esm.sh/gh/doga/rdf-json-parser@1.1.1/mod.mjs';\n\nconst \nrdfJsonIn = {\n  \"http://site.example/id/Me\" : {\n    \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\" : [\n      { \"value\" : \"http://xmlns.com/foaf/0.1/Person\", \"type\" : \"uri\" }\n    ]\n  },\n  \"http://site.example\" : {\n    \"http://purl.org/dc/terms/title\" : [\n      { \"value\" : \"Anna's Homepage\", \"type\" : \"literal\" },\n      { \"value\" : \"Annas hjemmeside\", \"type\" : \"literal\", \"lang\" : \"no\"},\n    ] \n  }\n},\nrdfDataset = parse(rdfJsonIn),\nrdfJsonOut = serialise(rdfDataset);\n\nconsole.group('Quads in the RDF dataset:');\nfor (const quad of rdfDataset) {\n  console.group('Quad:');\n  console.info(`Subject:   ${quad.subject.termType} \"${quad.subject.value}\".`);\n  console.info(`Predicate: ${quad.predicate.termType} \"${quad.predicate.value}\".`);\n  console.info(`Object:    ${quad.object.termType}   \"${quad.object.value}\".`);\n  console.groupEnd();\n}\nconsole.groupEnd();\n\nconsole.info('\\nRDF-JSON serialisation of the RDF dataset:\\n', rdfJsonOut);\n```\n\nSample output for the code above:\n\n```text\nQuads in the RDF dataset:\n    Quad:\n        Subject:   NamedNode \"http://site.example/id/Me\".\n        Predicate: NamedNode \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\".\n        Object:    NamedNode   \"http://xmlns.com/foaf/0.1/Person\".\n    Quad:\n        Subject:   NamedNode \"http://site.example\".\n        Predicate: NamedNode \"http://purl.org/dc/terms/title\".\n        Object:    Literal   \"Anna's Homepage\".\n    Quad:\n        Subject:   NamedNode \"http://site.example\".\n        Predicate: NamedNode \"http://purl.org/dc/terms/title\".\n        Object:    Literal   \"Annas hjemmeside\".\n\nRDF-JSON serialisation of the RDF dataset:\n {\n  \"http://site.example/id/Me\": {\n    \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\": [ { value: \"http://xmlns.com/foaf/0.1/Person\", type: \"uri\" } ]\n  },\n  \"http://site.example\": {\n    \"http://purl.org/dc/terms/title\": [\n      { value: \"Anna's Homepage\", type: \"literal\" },\n      { value: \"Annas hjemmeside\", type: \"literal\", lang: \"no\" }\n    ]\n  }\n}\n```\n\n\u003cdetails data-mdrb\u003e\n\u003csummary\u003eDetecting invalid RDF-JSON\u003c/summary\u003e\n\n\u003cpre\u003e\ndescription = '''\nParsing an valid RDF-JSON fails.\n'''\n\u003c/pre\u003e\n\u003c/details\u003e\n\n```javascript\nimport { parse, serialise } from 'https://esm.sh/gh/doga/rdf-json-parser@1.1.1/mod.mjs';\n\nconst \nrdfJsonIn = {\n  \"http://site.example/id/Me\": {\n    \"https://site.example/vcard\": [{ value: \"https://site.example/id/vcard/1234\", type: \"uri\" }]\n  },\n  \"https://site.example/id/vcard/1234\": {\n    \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\": [\n      { value: \"http://www.w3.org/2006/vcard/ns#Individual\", type: \"uri\" }\n    ],\n    \"http://www.w3.org/2006/vcard/ns#fn\": [ { value: \"Me\", type: \"literal\" } ],\n    \"http://www.w3.org/2006/vcard/ns#hasTelephone\": [\n      { value: \"https://site.example/id/vcard/1234/phone/1\", type: \"uri\" }\n    ]\n  },\n  \"https://site.example/id/vcard/1234/phone/1\": {\n    \"http://www.w3.org/2006/vcard/ns#hasValue\": [\n      { value: \"tel:+41 22 738 73 59\", type: \"uri\" } // invalid \"tel:\" URL contains spaces\n    ]\n  }\n};\n\ntry {\n  const rdfDataset = parse(rdfJsonIn);\n  console.error(`Parsing should have failed.`);\n} catch ( error ) {\n  console.info(`Parsing failed: ${error}`);\n}\n\n```\n\nSample output for the code above:\n\n```text\nParsing failed: TypeError: Invalid NamedNode: IRI must not contain spaces.\n```\n\n### Running the usage examples\n\nRun the examples below by typing this in your terminal (requires [Deno](https://deno.com/) 2+):\n\n```shell\ndeno run --allow-net --allow-run --allow-env --allow-read jsr:@andrewbrey/mdrb@3.0.4 --dax=false --mode=isolated https://raw.githubusercontent.com/doga/rdf-json-parser/refs/heads/main/README.md\n```\n\n∎\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoga%2Frdf-json-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoga%2Frdf-json-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoga%2Frdf-json-parser/lists"}