Trait GraphView

Source
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§

Required Methods§

Source

fn stream(self) -> impl Future<Output = Result<Self::Stream, GraphError>> + Send

Source

fn filter<F>( self, filter: F, ) -> impl Future<Output = Result<Self::Filter<F>, GraphError>> + Send
where F: TripleFilter + Send + Sync + Unpin + Clone,

Source

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

Source

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);
});
Source

fn describe( self, subject: Option<&Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::Describe<'_>, GraphError>> + Send

Source

fn subjects<'g>( self, predicate: Option<&'g Term>, object: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::SubjectStream<'g>, GraphError>> + Send

Source

fn predicates<'g>( self, subject: Option<&'g Term>, object: Option<&'g Term>, limit: Option<usize>, ) -> impl Future<Output = Result<Self::ObjectStream<'g>, GraphError>> + Send

Source

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§

Source

fn subject( self, predicate: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source

fn predicate( self, subject: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source

fn object( self, subject: Option<&Term>, predicate: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source

fn contains( self, triple: TripleRef<'_>, ) -> impl Future<Output = Result<bool, GraphError>> + Send

Source

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);
});
Source

fn default_triple_size_hint() -> usize

Source

fn default_buf_size_hint() -> usize

Source

fn triple_size_hint(&self) -> usize

Source

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.

Implementations on Foreign Types§

Source§

impl<'a, T> GraphView for &'a GraphORMMeta<T>
where T: GraphORM + Unpin + Debug + PartialEq + Sync + Send + 'a,

Source§

type Stream = Pin<Box<dyn Stream<Item = Result<Arc<Triple>, GraphError>> + Unpin + Send + 'a>>

Source§

type Filter<FilterType: TripleFilter + Send + Sync + Unpin + Clone> = DefaultFilter<&'a GraphORMMeta<T>, FilterType>

Source§

type Matches<'matches> = DefaultMatches<'matches, &'a GraphORMMeta<T>>

Source§

type Describe<'describe> = DefaultDescribe<'describe, &'a GraphORMMeta<T>>

Source§

type SubjectStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type PredicateStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type ObjectStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type CBD = CBD<&'a GraphORMMeta<T>>

Source§

async fn stream( self, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::Stream, GraphError>

Source§

async fn filter<FilterType>( self, filter: FilterType, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::Filter<FilterType>, GraphError>
where FilterType: TripleFilter + Send + Sync + Unpin + Clone,

Source§

async fn matches<'matches>( self, subject: Option<&'matches Term>, predicate: Option<&'matches Term>, object: Option<&'matches Term>, limit: Option<usize>, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::Matches<'matches>, GraphError>

Source§

async fn describe( self, subject: Option<&Term>, limit: Option<usize>, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::Describe<'_>, GraphError>

Source§

async fn subjects<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::SubjectStream<'stream>, GraphError>

Source§

async fn predicates<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::PredicateStream<'stream>, GraphError>

Source§

async fn objects<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<<&'a GraphORMMeta<T> as GraphView>::ObjectStream<'stream>, GraphError>

Source§

fn cbd( self, subject: &Term, ) -> impl Future<Output = Result<<&'a GraphORMMeta<T> as GraphView>::CBD, GraphError>>

Implementors§

Source§

impl<'a, G> GraphView for DefaultDescribe<'a, G>
where G: GraphView,

Source§

impl<'g> GraphView for &'g ConfigurableGraphs

Source§

impl<'g> GraphView for &'g SimpleGraph

Source§

impl<'g> GraphView for &'g LocalFileSourceGraph

Source§

impl<'g> GraphView for &'g GraphStoreHttpSourceGraph

Source§

impl<'g, G> GraphView for DefaultMatches<'g, G>
where G: GraphView,

Source§

impl<G> GraphView for CBD<G>
where G: GraphView + Clone,

Source§

type Stream = PhantonRefStream<Pin<Box<dyn Stream<Item = Result<Arc<Triple>, GraphError>> + Send>>, G>

Source§

type Filter<FilterType: TripleFilter + Send + Sync + Unpin + Clone> = DefaultFilter<CBD<G>, FilterType>

Source§

type Matches<'matches> = DefaultMatches<'matches, CBD<G>>

Source§

type Describe<'describe> = DefaultDescribe<'describe, CBD<G>>

Source§

type SubjectStream<'stream> = Map<<<CBD<G> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type PredicateStream<'stream> = Map<<<CBD<G> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type ObjectStream<'stream> = Map<<<CBD<G> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type CBD = CBD<CBD<G>>

Source§

impl<G, T> GraphView for DefaultFilter<G, T>
where G: GraphView, T: TripleFilter + Send + Sync + Unpin + Clone,

Source§

type Stream = DefaultFilterStream<<G as GraphView>::Stream, T>

Source§

type Filter<FilterType: TripleFilter + Send + Sync + Unpin + Clone> = DefaultFilter<DefaultFilter<G, T>, FilterType>

Source§

type Matches<'matches> = DefaultMatches<'matches, DefaultFilter<G, T>>

Source§

type Describe<'describe> = DefaultDescribe<'describe, DefaultFilter<G, T>>

Source§

type SubjectStream<'stream> = Map<<<DefaultFilter<G, T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type PredicateStream<'stream> = Map<<<DefaultFilter<G, T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type ObjectStream<'stream> = Map<<<DefaultFilter<G, T> as GraphView>::Matches<'stream> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type CBD = CBD<DefaultFilter<G, T>>