#turtle #rdf #parser

bin+lib chelone

A RDF(Resource Description Framework) 1.1 Turtle parser

3 releases

Uses old Rust 2015

0.1.3 Mar 4, 2019
0.1.2 Feb 22, 2018
0.1.1 Feb 19, 2018

#2177 in Parser implementations

MIT/Apache

40KB
1K SLoC

Rust 889 SLoC // 0.0% comments Pest 118 SLoC

Chelone: A RDF Turtle parser

Chelone is a rdf turtle parser.

chelone = "0.1"
extern crate chelone;

use chelone::Graph;

const TURTLE: &str = r##"
@base <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .

<#Mozilla>
    a foaf:Organization ;
    foaf:name "Mozilla" .

<#Rust>
    rel:childOf <#Mozilla> ;
    a foaf:Project ;
    foaf:name "Rust" .
"##;

fn main() {
    let graph = Graph::new(TURTLE).unwrap_or_else(|e| panic!("{}", e));
    let triples = graph.parse();

    println!("{}", triples);
}

lib.rs:

Chelone: A Turtle-RDF parsing library.

extern crate chelone;

use chelone::Graph;

const TURTLE: &str = r##"
@base <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .

<#Mozilla>
    a foaf:Organization ;
    foaf:name "Mozilla" .

<#Rust>
    rel:childOf <#Mozilla> ;
    a foaf:Project ;
    foaf:name "Rust" .
"##;

fn main() {
    let graph = Graph::new(TURTLE).unwrap_or_else(|e| panic!("{}", e));
    let triples = graph.parse();

    println!("{}", triples);
}

Dependencies

~6MB
~136K SLoC