Crates.io | graph-rdfa-processor |
lib.rs | graph-rdfa-processor |
version | 0.1.3 |
source | src |
created_at | 2023-10-29 21:47:56.870779 |
updated_at | 2024-01-27 11:06:42.872405 |
description | Graph RDFa processor |
homepage | |
repository | https://github.com/nbittich/graph-rdfa-processor |
max_upload_size | |
id | 1017777 |
size | 235,368 |
Rust and wasm library to extract rdf statements (in n-triples format) from an html file based on rdfa annotations.
use graph_rdfa_processor::RdfaGraph;
let html = r#"
<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 = Some("http://example.org/.well_known");
RdfaGraph::parse_str(html, base, well_known_prefix).unwrap()
<script type="module">
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();
</script>
covers:
used RDFa/Play for comparing.
The plan is to make as much tests as possible, and fix the bugs along the way.