[][src]Macro rome::graph_collection

macro_rules! graph_collection {
    ($name:ident($( $n:tt:$graph_type:path),+) ) => { ... };
}

Create a module for a collection of graphs.

Example

use rome::graph::{Graph, GraphWriter};
use rome::graphs::tel::{GraphCreator, Graph64, Graph128};
/// define a new collection type that has a Graph64 and a Graph128
graph_collection!(my_collection(0: ::rome::graphs::tel::Graph64,
                                1: ::rome::graphs::tel::Graph128));

let mut gw1 = GraphCreator::with_capacity(0);
let b1 = gw1.create_blank_node();
let p1 = gw1.create_iri(&"p");
gw1.add_blank_blank(&b1, &p1, &b1);
let g1: Graph64 = gw1.collect();
assert_eq!(g1.iter().count(), 1);
let mut gw2 = GraphCreator::with_capacity(0);
let b2 = gw2.create_blank_node();
let p2 = gw2.create_iri(&"p");
gw2.add_blank_blank(&b2, &p2, &b2);
let g2: Graph128 = gw2.collect();
assert_eq!(g2.iter().count(), 1);

// combine two graphs into one
let g = my_collection::GraphCollection::new((&g1, &g2));
assert_eq!(g.iter().count(), 2);