pub struct SRDFSparql { /* private fields */ }
Expand description
Implements SRDF interface as a SPARQL endpoint
Implementations§
Source§impl SRDFSparql
impl SRDFSparql
pub fn new( iri: &IriS, prefixmap: &PrefixMap, ) -> Result<SRDFSparql, SRDFSparqlError>
pub fn iri(&self) -> &IriS
pub fn prefixmap(&self) -> &PrefixMap
pub fn wikidata() -> Result<SRDFSparql, SRDFSparqlError>
pub fn with_prefixmap(self, pm: PrefixMap) -> SRDFSparql
pub fn show_literal(&self, lit: &Literal) -> String
Trait Implementations§
Source§impl AsyncSRDF for SRDFSparql
impl AsyncSRDF for SRDFSparql
type IRI = NamedNode
type BNode = BlankNode
type Literal = Literal
type Subject = Subject
type Term = Term
type Err = SRDFSparqlError
fn get_predicates_subject<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = Result<HashSet<NamedNode>, SRDFSparqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SRDFSparql: 'async_trait,
fn get_objects_for_subject_predicate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_subject: &'life1 Subject,
_pred: &'life2 NamedNode,
) -> Pin<Box<dyn Future<Output = Result<HashSet<Term>, SRDFSparqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
SRDFSparql: 'async_trait,
fn get_subjects_for_object_predicate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_object: &'life1 Term,
_pred: &'life2 NamedNode,
) -> Pin<Box<dyn Future<Output = Result<HashSet<Subject>, SRDFSparqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
SRDFSparql: 'async_trait,
Source§impl Clone for SRDFSparql
impl Clone for SRDFSparql
Source§fn clone(&self) -> SRDFSparql
fn clone(&self) -> SRDFSparql
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SRDFSparql
impl Debug for SRDFSparql
Source§impl FromStr for SRDFSparql
impl FromStr for SRDFSparql
Source§type Err = SRDFSparqlError
type Err = SRDFSparqlError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<SRDFSparql, <SRDFSparql as FromStr>::Err>
fn from_str(s: &str) -> Result<SRDFSparql, <SRDFSparql as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moreSource§impl Query for SRDFSparql
impl Query for SRDFSparql
fn triples( &self, ) -> Result<impl Iterator<Item = <SRDFSparql as Rdf>::Triple>, SRDFSparqlError>
Source§fn triples_matching<S, P, O>(
&self,
subject: S,
predicate: P,
object: O,
) -> Result<impl Iterator<Item = <SRDFSparql as Rdf>::Triple>, SRDFSparqlError>where
S: Matcher<<SRDFSparql as Rdf>::Subject>,
P: Matcher<<SRDFSparql as Rdf>::IRI>,
O: Matcher<<SRDFSparql as Rdf>::Term>,
fn triples_matching<S, P, O>(
&self,
subject: S,
predicate: P,
object: O,
) -> Result<impl Iterator<Item = <SRDFSparql as Rdf>::Triple>, SRDFSparqlError>where
S: Matcher<<SRDFSparql as Rdf>::Subject>,
P: Matcher<<SRDFSparql as Rdf>::IRI>,
O: Matcher<<SRDFSparql as Rdf>::Term>,
Note to implementors: this function needs to retrieve all the triples of
the graph. Therefore, for use-cases where the graph is large, this
function should be implemented in a way that it does not retrieve all
triples at once. As an example, for implementations of SPARQL, this
function should be implemented to retrieve just the triples that match
the given subject, predicate and object.
fn triples_with_subject<S>( &self, subject: S, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
fn triples_with_predicate<P>( &self, predicate: P, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
fn triples_with_object<O>( &self, object: O, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
fn incoming_arcs( &self, object: Self::Term, ) -> Result<HashMap<Self::IRI, HashSet<Self::Subject>>, Self::Err>
Source§fn outgoing_arcs(
&self,
subject: Self::Subject,
) -> Result<HashMap<Self::IRI, HashSet<Self::Term>>, Self::Err>
fn outgoing_arcs( &self, subject: Self::Subject, ) -> Result<HashMap<Self::IRI, HashSet<Self::Term>>, Self::Err>
get all outgoing arcs from a subject
Source§fn outgoing_arcs_from_list(
&self,
subject: &Self::Subject,
preds: &[Self::IRI],
) -> Result<(HashMap<Self::IRI, HashSet<Self::Term>>, Vec<Self::IRI>), Self::Err>
fn outgoing_arcs_from_list( &self, subject: &Self::Subject, preds: &[Self::IRI], ) -> Result<(HashMap<Self::IRI, HashSet<Self::Term>>, Vec<Self::IRI>), Self::Err>
get outgoing arcs from a
node
taking into account only a controlled list of preds
It returns a HashMap with the outgoing arcs and their values and a list of the predicates that have values and are not in the controlled list.Source§impl Rdf for SRDFSparql
impl Rdf for SRDFSparql
type IRI = NamedNode
type BNode = BlankNode
type Literal = Literal
type Subject = Subject
type Term = Term
type Triple = Triple
type Err = SRDFSparqlError
Source§fn resolve_prefix_local(
&self,
prefix: &str,
local: &str,
) -> Result<IriS, PrefixMapError>
fn resolve_prefix_local( &self, prefix: &str, local: &str, ) -> Result<IriS, PrefixMapError>
Resolves a a prefix and a local name and obtains the corresponding full
IriS
fn qualify_iri(&self, node: &NamedNode) -> String
fn qualify_subject(&self, subj: &Subject) -> String
fn qualify_term(&self, term: &Term) -> String
fn prefixmap(&self) -> Option<PrefixMap>
Source§impl Sparql for SRDFSparql
impl Sparql for SRDFSparql
fn query_select( &self, query: &str, ) -> Result<QuerySolutions<SRDFSparql>, SRDFSparqlError>
fn query_ask(&self, query: &str) -> Result<bool, SRDFSparqlError>
Auto Trait Implementations§
impl Freeze for SRDFSparql
impl !RefUnwindSafe for SRDFSparql
impl Send for SRDFSparql
impl Sync for SRDFSparql
impl Unpin for SRDFSparql
impl !UnwindSafe for SRDFSparql
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more