pub struct BlankNodeRef<'a>(/* private fields */);
Expand description
A borrowed RDF blank node.
The common way to create a new blank node is to use the BlankNode::default
trait method.
It is also possible to create a blank node from a blank node identifier using the BlankNodeRef::new()
function.
The blank node identifier must be valid according to N-Triples, Turtle, and SPARQL grammars.
The default string formatter is returning an N-Triples, Turtle, and SPARQL compatible representation:
use oxrdf::BlankNodeRef;
assert_eq!("_:a122", BlankNodeRef::new("a122")?.to_string());
Implementations§
Source§impl<'a> BlankNodeRef<'a>
impl<'a> BlankNodeRef<'a>
Sourcepub fn new(id: &'a str) -> Result<BlankNodeRef<'a>, BlankNodeIdParseError>
pub fn new(id: &'a str) -> Result<BlankNodeRef<'a>, BlankNodeIdParseError>
Creates a blank node from a unique identifier.
The blank node identifier must be valid according to N-Triples, Turtle, and SPARQL grammars.
In most cases, it is much more convenient to create a blank node using BlankNode::default()
.
that creates a random ID that could be easily inlined by Oxigraph stores.
Sourcepub fn new_unchecked(id: &'a str) -> BlankNodeRef<'a>
pub fn new_unchecked(id: &'a str) -> BlankNodeRef<'a>
Creates a blank node from a unique identifier without validation.
It is the caller’s responsibility to ensure that id
is a valid blank node identifier
according to N-Triples, Turtle, and SPARQL grammars.
[BlankNodeRef::new()
) is a safe version of this constructor and should be used for untrusted data.
Sourcepub const fn unique_id(&self) -> Option<u128>
pub const fn unique_id(&self) -> Option<u128>
Returns the internal numerical ID of this blank node if it has been created using BlankNode::new_from_unique_id
.
use oxrdf::BlankNode;
assert_eq!(
BlankNode::new_from_unique_id(128).as_ref().unique_id(),
Some(128)
);
assert_eq!(BlankNode::new("foo")?.as_ref().unique_id(), None);
pub fn into_owned(self) -> BlankNode
Trait Implementations§
Source§impl<'a> Clone for BlankNodeRef<'a>
impl<'a> Clone for BlankNodeRef<'a>
Source§fn clone(&self) -> BlankNodeRef<'a>
fn clone(&self) -> BlankNodeRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for BlankNodeRef<'a>
impl<'a> Debug for BlankNodeRef<'a>
Source§impl Display for BlankNodeRef<'_>
impl Display for BlankNodeRef<'_>
Source§impl<'a> From<&'a BlankNode> for BlankNodeRef<'a>
impl<'a> From<&'a BlankNode> for BlankNodeRef<'a>
Source§fn from(node: &'a BlankNode) -> BlankNodeRef<'a>
fn from(node: &'a BlankNode) -> BlankNodeRef<'a>
Source§impl From<BlankNodeRef<'_>> for GraphName
impl From<BlankNodeRef<'_>> for GraphName
Source§fn from(node: BlankNodeRef<'_>) -> GraphName
fn from(node: BlankNodeRef<'_>) -> GraphName
Source§impl From<BlankNodeRef<'_>> for NamedOrBlankNode
impl From<BlankNodeRef<'_>> for NamedOrBlankNode
Source§fn from(node: BlankNodeRef<'_>) -> NamedOrBlankNode
fn from(node: BlankNodeRef<'_>) -> NamedOrBlankNode
Source§impl From<BlankNodeRef<'_>> for PlainTermScalar
impl From<BlankNodeRef<'_>> for PlainTermScalar
Source§fn from(term: BlankNodeRef<'_>) -> PlainTermScalar
fn from(term: BlankNodeRef<'_>) -> PlainTermScalar
Source§impl From<BlankNodeRef<'_>> for Term
impl From<BlankNodeRef<'_>> for Term
Source§fn from(node: BlankNodeRef<'_>) -> Term
fn from(node: BlankNodeRef<'_>) -> Term
Source§impl<'a> From<BlankNodeRef<'a>> for BlankNode
impl<'a> From<BlankNodeRef<'a>> for BlankNode
Source§fn from(node: BlankNodeRef<'a>) -> BlankNode
fn from(node: BlankNodeRef<'a>) -> BlankNode
Source§impl<'a> From<BlankNodeRef<'a>> for GraphNameRef<'a>
impl<'a> From<BlankNodeRef<'a>> for GraphNameRef<'a>
Source§fn from(node: BlankNodeRef<'a>) -> GraphNameRef<'a>
fn from(node: BlankNodeRef<'a>) -> GraphNameRef<'a>
Source§impl<'a> From<BlankNodeRef<'a>> for NamedOrBlankNodeRef<'a>
impl<'a> From<BlankNodeRef<'a>> for NamedOrBlankNodeRef<'a>
Source§fn from(node: BlankNodeRef<'a>) -> NamedOrBlankNodeRef<'a>
fn from(node: BlankNodeRef<'a>) -> NamedOrBlankNodeRef<'a>
Source§impl<'a> From<BlankNodeRef<'a>> for TermRef<'a>
impl<'a> From<BlankNodeRef<'a>> for TermRef<'a>
Source§fn from(node: BlankNodeRef<'a>) -> TermRef<'a>
fn from(node: BlankNodeRef<'a>) -> TermRef<'a>
Source§impl<'a> Hash for BlankNodeRef<'a>
impl<'a> Hash for BlankNodeRef<'a>
Source§impl PartialEq<BlankNode> for BlankNodeRef<'_>
impl PartialEq<BlankNode> for BlankNodeRef<'_>
Source§impl PartialEq<BlankNodeRef<'_>> for BlankNode
impl PartialEq<BlankNodeRef<'_>> for BlankNode
Source§impl<'a> PartialEq for BlankNodeRef<'a>
impl<'a> PartialEq for BlankNodeRef<'a>
impl<'a> Copy for BlankNodeRef<'a>
impl<'a> Eq for BlankNodeRef<'a>
impl<'a> StructuralPartialEq for BlankNodeRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for BlankNodeRef<'a>
impl<'a> RefUnwindSafe for BlankNodeRef<'a>
impl<'a> Send for BlankNodeRef<'a>
impl<'a> Sync for BlankNodeRef<'a>
impl<'a> Unpin for BlankNodeRef<'a>
impl<'a> UnwindSafe for BlankNodeRef<'a>
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
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
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more