pub struct HdtGraph {
pub hdt: Hdt,
}
Expand description
Adapter to use HDT as a Sophia graph.
Fields§
§hdt: Hdt
Wrapped HDT instance
Implementations§
Trait Implementations§
source§impl Graph for HdtGraph
impl Graph for HdtGraph
source§fn triples(&self) -> GTripleSource<'_, Self>
fn triples(&self) -> GTripleSource<'_, Self>
§Example
use hdt::sophia::api::graph::Graph;
fn print_first_triple(graph: hdt::HdtGraph) {
println!("{:?}", graph.triples().next().expect("no triple in the graph"));
}
source§fn triples_matching<'s, S, P, O>(
&'s self,
sm: S,
pm: P,
om: O
) -> GTripleSource<'s, Self>
fn triples_matching<'s, S, P, O>( &'s self, sm: S, pm: P, om: O ) -> GTripleSource<'s, Self>
Only supports constant and “any” matchers. Non-constant matchers are supposed to be “any” matchers.
§Example
Who was born in Leipzig?
use hdt::{Hdt,HdtGraph};
use hdt::sophia::api::graph::Graph;
use hdt::sophia::api::term::{IriRef, SimpleTerm, matcher::Any};
fn query(dbpedia: hdt::HdtGraph) {
let birth_place = SimpleTerm::Iri(IriRef::new_unchecked("http://www.snik.eu/ontology/birthPlace".into()));
let leipzig = SimpleTerm::Iri(IriRef::new_unchecked("http://www.snik.eu/resource/Leipzig".into()));
let persons = dbpedia.triples_matching(Any, Some(birth_place), Some(leipzig));
}
§type Triple<'a> = [HdtTerm; 3]
type Triple<'a> = [HdtTerm; 3]
Determine the type of
Triple
s
that the methods of this graph will yield.§type Error = Infallible
type Error = Infallible
The error type that this graph may raise.
source§fn contains<TS, TP, TO>(&self, s: TS, p: TP, o: TO) -> Result<bool, Self::Error>
fn contains<TS, TP, TO>(&self, s: TS, p: TP, o: TO) -> Result<bool, Self::Error>
Return
true
if this graph contains the given triple.source§fn subjects(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn subjects( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the terms used as subject in this Graph. Read more
source§fn predicates(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn predicates( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the terms used as predicate in this Graph. Read more
source§fn objects(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn objects( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the terms used as object in this Graph. Read more
source§fn iris(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn iris( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the IRIs used in this Graph
(including those used inside quoted triples, if any). Read more
source§fn blank_nodes(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn blank_nodes( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the blank nodes used in this Graph
(including those used inside quoted triples, if any). Read more
source§fn literals(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn literals( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the literals used in this Graph
(including those used inside quoted triples, if any). Read more
source§fn quoted_triples<'s>(
&'s self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'s> as Triple>::Term, Self::Error>> + 's>
fn quoted_triples<'s>( &'s self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'s> as Triple>::Term, Self::Error>> + 's>
Build a fallible iterator of all the quoted triples used in this Graph
(including those used inside quoted triples, if any). Read more
source§fn variables(
&self
) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
fn variables( &self ) -> Box<dyn Iterator<Item = Result<<Self::Triple<'_> as Triple>::Term, Self::Error>> + '_>
Build a fallible iterator of all the variables used in this Graph
(including those used inside quoted triples, if any). Read more
source§fn as_dataset(&self) -> GraphAsDataset<&Self>
fn as_dataset(&self) -> GraphAsDataset<&Self>
Dataset
adapter borrowing this graphsource§fn as_dataset_mut(&mut self) -> GraphAsDataset<&mut Self>
fn as_dataset_mut(&mut self) -> GraphAsDataset<&mut Self>
Dataset
adapter borrowing this graph mutablysource§fn into_dataset(self) -> GraphAsDataset<Self>where
Self: Sized,
fn into_dataset(self) -> GraphAsDataset<Self>where
Self: Sized,
Dataset
adapter taking ownership of this graphAuto Trait Implementations§
impl Freeze for HdtGraph
impl !RefUnwindSafe for HdtGraph
impl Send for HdtGraph
impl Sync for HdtGraph
impl Unpin for HdtGraph
impl !UnwindSafe for HdtGraph
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