A parser for RDFa
npm install @factsmission/rdfa-parser
An RDFa parser in JS. Not yet complete but we aim for full support of HTML+RDFa 1.1.
rdfa-parser provides functions to parse either HTMLElements or Strings containg RDFa. A callback function is invoked whenever a quad has been read. The argument passed to this function is an rdfjs compliant quad.
Parses a Node / HTMLElement with RDFa.
Parses a String containing a Node / HTMLElement with RDFa
| Parameter | Type | Description | Default |
| - | - | - | - |
| element | Node | Node / Element to be parsed | _Required Parameter_ |
| string | String | String of Node / Element to be parsed | _Required Parameter_ |
| callback | Function | Function to give a quad. Gets called every time a quad is found | _Required Parameter_ |
| base | IRI | baseIRI to be used | element.baseURI \|\| window.location.href |
| useInitialContext | boolean | If https://www.w3.org/2013/json-ld-context/rdfa11 should be loaded as initial set of prefixes | false |
Run yarn build to create /distribution/latest/rdfa.js for use in websites.
html
...
...
`
All Triples found will be console.log`ed as stringified ntriples.