pub enum Term {
NamedNode(IriBuf),
Literal(Literal),
BlankNode(BlankNode),
TripleTerm(Arc<Triple>),
}Expand description
https://www.w3.org/TR/rdf11-concepts/#section-triples
Variants§
Implementations§
Source§impl Term
impl Term
pub fn into_iri(self) -> Result<IriBuf, TermError>
pub fn into_literal(self) -> Result<Literal, TermError>
pub fn into_blank_node(self) -> Result<BlankNode, TermError>
pub fn into_triple_term(self) -> Result<Arc<Triple>, TermError>
pub fn to_iri(&self) -> Result<&IriBuf, TermError>
pub fn to_literal(&self) -> Result<&Literal, TermError>
pub fn to_blank_node(&self) -> Result<&BlankNode, TermError>
pub fn to_triple_term(&self) -> Result<&Arc<Triple>, TermError>
pub fn is_named_node(&self) -> bool
pub fn is_blank_node(&self) -> bool
pub fn is_literal(&self) -> bool
pub fn is_triple_term(&self) -> bool
Sourcepub fn ground(&self) -> bool
pub fn ground(&self) -> bool
Checks whether term is ground as defined by RDF Concepts and Abstract Syntax
A term is ground if it is not a blank node or a triple term containing a blank node.
§Example
use taganak_core::terms::Term;
use std::sync::Arc;
let nn: Arc<Term> = Arc::new("<https://example.com/foo>".try_into().unwrap());
let bn: Arc<Term> = Arc::new("_:b1".try_into().unwrap());
let li: Arc<Term> = Arc::new(r#""Something""#.try_into().unwrap());
assert_eq!(nn.ground(), true);
assert_eq!(li.ground(), true);
assert_eq!(bn.ground(), false);Trait Implementations§
Source§impl GraphORMField for Term
impl GraphORMField for Term
Source§impl TryFrom<&str> for Term
impl TryFrom<&str> for Term
Source§fn try_from(value: &str) -> Result<Term, <Term as TryFrom<&str>>::Error>
fn try_from(value: &str) -> Result<Term, <Term as TryFrom<&str>>::Error>
§Examples
use language_tags::LanguageTag;
use taganak_core::terms::{Iri, Literal, Term};
let t1: Term = "<https://example.com/foo#bar>".try_into().unwrap();
let t2: Term = r#""Schildkröte"@de"#.try_into().unwrap();
assert_eq!(t1, Term::NamedNode(Iri::new("https://example.com/foo#bar".to_string()).unwrap()));
assert_eq!(t2, Term::Literal(Literal::new("Schildkröte".to_string(), None, Some(LanguageTag::parse("de").unwrap()), None).unwrap()));impl Eq for Term
impl StructuralPartialEq for Term
Auto Trait Implementations§
impl Freeze for Term
impl RefUnwindSafe for Term
impl Send for Term
impl Sync for Term
impl Unpin for Term
impl UnwindSafe for Term
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.