rdf-rs
Note: This project is work in progress and currently not stable.
rdf
is a library for the Resource Description Framework (RDF) and SPARQL implemented in Rust.
This project is a way for me to learn Rust and combine it with my interests in semantic web technologies.
Basic Examples
RDF triples can be stored and represented in a graph.
use Graph;
use Uri;
use Triple;
let mut graph = new;
let subject = graph.create_blank_node;
let predicate = graph.create_uri_node;
let object = graph.create_blank_node;
let triple = new;
graph.add_triple;
RDF graphs can be serialized to a supported format.
use NTriplesWriter;
use RdfWriter;
use Graph;
use Uri;
use Triple;
let writer = new;
let mut graph = new;
let subject = graph.create_blank_node;
let predicate = graph.create_uri_node;
let object = graph.create_blank_node;
let triple = new;
graph.add_triple;
assert_eq!;
RDF syntax can also be parsed and transformed into an RDF graph.
use TurtleParser;
use RdfParser;
use Uri;
let input = "@base <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://www.w3.org/2001/sw/RDFCore/ntriples/> rdf:type foaf:Document ;
<http://purl.org/dc/terms/title> \"N-Triples\"@en-US ;
foaf:maker _:art .";
let mut reader = from_string;
match reader.decode
Current State
Currently rdf-rs
provides basic data structures for representing RDF graphs, triples and nodes.
The following formats can be parsed and serialized:
- Turtle
- N-Triples
Future Work and Ideas
- Support querying with SPARQL
- Add support for more formats
- More comprehensive
Uri
data structure