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]
pub fn from_string<S>(input: S) -> TurtleParser<Cursor<Vec<u8>>> where
S: Into<String>,
[src]
S: Into<String>,
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]
pub fn from_reader(input: R) -> TurtleParser<R>
[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]
fn decode(&mut self) -> Result<Graph>
[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,
R: Send,
impl<R> Sync for TurtleParser<R> where
R: Sync,
R: Sync,