1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use crate::{ObjectNode, Resource, Statement, SubjectNode};
use rdftk_iri::IRIRef;
use std::collections::HashSet;
use std::rc::Rc;
pub trait Graph {
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
fn contains_subject(&self, subject: &SubjectNode) -> bool;
fn contains_individual(&self, subject: &IRIRef) -> bool;
fn contains(&self, statement: &Statement) -> bool;
fn contains_all(&self, subject: &SubjectNode, predicate: &IRIRef, object: &ObjectNode) -> bool;
fn statements(&self) -> Vec<Rc<Statement>>;
fn statements_for(&self, subject: &SubjectNode) -> Vec<Rc<Statement>>;
fn subjects(&self) -> HashSet<&SubjectNode>;
fn predicates(&self) -> HashSet<&IRIRef>;
fn predicates_for(&self, subject: &SubjectNode) -> HashSet<&IRIRef>;
fn objects(&self) -> HashSet<&ObjectNode>;
fn objects_for(&self, subject: &SubjectNode, predicate: &IRIRef) -> HashSet<&ObjectNode>;
fn resource_for(&self, subject: &SubjectNode) -> Resource;
fn prefix_mappings(&self) -> Rc<dyn PrefixMappings>;
}
pub trait MutableGraph: Graph {
fn insert(&mut self, statement: Statement);
fn merge(&mut self, other: Rc<dyn Graph>);
fn dedup(&mut self);
fn remove(&mut self, statement: &Statement);
fn remove_all_for(&mut self, subject: &SubjectNode);
fn clear(&mut self);
}
pub mod named;
pub use named::{MutableNamedGraph, NamedGraph};
pub mod caching;
pub use caching::CachingGraph;
pub mod mapping;
pub use mapping::{Prefix, PrefixMappings};