better_sparql_client 0.2.1

SPARQL client built on the oxigraph ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use oxrdf::Graph;
use oxttl::{TurtleParseError, TurtleParser};

/// parses a turtle string into a graph
pub fn parse_ttl_into_graph(ttl: &str) -> Result<Graph, TurtleParseError> {
    let ttl_parser = TurtleParser::new().for_reader(ttl.as_bytes());
    let mut graph = Graph::new();

    for maybe_triple in ttl_parser {
        match maybe_triple {
            Ok(triple) => graph.insert(&triple),
            Err(e) => return Err(e),
        };
    }

    Ok(graph)
}