Crate rdftk_core[][src]

Expand description

core This crate provides an implementation of the RDF abstract syntax along with a Resource type that provides a builder-like experience for models.

From RDF 1.1 Concepts and Abstract Syntax;

The core structure of the abstract syntax is a set of triples, each consisting of a subject, a predicate and an object. A set of such triples is called an RDF graph. An RDF graph can be visualized as a node and directed-arc diagram, in which each triple is represented as a node-arc-node link.

rdf-graph

There can be three kinds of nodes in an RDF graph: IRIs, literals, and blank nodes.

In this library the triple, or statement, as well as subject, predicate, and object types are in the module statement. Literal’s as objects are supported in the literal module. Traits that describe graphs are provided by the graph module.

Additional features are provided such as support for data sets (module data_set) as well as support for extensions to the core RDF abstract model such as RDF-star.

Example

use rdftk_core::{Statement, SubjectNode, ObjectNode};
use rdftk_core::statement::StatementList;
use rdftk_iri::IRI;
use std::rc::Rc;
use std::str::FromStr;

let mut statements: StatementList = Default::default();

statements.push(Statement::new(
    SubjectNode::from(IRI::from_str("http://en.wikipedia.org/wiki/Tony_Benn").unwrap()).into(),
    IRI::from_str("http://purl.org/dc/elements/1.1/title").unwrap().into(),
    ObjectNode::literal_str("Tony Benn").into(),
).into());

Re-exports

pub use graph::Graph;
pub use graph::PrefixMappings;
pub use literal::DataType;
pub use literal::Literal;
pub use statement::ObjectNode;
pub use statement::Statement;
pub use statement::SubjectNode;

Modules

data_set

Provides an implementation of the W3C RDF 1.1: On Semantics of RDF Datasets recommendation. Additional semantics taken from RDF 1.1 TriG, RDF Dataset Language.

error

The shared Error, ErrorKind, and Result common to the entire toolkit.

graph

Traits which describe the core capabilities of a graph. Note that this crate does not provide an implementation of these traits as they are very dependent on their usage for performance, and any backing storage.

literal

The Literal type used in the object component of a statement. Literal values are always strings, although an optional data type can be provided to allow consumers to convert from string lexical forms.

qname

Qualified names, names with the form {prefix}:{name} are used in a number of common serialization forms and use many of the same production rules as those for XML.

resource

Implementation of the Resource pattern as a kind of statement builder. As a builder type the interface is only additive, no update or remove methods exist.

statement

This module provides types for the RDF Statement (triple) concept.