15 releases

0.1.5 Jan 11, 2025
0.1.4 Dec 21, 2024
0.1.3 Nov 7, 2024
0.1.0-alpha.6 May 22, 2024
0.1.0-alpha.5 Mar 25, 2024

#2920 in Parser implementations

Download history 557/week @ 2024-10-20 914/week @ 2024-10-27 362/week @ 2024-11-03 453/week @ 2024-11-10 192/week @ 2024-11-17 172/week @ 2024-11-24 252/week @ 2024-12-01 238/week @ 2024-12-08 319/week @ 2024-12-15 195/week @ 2024-12-22 317/week @ 2024-12-29 341/week @ 2025-01-05 373/week @ 2025-01-12 339/week @ 2025-01-19 145/week @ 2025-01-26 268/week @ 2025-02-02

1,212 downloads per month
Used in 30 crates (2 directly)

MIT/Apache

305KB
6.5K SLoC

OxRDF/XML

Latest Version Released API docs Crates.io downloads actions status Gitter

OxRdfXml is a parser and serializer for RDF/XML.

The entry points of this library are the two RdfXmlParser and RdfXmlSerializer structs.

Usage example counting the number of people in a RDF/XML file:

use oxrdf::{NamedNodeRef, vocab::rdf};
use oxrdfxml::RdfXmlParser;

let file = br#"<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/">
 <rdf:Description rdf:about="http://example.com/foo">
   <rdf:type rdf:resource="http://schema.org/Person" />
   <schema:name>Foo</schema:name>
 </rdf:Description>
 <schema:Person rdf:about="http://example.com/bar" schema:name="Bar" />
</rdf:RDF>"#;

let schema_person = NamedNodeRef::new("http://schema.org/Person").unwrap();
let mut count = 0;
for triple in RdfXmlParser::new().for_reader(file.as_ref()) {
    let triple = triple.unwrap();
    if triple.predicate == rdf::TYPE && triple.object == schema_person.into() {
        count += 1;
    }
}
assert_eq!(2, count);

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
  • MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Oxigraph by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.8–8MB
~63K SLoC