pub struct RdfData { /* private fields */ }
Expand description
Generic abstraction that represents RDF Data which can be behind SPARQL endpoints or an in-memory graph or both The triples in RdfData are taken as the union of the triples of the endpoints and the in-memory graph
Implementations§
Source§impl RdfData
impl RdfData
pub fn new() -> RdfData
Sourcepub fn check_store(&mut self) -> Result<(), RdfDataError>
pub fn check_store(&mut self) -> Result<(), RdfDataError>
Checks if the Store has been initialized
By default, the RDF Data Store is not initialized as it is expensive and is only required for SPARQL queries
Sourcepub fn from_graph(graph: SRDFGraph) -> Result<RdfData, RdfDataError>
pub fn from_graph(graph: SRDFGraph) -> Result<RdfData, RdfDataError>
Creates an RdfData from an in-memory RDF Graph
pub fn clean_all(&mut self)
Sourcepub fn clean_graph(&mut self)
pub fn clean_graph(&mut self)
Cleans the in-memory graph
Sourcepub fn merge_from_reader<R: Read>(
&mut self,
read: R,
format: &RDFFormat,
base: Option<&str>,
reader_mode: &ReaderMode,
) -> Result<(), RdfDataError>
pub fn merge_from_reader<R: Read>( &mut self, read: R, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<(), RdfDataError>
Merge the in-memory graph with the graph read from a reader
Sourcepub fn from_endpoint(endpoint: SRDFSparql) -> RdfData
pub fn from_endpoint(endpoint: SRDFSparql) -> RdfData
Creates an RdfData from an endpoint
Sourcepub fn add_endpoint(&mut self, endpoint: SRDFSparql)
pub fn add_endpoint(&mut self, endpoint: SRDFSparql)
Adds a new endpoint to the list of endpoints
Sourcepub fn prefixmap_in_memory(&self) -> PrefixMap
pub fn prefixmap_in_memory(&self) -> PrefixMap
Gets the PrefixMap from the in-memory graph
pub fn show_blanknode(&self, bn: &OxBlankNode) -> String
pub fn show_literal(&self, lit: &OxLiteral) -> String
pub fn serialize<W: Write>( &self, format: &RDFFormat, writer: &mut W, ) -> Result<(), RdfDataError>
Trait Implementations§
Source§impl FocusRDF for RdfData
impl FocusRDF for RdfData
Source§fn get_focus_as_term(&self) -> Result<&Self::Term, RDFParseError>
fn get_focus_as_term(&self) -> Result<&Self::Term, RDFParseError>
Get the current focus as a Term
Source§fn get_focus_as_subject(&self) -> Result<Self::Subject, RDFParseError>
fn get_focus_as_subject(&self) -> Result<Self::Subject, RDFParseError>
Get the current focus as a Subject
Source§impl Query for RdfData
impl Query for RdfData
fn triples(&self) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
Source§fn triples_matching<S, P, O>(
&self,
subject: S,
predicate: P,
object: O,
) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
fn triples_matching<S, P, O>( &self, subject: S, predicate: P, object: O, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
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 RdfData
impl Rdf for RdfData
type IRI = NamedNode
type BNode = BlankNode
type Literal = Literal
type Subject = Subject
type Term = Term
type Triple = Triple
type Err = RdfDataError
fn prefixmap(&self) -> Option<PrefixMap>
fn qualify_iri(&self, node: &Self::IRI) -> String
fn qualify_subject(&self, subj: &Self::Subject) -> String
fn qualify_term(&self, term: &Self::Term) -> String
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
Source§impl SRDFBuilder for RdfData
impl SRDFBuilder for RdfData
Source§fn add_base(&mut self, _base: &Option<IriS>) -> Result<(), Self::Err>
fn add_base(&mut self, _base: &Option<IriS>) -> Result<(), Self::Err>
Adds an optional IRI as base
Source§fn add_prefix(&mut self, _alias: &str, _iri: &IriS) -> Result<(), Self::Err>
fn add_prefix(&mut self, _alias: &str, _iri: &IriS) -> Result<(), Self::Err>
Adds a prefix declaration to the current RDF graph
Source§fn add_prefix_map(&mut self, _prefix_map: PrefixMap) -> Result<(), Self::Err>
fn add_prefix_map(&mut self, _prefix_map: PrefixMap) -> Result<(), Self::Err>
Adds a prefix map declaration to the current RDF graph
Source§fn add_triple<S, P, O>(
&mut self,
_subj: S,
_pred: P,
_obj: O,
) -> Result<(), Self::Err>
fn add_triple<S, P, O>( &mut self, _subj: S, _pred: P, _obj: O, ) -> Result<(), Self::Err>
Adds an RDF triple to the current RDF graph
Source§fn remove_triple<S, P, O>(
&mut self,
_subj: S,
_pred: P,
_obj: O,
) -> Result<(), Self::Err>
fn remove_triple<S, P, O>( &mut self, _subj: S, _pred: P, _obj: O, ) -> Result<(), Self::Err>
Removes an RDF triple to the current RDF graph
Source§fn add_type<S, T>(&mut self, _node: S, _type_: T) -> Result<(), Self::Err>
fn add_type<S, T>(&mut self, _node: S, _type_: T) -> Result<(), Self::Err>
Adds an
rdf:type
declaration to the current RDF graphAuto Trait Implementations§
impl Freeze for RdfData
impl !RefUnwindSafe for RdfData
impl Send for RdfData
impl Sync for RdfData
impl Unpin for RdfData
impl !UnwindSafe for RdfData
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