6 releases

new 0.2.1 Dec 8, 2024
0.2.0 Dec 8, 2024
0.1.3 Jan 27, 2024
0.1.2 Nov 6, 2023
0.1.0 Oct 29, 2023

#1281 in Web programming

Download history 4/week @ 2024-09-18 6/week @ 2024-09-25 215/week @ 2024-12-04

215 downloads per month
Used in rdfa-wasm

MIT license

84KB
1.5K SLoC

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

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>

Dependencies

~8–15MB
~183K SLoC