Struct rdf::reader::turtle_parser::TurtleParser [] [src]

pub struct TurtleParser<R: Read> { /* fields omitted */ }

RDF parser to generate an RDF graph from Turtle syntax.

Methods

impl TurtleParser<Cursor<Vec<u8>>>
[src]

[src]

Constructor of TurtleParser from input string.

Examples

use rdf::reader::turtle_parser::TurtleParser;
use rdf::reader::rdf_parser::RdfParser;

let input = "<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://xmlns.com/foaf/0.1/maker> _:art .
             _:art <http://xmlns.com/foaf/0.1/name> \"Art Barstow\" .";

let reader = TurtleParser::from_string(input.to_string());

impl<R: Read> TurtleParser<R>
[src]

[src]

Constructor of TurtleParser from input reader.

Examples

use rdf::reader::turtle_parser::TurtleParser;
use rdf::reader::rdf_parser::RdfParser;

let input = "<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://xmlns.com/foaf/0.1/maker> _:art .
             _:art <http://xmlns.com/foaf/0.1/name> \"Art Barstow\" .";

let reader = TurtleParser::from_reader(input.as_bytes());

Trait Implementations

impl<R: Read> RdfParser for TurtleParser<R>
[src]

[src]

Generates an RDF graph from a string containing Turtle syntax.

Returns an error in case invalid Turtle syntax is provided.

Examples

use rdf::reader::turtle_parser::TurtleParser;
use rdf::reader::rdf_parser::RdfParser;

let input = "<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://xmlns.com/foaf/0.1/maker> _:art .
             _:art <http://xmlns.com/foaf/0.1/name> \"Art Barstow\" .";

let mut reader = TurtleParser::from_string(input.to_string());

match reader.decode() {
  Ok(graph) => assert_eq!(graph.count(), 2),
  Err(_) => assert!(false)
}

Failures

  • Invalid input that does not conform with NTriples standard.
  • Invalid node type for triple segment.

Auto Trait Implementations

impl<R> Send for TurtleParser<R> where
    R: Send

impl<R> Sync for TurtleParser<R> where
    R: Sync