pub struct Namespace {
pub name: String,
pub iri: Uri<String>,
}
Expand description
A Namespace
represents a namespace IRI that can also be shown
in abbreviated format, also known as “prefix”.
For instance, the namespace IRI http://www.w3.org/1999/02/22-rdf-syntax-ns#
can also be shown (in RDF Turtle
or SPARQL for instance) as rdf:
.
A “local name” such as “type” in such a namespace would look
like http://www.w3.org/1999/02/22-rdf-syntax-ns#type or like rdf:type
.
Fields§
§name: String
assumed to end with ‘:’
iri: Uri<String>
assumed to end with either ‘/’ or ‘#’
Implementations§
Source§impl Namespace
impl Namespace
pub fn declare(name: &str, iri: &Uri<&str>) -> Result<Self, Error>
Sourcepub fn declare_iref_iri(name: &str, iri: &Iri) -> Result<Self, Error>
pub fn declare_iref_iri(name: &str, iri: &Iri) -> Result<Self, Error>
Variation of [declare
] that takes an iref::Iri
. We may want to
move back to iref since iref 3 is now available which seems to have
everything we need.
pub fn declare_from_str(name: &str, iri: &str) -> Result<Self, Error>
Sourcepub fn with_local_name(&self, name: &str) -> Result<Uri<String>, Error>
pub fn with_local_name(&self, name: &str) -> Result<Uri<String>, Error>
Return an identifier based on the current namespace IRI and the given local name within that namespace.
pub fn as_sparql_prefix(&self) -> String
pub fn as_turtle_prefix(&self) -> String
Trait Implementations§
impl Eq for Namespace
Auto Trait Implementations§
impl !Freeze for Namespace
impl !RefUnwindSafe for Namespace
impl Send for Namespace
impl Sync for Namespace
impl Unpin for Namespace
impl UnwindSafe for Namespace
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.