Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nbittich/graph-rdfa-processor
RDFa processor library
https://github.com/nbittich/graph-rdfa-processor
rdfa rdfa-extractor rust semantic-web
Last synced: 15 days ago
JSON representation
RDFa processor library
- Host: GitHub
- URL: https://github.com/nbittich/graph-rdfa-processor
- Owner: nbittich
- License: mit
- Created: 2023-10-28T08:52:13.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-01T12:00:11.000Z (24 days ago)
- Last Synced: 2025-01-01T12:08:20.184Z (24 days ago)
- Topics: rdfa, rdfa-extractor, rust, semantic-web
- Language: Rust
- Homepage: https://nbittich.github.io/graph-rdfa-processor/
- Size: 1.82 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RDFa processor library (WIP)
Rust and wasm library to extract rdf statements (in n-triples format) from an html file
based on rdfa annotations.## Examples
### Rust usage:
```rust
use graph_rdfa_processor::RdfaGraph;
let html = r#"
Dan Brickley
"#;
let base = "http://example.com";
let well_known_prefix = Some("http://example.org/.well_known");RdfaGraph::parse_str(html, base, well_known_prefix).unwrap()
```
### Node usage:
`npm i @nbittich/rdfa-wasm`
```js
const { html_to_rdfa } = require("@nbittich/rdfa-wasm");const example = `
Test 0224
`;
console.log(html_to_rdfa(example, "http://data.lblod.info", ""));
```### Web usage (not published on npm yet):
```js
import init, {html_to_rdfa} from "./rdfa-wasm/pkg/rdfa_wasm.js";async function run() {
await init();
let html =`
<div prefix="foaf: http://xmlns.com/foaf/0.1/" about="http://www.example.org/#somebody" rel="foaf:knows">
<p about="http://danbri.org/foaf.rdf#danbri" typeof="foaf:Person" property="foaf:name">Dan Brickley</p>
</div>
`;
let base = "http://example.com";
let well_known_prefix = "http://example.org/.well_known";
let res = html_to_rdfa(html, base, well_known_prefix);}
run();
```
- covers:
- [RDFa 1.1 Primer - Third Edition](https://www.w3.org/TR/rdfa-primer/)
- [RDFa Core](https://www.w3.org/TR/rdfa-core/)
- [Earl-Reports](https://rdfa.info/earl-reports/#RDFa-rdfa1.1-tests-for-html5)- used [RDFa/Play](https://rdfa.info/play/) for comparing.
- [Demo](https://nbittich.github.io/graph-rdfa-processor/)