srdf::srdf_graph::srdfgraph

Struct SRDFGraph

Source
pub struct SRDFGraph { /* private fields */ }

Implementations§

Source§

impl SRDFGraph

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn quads(&self) -> impl Iterator<Item = Quad> + '_

Source

pub fn is_empty(&self) -> bool

Source

pub fn merge_from_reader<R: Read>( &mut self, read: R, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<(), SRDFGraphError>

Source

pub fn merge_prefixes( &mut self, prefixmap: PrefixMap, ) -> Result<(), SRDFGraphError>

Source

pub fn from_reader<R: Read>( read: R, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<SRDFGraph, SRDFGraphError>

Source

pub fn resolve(&self, str: &str) -> Result<OxNamedNode, SRDFGraphError>

Source

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

Source

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

Source

pub fn from_str( data: &str, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<SRDFGraph, SRDFGraphError>

Source

pub fn merge_from_path<P: AsRef<Path>>( &mut self, path: P, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<(), SRDFGraphError>

Source

pub fn from_path<P: AsRef<Path>>( path: P, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<SRDFGraph, SRDFGraphError>

Source

pub fn parse_data( data: &String, format: &RDFFormat, base: &Path, reader_mode: &ReaderMode, ) -> Result<SRDFGraph, SRDFGraphError>

Source

pub fn prefixmap(&self) -> PrefixMap

Trait Implementations§

Source§

impl AsyncSRDF for SRDFGraph

Source§

type IRI = NamedNode

Source§

type BNode = BlankNode

Source§

type Literal = Literal

Source§

type Subject = Subject

Source§

type Term = Term

Source§

type Err = SRDFGraphError

Source§

fn get_predicates_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 OxSubject, ) -> Pin<Box<dyn Future<Output = Result<HashSet<OxNamedNode>, SRDFGraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_objects_for_subject_predicate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 OxSubject, pred: &'life2 OxNamedNode, ) -> Pin<Box<dyn Future<Output = Result<HashSet<OxTerm>, SRDFGraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn get_subjects_for_object_predicate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, object: &'life1 OxTerm, pred: &'life2 OxNamedNode, ) -> Pin<Box<dyn Future<Output = Result<HashSet<OxSubject>, SRDFGraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl Clone for SRDFGraph

Source§

fn clone(&self) -> SRDFGraph

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 SRDFGraph

Source§

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

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

impl Default for SRDFGraph

Source§

fn default() -> SRDFGraph

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

impl FocusRDF for SRDFGraph

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 SRDF for SRDFGraph

Source§

fn predicates_for_subject( &self, subject: &Self::Subject, ) -> Result<HashSet<Self::IRI>, Self::Err>

Source§

fn objects_for_subject_predicate( &self, subject: &Self::Subject, pred: &Self::IRI, ) -> Result<HashSet<Self::Term>, Self::Err>

Source§

fn subjects_with_predicate_object( &self, pred: &Self::IRI, object: &Self::Term, ) -> Result<HashSet<Self::Subject>, Self::Err>

Source§

fn outgoing_arcs( &self, subject: &Self::Subject, ) -> Result<HashMap<Self::IRI, HashSet<Self::Term>>, Self::Err>

Source§

fn incoming_arcs( &self, object: &Self::Term, ) -> Result<HashMap<Self::IRI, HashSet<Self::Subject>>, Self::Err>

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§

fn triples_with_predicate( &self, pred: &Self::IRI, ) -> Result<Vec<Triple<Self>>, Self::Err>

Source§

fn neighs( &self, node: &Self::Term, ) -> Result<ListOfIriAndTerms<Self::IRI, Self::Term>, Self::Err>

Get the neighbours of a term This code creates an intermediate vector and is not very efficient TODO: return an iterator
Source§

impl SRDFBasic for SRDFGraph

Source§

type IRI = NamedNode

RDF predicates
Source§

type BNode = BlankNode

Blannk nodes
Source§

type Literal = Literal

RDF Literals
Source§

type Subject = Subject

RDF subjects
Source§

type Term = Term

RDF terms
Source§

type Err = SRDFGraphError

RDF errors
Source§

fn subject_as_iri(subject: &OxSubject) -> Option<OxNamedNode>

Returns the RDF subject as an IRI if it is an IRI, None if it isn’t
Source§

fn subject_as_bnode(subject: &OxSubject) -> Option<OxBlankNode>

Returns the RDF subject as a Blank Node if it is a blank node, None if it isn’t
Source§

fn subject_is_iri(subject: &OxSubject) -> bool

Returns true if the subject is an IRI
Source§

fn subject_is_bnode(subject: &OxSubject) -> bool

Returns true if the subject is a Blank Node
Source§

fn term_as_iri(object: &OxTerm) -> Option<&OxNamedNode>

Source§

fn term_as_bnode(object: &OxTerm) -> Option<OxBlankNode>

Source§

fn term_as_literal(object: &OxTerm) -> Option<OxLiteral>

Source§

fn term_is_iri(object: &OxTerm) -> bool

Source§

fn term_is_bnode(object: &OxTerm) -> bool

Source§

fn term_is_literal(object: &OxTerm) -> bool

Source§

fn subject_as_term(subject: &Self::Subject) -> Self::Term

Source§

fn term_as_subject(object: &Self::Term) -> Option<Self::Subject>

Source§

fn lexical_form(literal: &OxLiteral) -> &str

Source§

fn lang(literal: &OxLiteral) -> Option<String>

Source§

fn datatype(literal: &OxLiteral) -> OxNamedNode

Source§

fn iri_s2iri(iri_s: &IriS) -> OxNamedNode

Source§

fn iri_as_term(iri: OxNamedNode) -> OxTerm

Source§

fn iri_as_subject(iri: OxNamedNode) -> OxSubject

Source§

fn iri2iri_s(iri: &OxNamedNode) -> IriS

Source§

fn term_s2term(term: &OxTerm) -> Self::Term

Source§

fn term_as_object(term: &OxTerm) -> Object

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§

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

Source§

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

Source§

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

Source§

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

Source§

fn bnode_id2bnode(id: &str) -> Self::BNode

Source§

fn bnode_as_term(bnode: Self::BNode) -> Self::Term

Source§

fn object_as_term(obj: &Object) -> Self::Term

Source§

fn bnode_as_subject(bnode: Self::BNode) -> Self::Subject

Source§

fn term_as_boolean(object: &Self::Term) -> Option<bool>

Source§

fn object_as_subject(obj: &Object) -> Option<Self::Subject>

Source§

fn literal_as_boolean(literal: &Self::Literal) -> Option<bool>

Source§

fn literal_as_integer(literal: &Self::Literal) -> Option<isize>

Source§

fn literal_as_string(literal: &Self::Literal) -> Option<String>

Source§

fn term_as_iri_s(term: &Self::Term) -> Option<IriS>

Source§

fn term_as_integer(term: &Self::Term) -> Option<isize>

Source§

fn term_as_string(term: &Self::Term) -> Option<String>

Source§

fn subject_as_object(subject: &Self::Subject) -> Object

Source§

fn datatype_str(literal: &Self::Literal) -> String

Source§

fn iri_s2subject(iri_s: &IriS) -> Self::Subject

Source§

fn iri_s2term(iri_s: &IriS) -> Self::Term

Source§

fn bnode_id2term(id: &str) -> Self::Term

Source§

fn bnode_id2subject(id: &str) -> Self::Subject

Source§

impl SRDFBuilder for SRDFGraph

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( &mut self, subj: &Self::Subject, pred: &Self::IRI, obj: &Self::Term, ) -> Result<(), Self::Err>

Adds an RDF triple to the current RDF graph
Source§

fn remove_triple( &mut self, subj: &Self::Subject, pred: &Self::IRI, obj: &Self::Term, ) -> Result<(), Self::Err>

Removes an RDf triple to the current RDF graph
Source§

fn add_type( &mut self, node: &RDFNode, type: Self::Term, ) -> Result<(), Self::Err>

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

fn empty() -> Self

Returns an empty RDF graph
Source§

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

Serialize the current graph to a Write implementation

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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