pub struct BlankNode(/* private fields */);
Expand description
An owned RDF blank node.
The common way to create a new blank node is to use the BlankNode::default()
function.
It is also possible to create a blank node from a blank node identifier using the BlankNode::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::BlankNode;
assert_eq!("_:a122", BlankNode::new("a122")?.to_string());
Implementations§
Source§impl BlankNode
impl BlankNode
Sourcepub fn new(id: impl Into<String>) -> Result<BlankNode, BlankNodeIdParseError>
pub fn new(id: impl Into<String>) -> Result<BlankNode, 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: impl Into<String>) -> BlankNode
pub fn new_unchecked(id: impl Into<String>) -> BlankNode
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.
BlankNode::new()
is a safe version of this constructor and should be used for untrusted data.
Sourcepub fn new_from_unique_id(id: u128) -> BlankNode
pub fn new_from_unique_id(id: u128) -> BlankNode
Creates a blank node from a unique numerical id.
In most cases, it is much more convenient to create a blank node using BlankNode::default()
.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Returns the underlying ID of this blank node.
pub fn as_ref(&self) -> BlankNodeRef<'_>
Trait Implementations§
Source§impl Default for BlankNode
impl Default for BlankNode
Source§fn default() -> BlankNode
fn default() -> BlankNode
Builds a new RDF blank node with a unique id.
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<'a> From<&'a BlankNode> for GraphNameRef<'a>
impl<'a> From<&'a BlankNode> for GraphNameRef<'a>
Source§fn from(node: &'a BlankNode) -> GraphNameRef<'a>
fn from(node: &'a BlankNode) -> GraphNameRef<'a>
Source§impl<'a> From<&'a BlankNode> for NamedOrBlankNodeRef<'a>
impl<'a> From<&'a BlankNode> for NamedOrBlankNodeRef<'a>
Source§fn from(node: &'a BlankNode) -> NamedOrBlankNodeRef<'a>
fn from(node: &'a BlankNode) -> NamedOrBlankNodeRef<'a>
Source§impl From<BlankNode> for NamedOrBlankNode
impl From<BlankNode> for NamedOrBlankNode
Source§fn from(node: BlankNode) -> NamedOrBlankNode
fn from(node: BlankNode) -> NamedOrBlankNode
Source§impl From<BlankNode> for TermPattern
impl From<BlankNode> for TermPattern
Source§fn from(node: BlankNode) -> TermPattern
fn from(node: BlankNode) -> TermPattern
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 FromStr for BlankNode
impl FromStr for BlankNode
Source§fn from_str(s: &str) -> Result<BlankNode, <BlankNode as FromStr>::Err>
fn from_str(s: &str) -> Result<BlankNode, <BlankNode as FromStr>::Err>
Parses a blank node from its NTriples serialization
use oxrdf::BlankNode;
use std::str::FromStr;
assert_eq!(BlankNode::from_str("_:ex")?, BlankNode::new("ex")?);
Source§type Err = TermParseError
type Err = TermParseError
Source§impl PartialEq<BlankNode> for BlankNodeRef<'_>
impl PartialEq<BlankNode> for BlankNodeRef<'_>
Source§impl PartialEq<BlankNodeRef<'_>> for BlankNode
impl PartialEq<BlankNodeRef<'_>> for BlankNode
impl Eq for BlankNode
impl StructuralPartialEq for BlankNode
Auto Trait Implementations§
impl Freeze for BlankNode
impl RefUnwindSafe for BlankNode
impl Send for BlankNode
impl Sync for BlankNode
impl Unpin for BlankNode
impl UnwindSafe for BlankNode
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