{"id":15437101,"url":"https://github.com/awwright/node-rdfa","last_synced_at":"2025-04-19T18:26:37.984Z","repository":{"id":139430609,"uuid":"132725078","full_name":"awwright/node-rdfa","owner":"awwright","description":"Query and process RDFa documents","archived":false,"fork":false,"pushed_at":"2020-06-27T20:15:36.000Z","size":66,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T10:30:31.849Z","etag":null,"topics":["nodejs-modules","rdf","rdfa","rdfjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awwright.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-09T08:20:31.000Z","updated_at":"2020-06-27T20:15:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc20bc1f-c1eb-4083-8886-9daa385f798e","html_url":"https://github.com/awwright/node-rdfa","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwright%2Fnode-rdfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwright%2Fnode-rdfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwright%2Fnode-rdfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwright%2Fnode-rdfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awwright","download_url":"https://codeload.github.com/awwright/node-rdfa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249763025,"owners_count":21322030,"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":["nodejs-modules","rdf","rdfa","rdfjs"],"created_at":"2024-10-01T18:55:05.428Z","updated_at":"2025-04-19T18:26:37.947Z","avatar_url":"https://github.com/awwright.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ECMAScript RDFa Parser\n\nA fairly modular, cross-platform, extensible package to extract RDF information from RDFa-enabled documents.\n\nFeatures:\n\n* Sometimes extracts RDF statements\n* Passes all compliant XML tests\n* Walks DOM tree to generate an RDF graph\n* Extensible design for parsing supersets of RDFa and supporting new media types\n\nGoals:\n\n* Consume DOM nodes or SAX events\n* Output a complete graph or \"Statement\" events\n* Support custom types of nodes (e.g. variables)\n* Query for DOM nodes by data they contain\n* Linting of RDFa documents for:\n\t* check property order\n\t* reverse/forward incompatability\n\t* shadowed definitions\n\t* defining over registered URI schemes\n\t* non-normalized IRI references\n\t* Invalid IRIs\n\t* Invalid CURIEs\n\t* Term is used without an active vocabulary\n\n## Features\n\n### Parse a DOM tree into an RDF graph\n\n```javascript\nconst rdfa = require('rdfa');\nconst fs = require('fs');\nconst DOMParser = require('xmldom').DOMParser;\n\nconst filepath = './test/rdfa.github.io/test-suite/test-cases/rdfa1.1-lite/xhtml1/0021.xhtml';\nconst document = new DOMParser().parseFromString(fs.readFileSync(filepath, 'UTF-8'), 'text/xml');\nconst result = rdfa.parseDOM(rdfa.RDFaXMLParser, 'http://example.com/', document);\nresult.outputGraph.forEach(function(n){ console.log(n.toTurtle()); });\n```\n\n\t\u003chttp://example.com/\u003e \u003chttp://purl.org/dc/elements/1.1/creator\u003e \"Mark Birbeck\" .\n\n\n### Support for standards-based XML parsers\n\nThere is no included document parser, instead supports reading from a DOM (W3C or compatible), or a SAX-like event stream.\n\nTests are written for the following packages:\n\n* http://npmjs.com/package/xmldom\n\n\n### Support for different media types\n\nSupports plain XML, HTML, and SVG out-of-the-box, and is extendible for new host languages.\n\nSupported host languages:\n\n* RDFaXMLParser - for plain XML documents\n* RDFaXHTMLParser - for HTML documents delivered in `application/xhtml+xml`\n* RDFaHTMLParser - for HTML documents delivered in `text/html`\n\n\n## File index\n\n* bin/httpd.js - an HTTP server for use with the RDFa Test Suite\n* bin/rdfa-turtle.js - read a file and print extracted triples\n* defaults.json - list of RDFa Initial Context vocabulary \u0026 terms\n* index.js - the bulk of the logic\n* test/suite.js - runs the library against a local copy of the RDFa test suite\n\n\n## API\n\n### parseDOM(Processor, base, document, options)\n\nExtracts RDF statements out of a DOM document `document`, assuming a URI base `base` (always ignoring the URI in the DOM node, if any).\n\nReturns an RDFaParser instance (see below).\n\n* Processor: a reference to a subclass of RDFaParser\n* base: the URI base for the document (where the document was downloaded from)\n* document: DOM document\n* options: object with additional configuration\n\t* forceVersion: RDFa version to use. This is normally detected.\n\t* defaultLanguage: default language for when no language is specified by the document (use the language specified in the `Content-Language` header, if any)\n\n\n### RDFaParser\n\n* outputGraph - instance of [RDF.Graph](https://github.com/awwright/node-rdf#graph)\n* processorGraph - instance of [RDF.Graph](https://github.com/awwright/node-rdf#graph)\n\nMaintains state during processing of a document. Pass a subclass of this to `parseDOM` as the first argument `Processor`.\n\n\n### RDFaXMLParser\n\nRDFaParser with the default RDF context loaded.\n\n\n### RDFaXHTMLParser\n\nRDFaParser extended with the parsing rules for `application/xhtml+xml` documents.\n\n\n### RDFaHTMLParser\n\nRDFaParser extended with the parsing rules for `text/html` documents.\n\n\n### RDFaContext\n\nRepresents an RDFa processing context that's generated during processing of an element and passed to child elements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawwright%2Fnode-rdfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawwright%2Fnode-rdfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawwright%2Fnode-rdfa/lists"}