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>
Trait Implementations§
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())).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.