pub trait GraphView:
Sized
+ Send
+ Clone {
type Stream: Send + Unpin + Stream<Item = Result<Arc<Triple>, GraphError>>;
type Filter<T: TripleFilter + Send + Sync + Unpin + Clone>: GraphView;
type Matches<'g>: GraphView;
type CBD: GraphView;
type Describe<'g>: GraphView;
type SubjectStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>;
type PredicateStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>;
type ObjectStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>;
Show 17 methods
// Required methods
fn stream(
self,
) -> impl Future<Output = Result<Self::Stream, GraphError>> + Send;
fn filter<F>(
self,
filter: F,
) -> impl Future<Output = Result<Self::Filter<F>, GraphError>> + Send
where F: TripleFilter + Send + Sync + Unpin + Clone;
fn matches<'g>(
self,
subject: Option<&'g Term>,
predicate: Option<&'g Term>,
object: Option<&'g Term>,
limit: Option<usize>,
) -> impl Future<Output = Result<Self::Matches<'g>, GraphError>> + Send;
fn cbd(
self,
subject: &Term,
) -> impl Future<Output = Result<Self::CBD, GraphError>> + Send;
fn describe(
self,
subject: Option<&Term>,
limit: Option<usize>,
) -> impl Future<Output = Result<Self::Describe<'_>, GraphError>> + Send;
fn subjects<'g>(
self,
predicate: Option<&'g Term>,
object: Option<&'g Term>,
limit: Option<usize>,
) -> impl Future<Output = Result<Self::SubjectStream<'g>, GraphError>> + Send;
fn predicates<'g>(
self,
subject: Option<&'g Term>,
object: Option<&'g Term>,
limit: Option<usize>,
) -> impl Future<Output = Result<Self::ObjectStream<'g>, GraphError>> + Send;
fn objects<'g>(
self,
subject: Option<&'g Term>,
predicate: Option<&'g Term>,
limit: Option<usize>,
) -> impl Future<Output = Result<Self::ObjectStream<'g>, GraphError>> + Send;
// Provided methods
fn subject(
self,
predicate: Option<&Term>,
object: Option<&Term>,
) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send { ... }
fn predicate(
self,
subject: Option<&Term>,
object: Option<&Term>,
) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send { ... }
fn object(
self,
subject: Option<&Term>,
predicate: Option<&Term>,
) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send { ... }
fn contains(
self,
triple: TripleRef<'_>,
) -> impl Future<Output = Result<bool, GraphError>> + Send { ... }
fn ground(self) -> impl Future<Output = Result<bool, GraphError>> + Send { ... }
fn default_triple_size_hint() -> usize { ... }
fn default_buf_size_hint() -> usize { ... }
fn triple_size_hint(&self) -> usize { ... }
fn buf_size_hint(&self) -> usize { ... }
}Required Associated Types§
type Stream: Send + Unpin + Stream<Item = Result<Arc<Triple>, GraphError>>
type Filter<T: TripleFilter + Send + Sync + Unpin + Clone>: GraphView
type Matches<'g>: GraphView
type CBD: GraphView
type Describe<'g>: GraphView
type SubjectStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>
type PredicateStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>
type ObjectStream<'g>: Send + Unpin + Stream<Item = Result<Arc<Term>, GraphError>>
Required Methods§
fn stream(self) -> impl Future<Output = Result<Self::Stream, GraphError>> + Send
fn filter<F>( self, filter: F, ) -> impl Future<Output = Result<Self::Filter<F>, GraphError>> + Send
fn matches<'g>( self, subject: Option<&'g Term>, predicate: Option<&'g Term>, object: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::Matches<'g>, GraphError>> + Send
Sourcefn cbd(
self,
subject: &Term,
) -> impl Future<Output = Result<Self::CBD, GraphError>> + Send
fn cbd( self, subject: &Term, ) -> impl Future<Output = Result<Self::CBD, GraphError>> + Send
§Example
use taganak_framework::lazy_graph;
use taganak_framework::prelude::{Graph, GraphView};
use futures::StreamExt;
lazy_graph!(graph, r##"
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foo: <https://example.com/foo#> .
@prefix rdfs: <https://www.w3.org/2000/01/rdf-schema#> .
foo:Emil a foo:Turtle ;
foo:age 12 ;
foo:shell [ foo:color "#00ff00" ; foo:tiles 15 ] .
[ rdf:subject foo:Emil ; rdf:predicate foo:age ; rdf:object 12 ; foo:saidBy foo:Emil ] .
foo:Turtle rdfs:label "Schildkröte"@de , "tortoise"@fr .
"##
);
tokio_test::block_on(async {
let mut cbd_stream = graph.view().await.cbd(&"<https://example.com/foo#Emil>".try_into().unwrap()).await.unwrap().stream().await.unwrap();
assert_eq!(cbd_stream.count().await, 9);
});fn describe( self, subject: Option<&Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::Describe<'_>, GraphError>> + Send
fn subjects<'g>( self, predicate: Option<&'g Term>, object: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::SubjectStream<'g>, GraphError>> + Send
fn predicates<'g>( self, subject: Option<&'g Term>, object: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::ObjectStream<'g>, GraphError>> + Send
fn objects<'g>( self, subject: Option<&'g Term>, predicate: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::ObjectStream<'g>, GraphError>> + Send
Provided Methods§
fn subject( self, predicate: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send
fn predicate( self, subject: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send
fn object( self, subject: Option<&Term>, predicate: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send
fn contains( self, triple: TripleRef<'_>, ) -> impl Future<Output = Result<bool, GraphError>> + Send
Sourcefn ground(self) -> impl Future<Output = Result<bool, GraphError>> + Send
fn ground(self) -> impl Future<Output = Result<bool, GraphError>> + Send
Checks whether graph is ground as defined by RDF Concepts and Abstract Syntax
A graph is ground if all triples in it are ground (cf. super::triples::Triple::ground).
§Example
use taganak_framework::lazy_graph;
use taganak_framework::prelude::{Graph, GraphView};
use futures::StreamExt;
lazy_graph!(GRAPH, r##"
@base <https://example.com/> .
<t1> a <Foo> ;
<sampleNumber> 12 .
<t2> a <Foo> ;
<sampleList> ( 12 15 ) .
"##);
tokio_test::block_on(async {
assert_eq!(GRAPH.view().await.ground().await.unwrap(), false);
assert_eq!(GRAPH.view().await
.cbd(&"<https://example.com/t1>".try_into().unwrap()).await.unwrap()
.ground().await.unwrap(),
true);
});fn default_triple_size_hint() -> usize
fn default_buf_size_hint() -> usize
fn triple_size_hint(&self) -> usize
fn buf_size_hint(&self) -> usize
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.