Module data_set

Source
Expand description

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.

The DataSet type provides a mapping from Option<GraphName> to Graph.

§Example

use rdftk_core::model::data_set::DataSet;
use rdftk_core::model::graph::Graph;
use rdftk_core::model::statement::Statement;

fn simple_dataset_writer(data_set: &DataSet)
{
    if let Some(graph) = data_set.default_graph() {
        simple_graph_writer(graph);
    }
    for graph in data_set.graphs() {
        simple_graph_writer(graph);
    }
}

fn simple_graph_writer(graph: &Graph)
{
    if graph.is_named() {
        println!("{} {{", graph.name().unwrap());
    } else {
        println!("{{");
    }
    for statement in graph.statements() {
        println!("    {:?}", statement);
    }
    println!("}}");
}

Structs§

DataSet
A DataSet is a mapping from GraphName to Graph; this introduces the notion of a named graph although in actuality the graph itself is not named as the name is the key within the data set. Note that this trait represents an immutable data set, a type should also implement the MutableDataSet trait for mutation.