This crate is part of Sophia, an RDF and Linked Data toolkit in Rust.
Terms are the building blocks of an RDF graph. There are four types of terms: IRIs, blank nodes (BNode for short), literals and variables.
NB: variable only exist in generalized RDF.
This module defines a generic type Term
which can be derived differently depending on your needs.
-
RefTerm<'a>
(alias ofTerm<&'a str>
) should be used for very short-lived terms, i.e. terms that live less than'a
, which is the lifetime of their underlying text. -
BoxTerm
(alias ofTerm<Box<str>>
) should be used when the term may outlive the text used to create it. -
RcTerm
(alias ofTerm<Rc<str>>
) should also be used for long-lived terms, especially if they need to be cloned multiple times. The use ofRc
prevents the duplication of the underlying text, while ensuring that it is cleaned when appropriate. -
ArcTerm
(alias ofTerm<Arc<str>>
) should be used when, additionally, terms need to be sent to other threads. -
StaticTerm
(alias ofTerm<&'static str>) is a special case of
RefTerm` where the underlying text is a static string. Those terms can live as long as the program runs, and be cloned and sent without any restriction. -
MownTerm
(alias of `Term<MownStr<'a>>) should be used in situations where some terms can borrow their data, while others need to own it.