Trait sophia_api::dataset::Dataset [−][src]
pub trait Dataset {
type Quad: QuadStreamingMode;
type Error: 'static + Error;
Show 29 methods
fn quads(&self) -> DQuadSource<'_, Self>;
fn quads_with_s<'s, TS>(&'s self, s: &'s TS) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
{ ... }
fn quads_with_p<'s, TP>(&'s self, p: &'s TP) -> DQuadSource<'s, Self>
where
TP: TTerm + ?Sized,
{ ... }
fn quads_with_o<'s, TS>(&'s self, o: &'s TS) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
{ ... }
fn quads_with_g<'s, TS>(
&'s self,
g: Option<&'s TS>
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
{ ... }
fn quads_with_sp<'s, TS, TP>(
&'s self,
s: &'s TS,
p: &'s TP
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
{ ... }
fn quads_with_so<'s, TS, TO>(
&'s self,
s: &'s TS,
o: &'s TO
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TO: TTerm + ?Sized,
{ ... }
fn quads_with_sg<'s, TS, TG>(
&'s self,
s: &'s TS,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_po<'s, TP, TO>(
&'s self,
p: &'s TP,
o: &'s TO
) -> DQuadSource<'s, Self>
where
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
{ ... }
fn quads_with_pg<'s, TP, TG>(
&'s self,
p: &'s TP,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TP: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_og<'s, TO, TG>(
&'s self,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_spo<'s, TS, TP, TO>(
&'s self,
s: &'s TS,
p: &'s TP,
o: &'s TO
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
{ ... }
fn quads_with_spg<'s, TS, TP, TG>(
&'s self,
s: &'s TS,
p: &'s TP,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_sog<'s, TS, TO, TG>(
&'s self,
s: &'s TS,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_pog<'s, TP, TO, TG>(
&'s self,
p: &'s TP,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_with_spog<'s, TS, TP, TO, TG>(
&'s self,
s: &'s TS,
p: &'s TP,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn contains<'s, TS, TP, TO, TG>(
&'s self,
s: &'s TS,
p: &'s TP,
o: &'s TO,
g: Option<&'s TG>
) -> DResult<Self, bool>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
{ ... }
fn quads_matching<'s, S, P, O, G>(
&'s self,
ms: &'s S,
mp: &'s P,
mo: &'s O,
mg: &'s G
) -> DQuadSource<'s, Self>
where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
{ ... }
fn subjects(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn predicates(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn objects(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn graph_names(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn iris(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn bnodes(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn literals(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn variables(&self) -> DResultTermSet<Self>
where
DTerm<Self>: Clone + Eq + Hash,
{ ... }
fn graph<'s, T>(
&'s self,
graph_name: Option<&'s T>
) -> DatasetGraph<Self, &'s Self, Option<&'s T>>
where
T: TTerm + ?Sized,
{ ... }
fn graph_mut<'s, T>(
&'s mut self,
graph_name: Option<&'s T>
) -> DatasetGraph<Self, &'s mut Self, Option<&'s T>>
where
T: TTerm + ?Sized,
{ ... }
fn union_graph<'s, T>(
&'s self,
gmatcher: T
) -> DatasetGraph<Self, &'s Self, T>
where
T: GraphNameMatcher + 's,
{ ... }
}
Expand description
Generic trait for RDF datasets.
For convenience, this trait is implemented by standard collections of quads.
NB: the semantics of this trait allows a dataset to contain duplicate quads;
see also SetDataset
.
Associated Types
type Quad: QuadStreamingMode
type Quad: QuadStreamingMode
Determine the type of Quad
s
that the methods of this dataset will yield
(see streaming_mode
).
Required methods
fn quads(&self) -> DQuadSource<'_, Self>
fn quads(&self) -> DQuadSource<'_, Self>
An iterator visiting all quads of this dataset in arbitrary order.
This iterator is fallible:
its items are Result
s,
an error may occur at any time during the iteration.
Examples
The result of this method is an iterator,
so it can be used in a for
loop:
for q in dataset.quads() {
let q = q?; // rethrow error if any
// do something with q
}
Another way is to use the specific methods provided by QuadSource
,
for example:
dataset.quads().for_each_quad(|q| {
// do something with q
})?; // rethrow error if any
Provided methods
fn quads_with_s<'s, TS>(&'s self, s: &'s TS) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
fn quads_with_s<'s, TS>(&'s self, s: &'s TS) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
An iterator visiting all quads with the given subject.
See also quads
.
fn quads_with_p<'s, TP>(&'s self, p: &'s TP) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
fn quads_with_p<'s, TP>(&'s self, p: &'s TP) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
An iterator visiting all quads with the given predicate.
See also quads
.
fn quads_with_o<'s, TS>(&'s self, o: &'s TS) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
fn quads_with_o<'s, TS>(&'s self, o: &'s TS) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
An iterator visiting add quads with the given object.
See also quads
.
fn quads_with_g<'s, TS>(&'s self, g: Option<&'s TS>) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
fn quads_with_g<'s, TS>(&'s self, g: Option<&'s TS>) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
An iterator visiting add quads with the given graph name.
See also quads
.
fn quads_with_sp<'s, TS, TP>(
&'s self,
s: &'s TS,
p: &'s TP
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
fn quads_with_sp<'s, TS, TP>(
&'s self,
s: &'s TS,
p: &'s TP
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
An iterator visiting add quads with the given subject and predicate.
See also quads
.
fn quads_with_so<'s, TS, TO>(
&'s self,
s: &'s TS,
o: &'s TO
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TO: TTerm + ?Sized,
fn quads_with_so<'s, TS, TO>(
&'s self,
s: &'s TS,
o: &'s TO
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TO: TTerm + ?Sized,
An iterator visiting add quads with the given subject and object.
See also quads
.
fn quads_with_sg<'s, TS, TG>(
&'s self,
s: &'s TS,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TG: TTerm + ?Sized,
fn quads_with_sg<'s, TS, TG>(
&'s self,
s: &'s TS,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TS: TTerm + ?Sized,
TG: TTerm + ?Sized,
An iterator visiting add quads with the given subject and graph name.
See also quads
.
fn quads_with_po<'s, TP, TO>(
&'s self,
p: &'s TP,
o: &'s TO
) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
fn quads_with_po<'s, TP, TO>(
&'s self,
p: &'s TP,
o: &'s TO
) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
An iterator visiting add quads with the given predicate and object.
See also quads
.
fn quads_with_pg<'s, TP, TG>(
&'s self,
p: &'s TP,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
TG: TTerm + ?Sized,
fn quads_with_pg<'s, TP, TG>(
&'s self,
p: &'s TP,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TP: TTerm + ?Sized,
TG: TTerm + ?Sized,
An iterator visiting add quads with the given predicate and graph name.
See also quads
.
fn quads_with_og<'s, TO, TG>(
&'s self,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
fn quads_with_og<'s, TO, TG>(
&'s self,
o: &'s TO,
g: Option<&'s TG>
) -> DQuadSource<'s, Self> where
TO: TTerm + ?Sized,
TG: TTerm + ?Sized,
An iterator visiting add quads with the given object and graph name.
See also quads
.
An iterator visiting add quads with the given subject, predicate and object.
See also quads
.
An iterator visiting add quads with the given subject, predicate and graph name.
See also quads
.
An iterator visiting add quads with the given subject, object and graph name.
See also quads
.
An iterator visiting add quads with the given predicate, object and graph name.
See also quads
.
An iterator visiting add quads with the given subject, predicate, object and graph name.
See also quads
.
Return true
if this dataset contains the given quad.
fn quads_matching<'s, S, P, O, G>(
&'s self,
ms: &'s S,
mp: &'s P,
mo: &'s O,
mg: &'s G
) -> DQuadSource<'s, Self> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
fn quads_matching<'s, S, P, O, G>(
&'s self,
ms: &'s S,
mp: &'s P,
mo: &'s O,
mg: &'s G
) -> DQuadSource<'s, Self> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
An iterator visiting add quads matching the given subject, predicate, object and graph name.
See also quads
.
Build a Hashset of all the terms used as subject in this Dataset.
fn predicates(&self) -> DResultTermSet<Self> where
DTerm<Self>: Clone + Eq + Hash,
fn predicates(&self) -> DResultTermSet<Self> where
DTerm<Self>: Clone + Eq + Hash,
Build a Hashset of all the terms used as predicate in this Dataset.
Build a Hashset of all the terms used as object in this Dataset.
fn graph_names(&self) -> DResultTermSet<Self> where
DTerm<Self>: Clone + Eq + Hash,
fn graph_names(&self) -> DResultTermSet<Self> where
DTerm<Self>: Clone + Eq + Hash,
Build a Hashset of all the terms used as graph names in this Dataset.
Build a Hashset of all the IRIs used in this Dataset.
Build a Hashset of all the BNodes used in this Dataset.
Build a Hashset of all the Literals used in this Dataset.
Build a Hashset of all the variables used in this Dataset.
Borrows one of the graphs of this dataset
Borrows mutably one of the graphs of this dataset