Crate rdftk_core
source ·Expand description
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.
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::model::statement::{
ObjectNode, Statement, StatementList, SubjectNode,
};
use rdftk_core::simple;
use rdftk_iri::Iri;
use std::rc::Rc;
use std::str::FromStr;
let mut statements: StatementList = Default::default();
let factory = simple::statement::statement_factory();
let literals = simple::literal::literal_factory();
statements.push(factory.statement(
factory.named_subject(
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(),
factory.literal_object(literals.string("Tony Benn")),
).unwrap());
Modules§
- Provides the crate’s
Error
andResult
types as well as helper functions. - This module contains the traits and types used to describe an abstract DataSet, Graph, and Statement RDF model.
- This module contains the types implementing the abstract RDF model described in crate::model.