1use std::io::Write;
2
3use iri_s::IriS;
4use prefixmap::PrefixMap;
5
6use crate::{Query, RDFFormat};
7
8pub trait SRDFBuilder: Query {
10 fn empty() -> Self;
12
13 fn add_base(&mut self, base: &Option<IriS>) -> Result<(), Self::Err>;
15
16 fn add_prefix(&mut self, alias: &str, iri: &IriS) -> Result<(), Self::Err>;
18
19 fn add_prefix_map(&mut self, prefix_map: PrefixMap) -> Result<(), Self::Err>;
21
22 fn add_triple<S, P, O>(&mut self, subj: S, pred: P, obj: O) -> Result<(), Self::Err>
24 where
25 S: Into<Self::Subject>,
26 P: Into<Self::IRI>,
27 O: Into<Self::Term>;
28
29 fn remove_triple<S, P, O>(&mut self, subj: S, pred: P, obj: O) -> Result<(), Self::Err>
31 where
32 S: Into<Self::Subject>,
33 P: Into<Self::IRI>,
34 O: Into<Self::Term>;
35
36 fn add_type<S, T>(&mut self, node: S, type_: T) -> Result<(), Self::Err>
38 where
39 S: Into<Self::Subject>,
40 T: Into<Self::Term>;
41
42 fn add_bnode(&mut self) -> Result<Self::BNode, Self::Err>;
44
45 fn serialize<W: Write>(&self, format: &RDFFormat, writer: &mut W) -> Result<(), Self::Err>;
47}