Struct RdfData

Source
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

Source

pub fn new() -> RdfData

Source

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

Source

pub fn from_graph(graph: SRDFGraph) -> Result<RdfData, RdfDataError>

Creates an RdfData from an in-memory RDF Graph

Source

pub fn clean_all(&mut self)

Source

pub fn graph(&self) -> Option<&SRDFGraph>

Get the in-memory graph

Source

pub fn clean_graph(&mut self)

Cleans the in-memory graph

Source

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

Source

pub fn from_endpoint(endpoint: SRDFSparql) -> RdfData

Creates an RdfData from an endpoint

Source

pub fn add_endpoint(&mut self, endpoint: SRDFSparql)

Adds a new endpoint to the list of endpoints

Source

pub fn prefixmap_in_memory(&self) -> PrefixMap

Gets the PrefixMap from the in-memory graph

Source

pub fn show_blanknode(&self, bn: &OxBlankNode) -> String

Source

pub fn show_literal(&self, lit: &OxLiteral) -> String

Source

pub fn serialize<W: Write>( &self, format: &RDFFormat, writer: &mut W, ) -> Result<(), RdfDataError>

Trait Implementations§

Source§

impl Clone for RdfData

Source§

fn clone(&self) -> RdfData

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RdfData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RdfData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FocusRDF for RdfData

Source§

fn set_focus(&mut self, focus: &Self::Term)

Set the value of the focus node
Source§

fn get_focus(&self) -> &Option<Self::Term>

Get the focus node if it exists
Source§

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>

Get the current focus as a Subject
Source§

impl Query for RdfData

Source§

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>
where S: Matcher<Self::Subject>, P: Matcher<Self::IRI>, O: Matcher<Self::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.
Source§

fn triples_with_subject<S>( &self, subject: S, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
where S: Matcher<Self::Subject>,

Source§

fn triples_with_predicate<P>( &self, predicate: P, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
where P: Matcher<Self::IRI>,

Source§

fn triples_with_object<O>( &self, object: O, ) -> Result<impl Iterator<Item = Self::Triple>, Self::Err>
where O: Matcher<Self::Term>,

Source§

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>

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>

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

Source§

type IRI = NamedNode

Source§

type BNode = BlankNode

Source§

type Literal = Literal

Source§

type Subject = Subject

Source§

type Term = Term

Source§

type Triple = Triple

Source§

type Err = RdfDataError

Source§

fn prefixmap(&self) -> Option<PrefixMap>

Source§

fn qualify_iri(&self, node: &Self::IRI) -> String

Source§

fn qualify_subject(&self, subj: &Self::Subject) -> String

Source§

fn qualify_term(&self, term: &Self::Term) -> String

Source§

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

Source§

fn empty() -> Self

Returns an empty RDF graph
Source§

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>

Adds a prefix declaration to the current RDF graph
Source§

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>
where S: Into<Self::Subject>, P: Into<Self::IRI>, O: Into<Self::Term>,

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>
where S: Into<Self::Subject>, P: Into<Self::IRI>, O: Into<Self::Term>,

Removes an RDF triple to the current RDF graph
Source§

fn add_type<S, T>(&mut self, _node: S, _type_: T) -> Result<(), Self::Err>
where S: Into<Self::Subject>, T: Into<Self::Term>,

Adds an rdf:type declaration to the current RDF graph
Source§

fn serialize<W: Write>( &self, format: &RDFFormat, writer: &mut W, ) -> Result<(), Self::Err>

Serialize the current graph to a Write implementation
Source§

fn add_bnode(&mut self) -> Result<Self::BNode, Self::Err>

Adds an Blank node to the RDF graph and get the node identifier
Source§

impl Sparql for RdfData

Source§

fn query_select( &self, query_str: &str, ) -> Result<QuerySolutions<RdfData>, RdfDataError>
where Self: Sized,

Source§

fn query_ask(&self, _query: &str) -> Result<bool, Self::Err>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T