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 more